glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glPolygonMode(GL_BACK,GL_LINE);
In the above code sample, glPolygonMode throws invalid enum error? How to resolve this issue?
GL_INVALID_ENUM
is generated if either face or mode (respectively the first and second parameter) of your question is not an accepted value. Your first parameter must be GL_FRONT_AND_BACK
for front- and back-facing polygons as GL_FRONT
and GL_BACK
has been deprecated for this method.
EDIT
Since you seems to be asking an other question in your comment. If you want to draw an ink around a filled polygon you should render your geometry two times; render once filled and once wireframe. Slightly shift the wireframe to avoid depth fighting. the two geometries might overlap otherwise
// first draw your polygon filled (this is assuming your glPolygonMode is set to GL_FILL - this is the default mode normally)
// draw your polygons
// offset the wireframe
glEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(-1,-1);
// draw the wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// draw the same polygons again
// restore default polygon mode
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_POLYGON_OFFSET_LINE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With