Jump to content
  • Advertisement
Sign in to follow this  
mike74

OpenGL shade model

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

When you do glShadeModel(GL_FLAT), how does OpenGL decide which vertex normal to use? Or, does it average the vertex normals? mike http://www.coolgroups.com/

Share this post


Link to post
Share on other sites
Advertisement
There's no averaging done, the color comes from a single vertex. There's a table in the man page that shows this:
 -------------------------------------
Primitive Type of Polygon i Vertex
-------------------------------------
Single polygon (i≡1) 1
Triangle strip i+2
Triangle fan i+2
Independent triangle 3i
Quad strip 2i+2
Independent quad 4i
-------------------------------------

So a single polygon gets its color from the first vertex.
Triangle i (counting from 1) in a strip gets its color from vertex i+2 in the strip, and so on.

Share this post


Link to post
Share on other sites
Quote:
Original post by mike74
When you do glShadeModel(GL_FLAT), how does OpenGL decide which vertex normal to use? Or, does it average the vertex normals?
TomasH is right. Also keep in mind that the shading model has nothing to do with normals, only the calculated colors at the vertices. With lighting enabled, the calculated color does have some relation to the normals however.

Share this post


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

  • 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!