Today I came across a problem while displaying two separate quad’s with GL_TRIANGLE_STRIP. The problem was, when using strip it will take previous given two indices and attach with the new vertex and make a triangle strip.Actually this is NOT what I wanted.
Suppose there are (1,2,3,4) (5,6,7,8) Quads which can be made by a GL_TRIANGLE_STRIP call. Now if i give this data as a batch,I will have 3,4,’5’ and ‘4’,’5’,6 connected Triangle Strips as well! :O
So to solve this issue, I came to know we need to use “Zero Area Sized Triangle strips” which will be usually ignored/discarded by Graphic cards as they mean they are EMPTY areas which are not necessary to draw. These ”Zero Area Sized Triangle strips” are called “Degenerate Triangles“.These can be created by duplicating the vertex data.
So, 1,2,3,4,4,5,5,6,7,8 vertex data will yield the intended!
Here the Degenerate Triangles are (3,4,4) , (4,4,5) ,(4,5,5) , (5,5,6)
Even though we are duplicating the data a bit …it will be flushed in one single call with Triangle Strips! Nice right (^_^)
For further Reference:
http://stackoverflow.com/questions/487244/opengl-efficient-way-to-render-a-batch-of-geometry