PDA

View Full Version : glEnable(GL_CULL_FACE); and TRIANGLE_STRIP



jerryyyyy
12-30-2002, 06:41 AM
I am having a problem with hidden surface removal using glEnable(GL_CULL_FACE) for TRIANGLE_STRIPS. In the manual I read that the STRIPS will be written in the counterclockwise manner so that hidden surfaces are enabled (automatically), but when I draw a bunch of hills using triangles for flight simulation I only get half of them to be culled right. Is this automatic drawing feature not implemented in OpenGL????

HamsterofDeath
12-30-2002, 09:00 AM
the first 3 points are the first triangle.
draw them counter clockwise. the next point will be combined !with the last 2 ones!. the triangle will be drawn correctly (counter clockwise), because the opengl-programmers are smart^^

mdog1234
12-30-2002, 09:16 AM
who dont you try glEnable(GL_DEPTH_TEST) and then use glClear(GL_DEPTH_BUFFER_BIT)

Deiussum
12-30-2002, 12:39 PM
The winding order of triangle strips goes something like this. Assume you have a strip that looks like so:




1---3---5
| / | / |
2---4---6


Doing a triangle strip with
1,2,3,4,5,6

Is equiavlent to doing individual triangles like so:
1,2,3
3,2,4
3,4,5
5,4,6

Notice how the vertices get flipped around? That is so that they can easily all keep the same winding order

jerryyyyy
12-30-2002, 04:04 PM
Originally posted by mdog1234:
who dont you try glEnable(GL_DEPTH_TEST) and then use glClear(GL_DEPTH_BUFFER_BIT)

I have tried this but I get a screen in which all the objects are distored. I think I am unclear where to put the glClear(GL_DEPTH_BUFFER_BIT)and if it needs to be cleared before every swapbuffers.