PDA

View Full Version : Issues with culling and triangle strips



Hurzelchen
03-26-2009, 10:40 AM
Hi all,

my first post here so please be gentle if did something stupid ;)

I'm trying to switch the rendering of a tube from using triangles to using triangle strips. Everything looks fine (shading, different materials for front/back faces)... but the culling isn't working. Independent of the current faces to be culled, all faces get rendered.

Does anybody has an idea what I missed here?

Thanks,

Hurzelchen

Groovounet
03-26-2009, 11:00 AM
glEnable(GL_CULL_FACE) missing?

Also you will better use indexed array (array buffer + element buffer) instead of triangle strip. It's more efficient in general, less vertex duplication, possible better vertex caching.

Hurzelchen
03-26-2009, 11:11 AM
glEnable(GL_CULL_FACE) missing?

Then it wouldn't work when using triangles... As I said I only changed the rendering from using GL_TRIANGLES to GL_TRIANGLE_STRIP (and the corresponding vertex calls).

ZbuffeR
03-26-2009, 01:06 PM
Then it means you did not converted correctly the vertex order.
So some of your triangles are CW instead of CCW and get culled when visible.

Hurzelchen
03-26-2009, 01:54 PM
Ouch... found my mistake... Called glBegin(GL_TRIANGLE_STRIP) and glEnd() only once instead of calling it for every strip...

Thanks for making me think again ;)

Now i just have to find the reason why my normals are calculated that strange... but that's another story...

Jacques LIAO
03-26-2009, 04:03 PM
if you have several substrips, you can use GL_NV_primitive_restart extension. By the way, it looks that this extension is specially mentioned in 3.1 spec.