PDA

View Full Version : glDrawElements + display list issue



nystep
07-24-2004, 09:29 AM
Hi,

I'm trying to compile a set of drawelements call in a display list. According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc01_1kz7.asp
It should be possible to include it in the display list. I don't get any error at display list compilation or display list call with glGetError, and my drawelements code works perfectly out of my display list. However, nothing appears on the screen when the display list is called.

I'm using a radeon 9600, under win2k with catalyst 4.6.

Here is the code:


primitives = glGenLists( 1 );
glNewList( primitives, GL_COMPILE );

for (j=0; j<n_vertex-1; j++)
{
vstream->DrawElements( RDR_PRIMITIVE_TRIANGLE_STRIP, n_vertex*2, indices+(j*2*n_vertex) );
}

glEndList();
int error = glGetError(); // returns 0
vstream->BindBuffers();
#if 1
/* nothing appears on screen here */
glCallList( primitives );
int error = glGetError(); // returns 0
#else
/* works perfectly */
for (j=0; j<n_vertex-1; j++)
{
vstream->DrawElements( RDR_PRIMITIVE_TRIANGLE_STRIP, n_vertex*2, indices+(j*2*n_vertex) );
}
#endif
vstream->UnBindBuffers();

CrazyButcher
07-24-2004, 09:55 AM
do the bind/unbind buffer stuff when you compile the list, so that binds are done within the list.
and dont do them when you call the list.

nystep
07-24-2004, 11:05 AM
the bind / unbind stuff binds a VBO and setups the vertex array. these are client-state settings, and according to the spec it can't be included in the display list.

or did you mean just the glBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferID ); ?
it has to be done before vertex array setup as far as i remenber.

nystep
07-24-2004, 11:13 AM
Ok, i got the point. now i'm biding the buffers before compiling the display list, but it still doesn't works. :(

CrazyButcher
07-25-2004, 01:17 AM
bind them within the list
however I think it really makes not much sense to use a display list with vbos, cause vbo alone will be just as quick.
lists were good for normal VA and before there was VBO, but if you have a vbo with static_draw it is practically as fast as display list from what I know.

nystep
07-25-2004, 01:48 AM
I'm not using a VBO for index data however, i'm just aiming at reducing the number of calls to gl, since i'm doing a lot of batch calls for few primitives.