Jump to content
  • Advertisement
Sign in to follow this  
dpadam450

Phong, texture compiling problems

This topic is 4162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is what I have now. I've tried doing a bunch of things to get texturing in, but I get compile errors every time. What would you do to add texturing? error C0000: syntax error, unexpected '*' at token "*" error C0501: type name expected at token "*"
varying vec3 normal;
varying vec3 lightvec;
varying vec3 viewvec;


void main(void)
{

	vec3 newnormal = vec3( normalize(normal) );
	vec3 newlightvec = vec3( normalize(lightvec) );
	vec3 newviewvec	 = normalize(viewvec);
	vec3 reflectvec = reflect(-newlightvec, newnormal);

	float specValue = clamp(dot(reflectvec, newviewvec),0.0, 1.0);
	

	gl_FragColor = vec4( gl_LightSource[0].diffuse*max(dot(newlightvec,newnormal),0.0)) 
				+ (gl_LightSource[0].diffuse*specValue );


}
This is my most recent try to get it to work: I marked the 3 added lines.
varying vec3 normal;
varying vec3 lightvec;
varying vec3 viewvec;

uniform sampler2D Texture1;<<<<<<<<<<<<<<<<<<<<<<

void main(void)
{
	vec3 texcolor = texture2D(Texture1, gl_TexCoord[0].st);<<<<<<<<<<<

	vec3 newnormal = vec3( normalize(normal) );
	vec3 newlightvec = vec3( normalize(lightvec) );
	vec3 newviewvec	 = normalize(viewvec);
	vec3 reflectvec = reflect(-newlightvec, newnormal);

	float specValue = clamp(dot(reflectvec, newviewvec),0.0, 1.0);
	

	gl_FragColor = vec4(  gl_LightSource[0].diffuse*max(dot(newlightvec,newnormal),0.0))*vec4(texcolor,1.0)<<<<<< 
				+ (gl_LightSource[0].diffuse*specValue );

}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!