View Full Version : Re-ordering triangle strips
08-11-2001, 09:53 AM
I asked this question a while ago, but it sort of got buried at the bottom of a thread and was never resolved. Hopefully no one will mind starting a new thread for it.
I'm trying to speed up my project by using triangle strips instead of a series of GL_TRIANGLES, but I've been staying away from strips because they introduce a weird sort of asymmetry to the look of things. The triangle ordering from my LOD engine attempts to fix that problem by alternating which opposing pair of vertices in a quad become an edge. Hence, a strip generated by my system would look like |/|\|/|\| wheras an OpenGL triangle strip looks like |\|\|\|\|. Is there any way to accomodate this, or am I resigned to working with individual triangles?
08-11-2001, 12:07 PM
You are forced to the order. However, I believe it would be effective even without strips, since the vertices are sorted and the driver is able to cache the vertices. Try to use arrays for that.
it is possible with strips to do that by drawing a lot of denerant triangles, but half or more of the triangles u draw will actually not be seen. not exactlly the way to get the fastest perfromance
08-12-2001, 04:22 AM
yes, his order would then have a constant overhead, not just occasionally.
08-12-2001, 06:45 AM
Thanks for the insight! Sometimes I wonder why OpenGL doesn't have some kind of large surface or trigrid primitives. They would be even faster than decomposing to triangle strips because there would be no shared vertices at all if we sent OpenGL an entire mesh at once.
08-12-2001, 07:47 AM
Do you mean something like indexed arrays? I couldn't imagine another way.
the fastest way to send standard stuff that doesnt share vertices is to use glDrawArrays(..)
08-12-2001, 07:14 PM
Interesting, interesting... Do I have to hard-code the size of the arrays, or can I allocate memory during runtime? Could I set up the arrays with something like:
vertArray = new float[3*numVertices];
I did a quick search for examples, and all of them used fixed-size arrays, but that isn't general enough.
Also, how inefficient would it be to fill the array with new data for each frame (but not between passes)?
08-12-2001, 07:16 PM
You can use dynamic arrays as well. OpenGL takes a pointer to the buffer and the number and type of elements.
09-11-2003, 02:48 AM
I am newbie, how can I use glDrawArrays(..) to improve my drawing function that uses triangles strips primitives?
Thanks in advance
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.