PDA

View Full Version : problems with glFrontFace() and glCullFace



miroslav_karpis
11-17-2008, 01:12 AM
I'm following the redBook and I have following problems:

I have following vertices defined as polygon:

glVertex3f(50,50,0);
glVertex3f(50,200,0);
glVertex3f(250,200,0);
glVertex3f(250,200,1.0);
glVertex3f(150,180,1.0);
glVertex3f(150,100,1.0);
glVertex3f(250,50,1.0);
glVertex3f(250,50,0.0);


Problem 1: I wanted to test the glFrontFace() with GL_CCW and GL_CW but in both cases I get this (the point is that I'm missing the functionality idea):
http://www.eisbergstudio.com/01_upload/openGL/test01.jpg

Problem 2a: I wanted to test the glCullFace(). When I entered glDisable(GL_CULL_FACE) (all polygons should be displayed) I got the same result as in attached image.

problem 2a: When I entered:
glCullFace(GL_FRONT) and enabled the GL_CULL_FACE I got this:
http://www.eisbergstudio.com/01_upload/openGL/test02.jpg

should't be here displayed only the back sides? :p

_NK47
11-17-2008, 03:01 AM
if glDisable(GL_CULL_FACE) fails then your vertices are simply wrong. the question is how do you render the data. GL_POLYGON?

sharp_pixel
11-17-2008, 03:16 AM
To my knowledge, GL_POLYGON only works with convex polygons.
To draw non-convex polygons, I usually use a GLUtesselator based rendering.
Hope this helps.

miroslav_karpis
11-17-2008, 04:49 AM
To my knowledge, GL_POLYGON only works with convex polygons.
yes,...I think that this is the problem...thanks

_NK47
11-17-2008, 05:13 AM
i personally hate GL_POLYGON. TRIANGLES are the way to go!