Rachael Dawn
Rachael Dawn

Reputation: 889

What are acceptable glPolygonMode first-argument values?

The documentation for glPolygonMode only specifies the enum GL_FRONT_AND_BACK as an acceptable first parameter (face). Are there other acceptable enums, such as only the front, or only the back?

glPolygonMode(GLenum face, GLenum mode);

I know that mode only supports GL_POINT, GL_LINE, and GL_FILL, but it just seems extremely strange that the only one the documentation specifies for face is GL_FRONT_AND_BACK, but it's a requirement to use it as an argument.

Upvotes: 3

Views: 724

Answers (1)

MuertoExcobito
MuertoExcobito

Reputation: 10039

glPolygonMode accepted different parameters for the face in legacy OpenGL contexts. If you look at the Khronos man page for it for OpenGL 2.1, it says:

face Specifies the polygons that mode applies to. Must be GL_FRONT for front-facing polygons, GL_BACK for back-facing polygons, or GL_FRONT_AND_BACK for front- and back-facing polygons.

Conversely, in the OpenGL 4 man page, it says:

face Specifies the polygons that mode applies to. Must be GL_FRONT_AND_BACK for front- and back-facing polygons.

In the OpenGL 3.3 spec, in the section 'E2. Deprecated and Removed Features', it lists:

Separate polygon draw mode - PolygonMode face values of FRONT and BACK; polygons are always drawn in the same mode, no matter which face is being rasterized.

Likely, the face parameter was just retained for compilation equivalence for different OpenGL context targets, even though in modern OpenGL, it can really only have one value, and is now redundant.

Upvotes: 5

Related Questions