PDA

View Full Version : CVAs



TerranFury
09-02-2001, 02:30 PM
How can the same geometry be rendered multiple times using compiled vertex arrays? For example, if I have the following code (tell me if it is incorrect and my drivers are just being forgiving):




glVertexPointer (3, GL_FLOAT, 0, verts);
glTexCoordPointer(2, GL_FLOAT, 0, texs);
glColorPointer(4, GL_FLOAT, 0, cols0);

glBindTexture(GL_TEXTURE_2D, texture[0]);
glLockArraysEXT (0, view_x * 2);
for(unsigned int i = view_y - 2; i <= view_y - 2; i--)
{
glDrawElements (GL_TRIANGLE_STRIP, view_x * 2, GL_UNSIGNED_INT, &amp;strips[i]);
}
glUnlockArraysEXT();


How then can I bind a new texture, change the color pointer, and redraw the same geometry without re-transforming it?

Perhaps I don't understand CVA's well enough. I understand vertex arrays; that isn't a terribly difficult concept. Bu there are a few things about the compiled flavor that I don't get:
- When are they compiled?
- How are they called?

Because the image I have in my mind is of an EXECUTE_AT_ONCE display list, and I have a feeling that's not the right one.

zed
09-02-2001, 04:22 PM
personally compiled aint the best descriptioj for what they are. locked or transformed once would be better

the wway youre using them u prolly wont get any performance increase. try sonmething like this

glVertexPointer (3, GL_FLOAT, 0, verts);
glTexCoordPointer(2, GL_FLOAT, 0, texs);
glColorPointer(4, GL_FLOAT, 0, cols0);

glLockArraysEXT (0, view_x * 2);

loop (multiple passes )
{
glBindTexture(GL_TEXTURE_2D, texture[loop]);
glDrawElements (GL_TRIANGLE_STRIP, view_x * 2, GL_UNSIGNED_INT, &strips[i]);
} end loop

glUnlockArraysEXT();

btw i didnt check your syntax so it could be wrong also BTW
use GL_UNSIGNED_SHORT instead of unigned_int ( less data == better performance)

Aster
09-04-2001, 04:20 AM
Less data doesn't always mean better performance. Sometimes, memory alignment is a more important factor that affects processing speed.

zed
09-04-2001, 12:45 PM
true,true but in this case it does http://www.opengl.org/discussion_boards/ubb/biggrin.gif