CULLING doesn't work always

hi !

i am rendering different objects, each of them consisting of many polygons (in fact the polygons are only triangles, defined by GL_POLYGON).

now i want to cull back-face-polygons, an it does work, but only for the first object !
if i render one of the other objects with backface-culling enabled, it displays also the backface polygons !

the same happens if i want to render the front-face-polygons with GL_FILL and the back-face-polygons with GL_POINT - it works correct for the first object, but not for the other polygons.

any idea what’s wrong ?

Hannes

First, if all your polygons are triangles it’s much faster to use the GL_TRIANGLES primitive which can batch all these vertices together, whereas you need to call glBegin-glEnd for each GL_POLYGON primitive now.

OpenGL is a state machine. If you have set any of the culling or polygon mode features once, as seems to be true for the first object which works, you must have reset it to something different for the other objects.

Check your code for all occurances of glCullFace, glFrontFace, glEnable, glDisable, glPushAttrib, glPopAttrib, or different OpenGL contexts. Any of these could have an effect on culling.
Same for glPolygonMode and different contexts.

Oh, and make sure you have depth testing enabled and the depth buffer cleared, in case this only looks like culling is not working.

[This message has been edited by Relic (edited 07-14-2003).]