c++ - Incorrect OpenGL winding -


when initializing opengl, set following:

glenable(gl_cull_face); glfrontface(gl_ccw); glcullface(gl_front); 

then, draw triangle on screen. that's do, really. opengl uses opposite winding type of specify using glfrontface.

the triangle vertices defined follows:

static glfloat triangle[] = {    0.0f,  0.5f,  0.0f,  // point 1 on image   -0.5f, -0.5f,  0.0f,  // point 2    0.5f, -0.5f,  0.0f,  // point 3 }; 

you can see results on following image:

enter image description here

what expect gl_ccw draws triangle , cl_cw doesn't. happens opposite.

my perspective , view matrices correct. cause problem?

glcullface specifies side gets culled away, not side drawn. when triangle given in ccw order , enable way do, front faces (ccw faces) culled away , nothing drawn.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -