Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rendering multiple vertex arrays

Started by Uberapan Jul 20, 2003 at 6:12 AM 0 replies 350+ views
Original Post
Uberapan
Uberapan
I have one vertex array for each movable object in my world. I''m pondering on how you go about transforming them, since each object is in object space, and not world space. As it is now, I do: for_each(object) { Translate(objectorigin) SetUpVertexNormalTCPointersForThisArray() glDrawElements() UnTranslate(objectorigin) } It just seems a bit inefficient to do this 50+ times each frame. Is there a better way to do it, perhaps? Or am I off completely? (Wouldn''t be the first time ) And also, is it best to have one array for each object, or fit it all into one large array and use offsets instead? Are the pointer setup operations expensive? Thanks!
Yann L
Yann L

Setup the vertex/texcoord/etc pointers to the reference object

for( each instance of the object ) {
glPushMatrix()
glMultMatrixf( objectspace to worldspace matrix for this instance )
glDrawElements( ... )
glPopMatrix()
}


quote:

And also, is it best to have one array for each object, or fit it all into one large array and use offsets instead? Are the pointer setup operations expensive?


Depends on how many faces and vertices your objects have.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.