PDA

View Full Version : glPolygonMode and glCullFace understands GL_FRONT, GL_BACK in a different way



Orangus
06-18-2015, 10:19 AM
I wanted to render a thing on the screen, it used face culling.
To debug I used glPolygonMode to see lines instead of fill faces

I did that:


glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);

glPolygonMode(GL_FRONT, GL_LINE);

But it worked only like that:


glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glPolygonMode(GL_BACK, GL_LINE);

It's like glPolygonMode understands GL_BACK as GL_FRONT.

It works the same way independently is added the code
glEnable(GL_POLYGON_MODE) or not.

I didn't find the answer anywhere.

OpenGL version: 3.3.0
Graphics card: nVidia GeForce 9400 GT
OS: Window 7

Alfonse Reinheart
06-18-2015, 10:57 AM
First, there is no GL_POLYGON_MODE enable, which is why that didn't affect anything.

The rest sounds like exactly what should happen. glCullFace sets the face you want to cull. If you cull the front faces, then only the back faces will be rendered.