PDA

View Full Version : gouraud shading



09-26-2000, 03:41 AM
hi guys... http://www.opengl.org/discussion_boards/ubb/smile.gif

i want to know...can i produce Gouraud Shading using OpenGL? if it can...can u guys out there show me how to do the source codes?

Bob
09-26-2000, 05:10 AM
glShadeModel(GL_SMOOTH) to enable gouraud shading. But you shouldn't have to do anything at all to get gouraud, because it's enabled by default.

nikopol0
09-26-2000, 05:23 AM
hum, just don't forget to give one normal by vertex ...

09-26-2000, 06:53 AM
i dun quite understand actually...can u explain it a lil more detail?

Bob
09-26-2000, 11:59 PM
Gouraud shading is enabled by default, and there is nothing you have to do to enable it. Just try it out by passing a triangle with different colors for each vertex.



glBegin(GL_TRIANGLES);
glColor3f(...);
glVertex3f(...);
glColor3f(...);
glVertex3f(...);
glColor3f(...);
glVertex3f(...);
glEnd();

... for example. Just insert proper values and run.

Normals is just for lightning and sphere mapping (in the core at least, not counting extensions).