OpenGL - GL_FRONT vs GL_FRONT_AND_BACK

I am engaged in an open source project that uses OpenGL for rendering in 3D. When building materials, I see the following code:

// set ambient material reflectance
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mAmbient);

In other examples, this is used:

glMaterialfv(GL_FRONT, GL_AMBIENT, mAmbient);

So my question is: what is the difference? Under what circumstances will it look different and, if my volume is surrounded by all the normals directed outwards, is there a difference in performance?

+3
source share
1 answer

One sets the material for the front and back surfaces, and the other - only the front. If you reject back faces, it does not matter much. If you do not reject the back faces, well, you will see the material only on the front side.

, , , - , , . , , . ( , , , : ). OpenGL /quad/ ..

+7

Source: https://habr.com/ru/post/1749700/


All Articles