Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Smooth shading problem

This topic is 5303 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

Anyone have any idea why this isnt smooth shading properly? the green lines are the vertex normals and all seem to be correct! Initiation code:
void init_scene()

	GLfloat mat_diffuse[] = {0.57, 0.49, 0.33, 1.0};

	//Assign values to light parameters

	GLfloat light1_ambient[] = {0.5, 0.5, 0.5, 1.0};
	GLfloat light1_diffuse[] = {0.7, 0.7, 0.5, 1.0};
	GLfloat light1_specular[] = {0.1, 0.1, 0.1, 1.0};
	GLfloat light1_position[] = {1.0, -1.0, -1.0, 0.0};

	//Assign the parameters to Light 1

	glLightfv( GL_LIGHT1, GL_AMBIENT, light1_ambient);
	glLightfv( GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
	glLightfv( GL_LIGHT1, GL_SPECULAR, light1_specular);
	glLightfv( GL_LIGHT1, GL_POSITION, light1_position);

	//Enable lighting and light 1


	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);

polygon drawing code:

	for(i = 0; i< Scene.Objects[0].num_polygons; i++)


[edited by - Paul7 on April 15, 2004 1:46:04 PM] [edited by - Paul7 on April 18, 2004 3:45:40 AM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
You''re using the same normal for different vertices, therefore, polygons aren''t smooth. You should use different.

probably an error in the drawing loop. u forgot to change A''s to B and C.

Share this post

Link to post
Share on other sites
oh yeah, wat a stupid mistake to make, just copied and pasted it and forgot to change the letters. Thanks alot!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!