hugo4711
01-30-2004, 10:31 AM
I have several different objects in my scene and would like to render them as vertex arrays. Since I use different arrays for different objects I have to do this for each object in every frame:
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0,vertex_array);
glNormalPointer(GL_FLOAT, 0, normal_array);
glTexCoordPointer(2, GL_FLOAT, 0,texcoords_array);
glDrawArrays(GL_TRIANGLES, 0,num_verticies);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
I would guess that this is very inefficient but have no other idea how to do this, because I have to switch the pointers to the different arrays...
Is there a better way to do this when using multiple vertex arrays?
Thank you in advance
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0,vertex_array);
glNormalPointer(GL_FLOAT, 0, normal_array);
glTexCoordPointer(2, GL_FLOAT, 0,texcoords_array);
glDrawArrays(GL_TRIANGLES, 0,num_verticies);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
I would guess that this is very inefficient but have no other idea how to do this, because I have to switch the pointers to the different arrays...
Is there a better way to do this when using multiple vertex arrays?
Thank you in advance