Problem with glPolygonMode

I want my program to start in GL_FRONT rendering mode but it always starts in GL_FRONT_AND_BACK mode.

I try calling “glPolygonMode(GL_FRONT, GL_FILL);” at different location in the code, before the first glBegin(), with no result. But I seem to de able to chance the later in to program, under some circumstances…

glPolygonMode(GL_FRONT, GL_FILL); //First call, no effect
glBegin (GL_QUADS);
PlotBorders(MAX_X + 1, MIN_X, MAX_Y + 1, MIN_Y, MAX_Z + 1, MIN_Z);

SwapBuffers(g_hDC); // Swap the backbuffers to the foreground
glPolygonMode(GL_FRONT, GL_FILL); // Calling second time, no effect

If anyone has any idea why, id be gratefull…


The first parameter to glPolygonMode isn’t a mode, it just specifies which of (or both of) the two polygon modes is changed. The glPolygonMode calls you’re making have no effect on the default state, because for both front and back, the default is GL_FILL.

When you say GL_FRONT rendering mode, I assume you mean that you want back-facing polygons to be culled. You can do that with glEnable(GL_CULL_FACE).

That make things a hole lot more comprehensible!

What I wanted to do was:

glPolygonMode(GL_BACK, GL_LINE);

to make back facing polygons appear as wire frames.