The glPolygonMode function selects a polygon rasterization mode.
void glPolygonMode(
GLenum face,
GLenum mode
);
The glPolygonMode function controls the interpretation of polygons for rasterization. The face parameter describes which polygons mode applies to: front-facing polygons (GL_FRONT), back-facing polygons (GL_BACK), or both (GL_FRONT_AND_BACK). The polygon mode affects only the final rasterization of polygons. In particular, a polygon's vertices are lit and the polygon is clipped and possibly culled before these modes are applied.
To draw a surface with filled back-facing polygons and outlined front-facing polygons, call
glPolygonMode(GL_FRONT, GL_LINE);
Vertices are marked as boundary or nonboundary with an edge flag. Edge flags are generated internally by OpenGL when it decomposes polygons, and they can be set explicitly using glEdgeFlag.
The following function retrieves information related to glPolygonMode:
glGet with argument GL_POLYGON_MODE
The following are the error codes generated and their conditions.
Error Code | Condition |
---|---|
GL_INVALID_ENUM | Either face or mode was not an accepted value. |
GL_INVALID_OPERATION | glPolygonMode was called between a call to glBegin and the corresponding call to glEnd. |
Windows NT: Use version 3.5 and later.
Windows: Use Windows 95 and later.
Windows CE: Unsupported.
Header: Declared in gl.h.
Import Library: Link with opengl32.lib.
glBegin, glEdgeFlag, glEnd, glLineStipple, glLineWidth, glPointSize, glPolygonStipple