View Full Version : VBOs and Display Lists

03-02-2004, 10:14 AM
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
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nTexCoords );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, 6*sizeof(Vertex2D)*iColumns*iRows,
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVertices);
glBufferDataARB( GL_ARRAY_BUFFER_ARB, 6*sizeof(Vertex2D)*iColumns*iRows,
pVertices, GL_STATIC_DRAW_ARB );

for(int i=0; i < animationframes; i++)
dl = glGenLists(1)
...do stuff
//update elements in pVerts
//Do I need to somehow reset buffer data here?
//or reset pointers? (though that's impossible in DLs)

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.


[This message has been edited by Aeluned (edited 03-02-2004).]

03-02-2004, 03:24 PM
I am not 100% sure. But I think that is not valid.. since the client server aproach of vertex arrays and VBO seems to be incompatible with DL concept. But don't have the blue book here to check it.

03-03-2004, 02:33 AM
Of course you can issue gl*Pointer inside the glNewList-glEndList, but they are just execute in immediate mode, and a display list compile will fetch all necessary data from the specified arrays and store it inside the display list when the _drawing command_ is _compiled_, not when it is executed by a glCallList.
That is, gl*Pointers have no other effect on that display list anymore.
And building display lists from VBOs should work, they are just another name for vertex arrays.
Be careful, reading VBO data into a display list could be slow, depending on buffer type (STATIC, STREAM, etc.).
If it's just about display list building, use standard vertex arrays.

[This message has been edited by Relic (edited 03-03-2004).]

03-03-2004, 08:47 AM
Yes, it should work, but it's just pointless to compile a display list from a VBO.