I’m trying to do something that may be impossible…but here’s what I want to do:
I have an array of Vertices and TexCoords.
The array of vertices gets updated in a display list, so I need to make sure my VBO knows about the updated vertices before a call to glDrawArrays. Here’s some pseudocode:
struct Vert3D
{
GLdouble x,y,z;
}
struct TexCoord
{
GLdouble s,t;
}
Vert3D *pVerts = new Vert3D[vertex_count];
TexCoord *pTexCoords = new TexCoord[tx_count];
//init VBO stuff
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nTexCoords );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, 6sizeof(Vertex2D)iColumnsiRows,
pTexCoords, GL_STATIC_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVertices);
glBufferDataARB( GL_ARRAY_BUFFER_ARB, 6sizeof(Vertex2D)iColumnsiRows,
pVertices, GL_STATIC_DRAW_ARB );
//BeginDisplayList
for(int i=0; i < animationframes; i++)
{
dl = glGenLists(1)
glNewList(dl,GL_COMPILE)
…do stuff
…
//update elements in pVerts
…
…
//Do I need to somehow reset buffer data here?
//or reset pointers? (though that’s impossible in DLs)
glDrawArrays(GL_TRIANGLES,0,NumIndexes);
EndList();
}
I know I can’t use glVertexPointer and glTexCoordPointer in a Display List (DL).
If anyone’s done this sort of thing I would appreciate a few pointers, If it’s impossible, that’s cool too.
Thanks.
[This message has been edited by Aeluned (edited 03-02-2004).]