Sign in to follow this  
spek

About glCallList...

Recommended Posts

Hi, A few questions about the glCallList command. I know it can boost the performance but... how exactly? VBO's put the vertex data on the videocard for faster access, but how does a display list help? Then I have a question about using it in combination with optional data. I have a mesh that is made of vertices, texcoords, normals and all other default stuff. So I could make a display list. But I also have a couple of array's that are not always used (tangents, weights, ...).
  glClientActiveTextureARB( x );
  glTexCoordPointer( 3, GL_FLOAT, SizeOf(TVector3f), someArrayOfData );
  ...
  glDrawArrays(GL_TRIANGLES, 0, vertexData.count );
I could do 3 things: a- Make multiple display lists; for each possible combination a list b- Just use all array's in a single list, even if they are not used for all situations c- If possible... First activate optional array's (if used), then call the list. I'm not sure if the list will use the array's that were activated externally though... b Is the lazy approach. But maybe the overhead won't be that much anyway. Greetings, Rick

Share this post


Link to post
Share on other sites
Quote:
Original post by spek
Hi,

A few questions about the glCallList command. I know it can boost the performance but... how exactly? VBO's put the vertex data on the videocard for faster access, but how does a display list help?

Then I have a question about using it in combination with optional data. I have a mesh that is made of vertices, texcoords, normals and all other default stuff. So I could make a display list. But I also have a couple of array's that are not always used (tangents, weights, ...).

glClientActiveTextureARB( x );
glTexCoordPointer( 3, GL_FLOAT, SizeOf(TVector3f), someArrayOfData );
...
glDrawArrays(GL_TRIANGLES, 0, vertexData.count );

I could do 3 things:
a- Make multiple display lists; for each possible combination a list
b- Just use all array's in a single list, even if they are not used for all situations
c- If possible... First activate optional array's (if used), then call the list. I'm not sure if the list will use the array's that were activated externally though...

b Is the lazy approach. But maybe the overhead won't be that much anyway.

Greetings,
Rick


I think VBO is faster than display list, when it said display list was faster i think it was compared to immediate mode : glBegin().. glVertex3f()..glEnd(), moreover displaylist are deprecated since openGL 3.0, so its recommended to use buffer object.

Share this post


Link to post
Share on other sites
Quote:
A few questions about the glCallList command. I know it can boost the performance but... how exactly? VBO's put the vertex data on the videocard for faster access, but how does a display list help?

The advantage of VBO as opposed to VA is that the driver knows specifically which part of the buffer you've updated between frames (or that you didn't update at all for static geometry), and subsequently can avoid re-transferring the data to GPU every frame. Display lists works the same way, the driver stores all the data you've passed into display list in memory, and since display lists can't be modified, it can store them in the GPU memory as well (however that is implementation dependant). For static geometry which you don't update at all, DLs will be most likely as fast as VBOs. For fully dynamic geometry where you change all the buffer content each frame, you will most likely get the same performance with VBOs and VAs.

Share this post


Link to post
Share on other sites
Ok, so display lists are put on the video card as well? In my case the mesh never changes, so I only have to make the list once. That leaves me with the other question about multiple variants of the same mesh. Due lots of different background rendering passes, I'll need the mesh many times but with different sets of additional vertex data.

Thanks for the tips!
Rick

Share this post


Link to post
Share on other sites
I might have an old OpenGL version (1.5 I think) or incomplete headers, but the problem with VBO's in my case is that I can't pick a format that supports all vertex array's I might need (vertices, 2xtexcoords, normals/tangents/biTangents, ambient vertex properties). In the worst case, I need them all in the same pass. It's a long time ago that I used VBO's, but I had to pick a packing format to tell OpenGL what data to expect and in which order.

If I understand the approach in your link properly, I could made sets of data? So for example,
set 1 = vertices, texcoords, normals
set 2 = tangents, biTangents, ambient props

Then if needed, call them both and they will get combined? Ifso, I guess a third set would be possible as well (texcoords and normals aren't necessary either in many cases).

Thanks for the help,
Rick

Share this post


Link to post
Share on other sites
Quote:
pick a format that supports all vertex array's

There are no formats to choose from. You invent your own and specify offets with those gl***Pointer functions.

Share this post


Link to post
Share on other sites
glInterleavedArrays( GL_C4UB_V3F, SizeOf(TVertex), null );
I was using this command and needed to define that format here. But it's way too long ago so I'd better learn VBO's again.

Since we're talking about VBO's anyway, I got another little question. When rendering textured/shaded, I have my (static) world mesh sorted on shader/material/texture. So I end up with small groups of data. For that reason I decided not to make VBO's or display lists of them. Instead, I just push all the vertex/normals/texcoords/.../ and then for each group I use glDrawElements to draw a section via its indices.

1.- apply vertices/texcoords/normals/whatever
2.- for each group
apply material
glDrawElements( indices that belong to this group )
unApply material
3.- unApply vertices/texcoords/normals/whatever

I was wondering though if this could be done smarter.

Thanks,
Rick

Share this post


Link to post
Share on other sites
glInterleavedArrays is deprecated.
Use glVertexPointer and the others or just use the generic form : glVertexAttribPointer

All the stuff is on the Wiki
http://www.opengl.org/wiki/General_OpenGL

Quote:
I was wondering though if this could be done smarter.


If everything is static, then just use a VBO with the GL_STATIC_DRAW flag.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this