View Full Version : GLShadeMode

10-23-2009, 05:27 AM
Iv been trying this:

if(key == 'p' || key == 'P')
wireframe = 1-wireframe;
if (wireframe)

But nothing seems to happens, what do i do?

[wireframe = 1]

10-23-2009, 01:32 PM
glShadeModel controls how polygons are shaded. That is, whether they are shaded with a solid color or a different colors. For instance, if you specify a triangle with GL_FLAT, and one vertes is red, one green, and the last blue, the entire triangle will be blue. With GL_SMOOTH, the of a point on the triangle is blended between the threee based on its position.

I think you're looking for glPolygonMode; see the man page (http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html).

10-24-2009, 06:03 AM
Well am looking to with the press of a button switch between:
rendering in flat shaded polygonization
rendering in smooth shaded polygonization

I dont know if glPolygonMode can do that?

10-24-2009, 07:39 AM
If you want to swap the shading, then glShadeModel is what you want. I had thought that since you used the variable wireframe, you might want to display a wireframe instead of a solid.

Are you using lighting? The spec (2.1) says that "A primitive may be flatshaded, meaning that all vertices of the primitive are assigned the same color index or the same primary and secondary colors."(section 2.14.7) It would seem that this does not stop lighting calculations from happening, so the resulting triangle could be smoothly shaded...