Sign in to follow this  
3Dgonewild

(VBO ) or (Display Lists + vertex arrays) +texture coordinates

Recommended Posts

3Dgonewild    174
Which way should i follow? Right now im using Display Lists only, and im looking for a way to improve the overall performance!. After a long search on google , i found out that i can combine DL with vertex arrays , or , should i store texture data into an VBO, and then i can simply call my vertex array?. Another question. How should i store texture coordinates? Right now my code looks like this:
glgenlists
glnewlist(blah..,compile)
glenable glblend
glbegin glquads
texture coords2f
vertex data2f
etc..
glend
disable blending
disable gl_texture_2d
glloadidentity
glendlist



Oops i almost forgot an important information...im making a 2d side scroller game(like mario games)... [Edited by - 3Dgonewild on November 23, 2007 11:50:47 AM]

Share this post


Link to post
Share on other sites
Krohm    5030
Quote:
Original post by 3Dgonewild
Right now im using Display Lists only, and im looking for a way to improve the overall performance!
Use VBO. Don't expect a performance improvement from that however: static VBO is only marginally faster than DL and this happens for a reason. For dynamic data VBOs are way better.

Do I read the snippet correctly? Are you really compiling a DL per-frame (I see that near Enable(BLEND))?
If you're doing this, you shouldn't. Generating DL such as all Gen calls are extremely heavyweight and should be used with special care, typically at loading only.

Share this post


Link to post
Share on other sites
3Dgonewild    174
Quote:
Original post by Krohm
Quote:
Original post by 3Dgonewild
Right now im using Display Lists only, and im looking for a way to improve the overall performance!
Use VBO. Don't expect a performance improvement from that however: static VBO is only marginally faster than DL and this happens for a reason. For dynamic data VBOs are way better.


Alright then , i'll chose vbo!.

Quote:
Original post by Krohm
Do I read the snippet correctly? Are you really compiling a DL per-frame (I see that near Enable(BLEND))?
If you're doing this, you shouldn't. Generating DL such as all Gen calls are extremely heavyweight and should be used with special care, typically at loading only.


Well , no.
I compile the lists on start up , just like this (i've just added vertex arrays btw):


void ComplileList()
{
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

GL_Compiled_List = glGenLists(1);
glNewList(GL_Compiled_List, GL_COMPILE);
glEnable( GL_BLEND );
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT,0,TexturePack);
glColorPointer(3,GL_FLOAT,0,ColorPack);
glVertexPointer(2, GL_FLOAT, 0, ObjectA);
glPushMatrix();
glDrawArrays(GL_QUADS, 0, 4);
glPopMatrix();
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glDisable( GL_BLEND );
glEndList();
}



And then , i call the list like this(in the main loop):

calllist( my list);



On sdl_quit event:

deletelists (..);



(don't tell me that DL doesn't call the additional functions T_T.......!!!)

Share this post


Link to post
Share on other sites
Krohm    5030
Quote:
Original post by 3Dgonewild
Well , no.
Ok. I apologize, but sometimes it's better to make sure stuff like this.
Quote:
Original post by 3Dgonewild
(don't tell me that DL doesn't call the additional functions T_T.......!!!)
I'm not sure I get it but DLs doesn't capture some state such as *ClientState or other. Generally this isn't a problem but it's always a good idea to check the specs.

Share this post


Link to post
Share on other sites
V-man    813
Changing to VBO will likely give you zero performance increase as DL are suppose to be well optimized by the driver. Try using gDebugger. It can help you determine where your bottleneck is.
I would avoid glColorPointer(3,GL_FLOAT,0,ColorPack);
Try glColorPointer(4,GL_FLOAT,0,ColorPack);
or
glColorPointer(4,GL_UNSIGNED_BYTE,0,ColorPack);

What's your FPS right now and what hw?

Share this post


Link to post
Share on other sites
3Dgonewild    174
Quote:

Changing to VBO will likely give you zero performance increase as DL are suppose to be well optimized by the driver.

Oh i see , well , i will have to do it just for the experience..




Quote:

I would avoid glColorPointer(3,GL_FLOAT,0,ColorPack);
Try glColorPointer(4,GL_FLOAT,0,ColorPack);
or
glColorPointer(4,GL_UNSIGNED_BYTE,0,ColorPack);

--Done :)!

Quote:

What's your FPS right now and what hw?


PC#1: GF 8800GTS , 2GB RAM , CD6600. FPS: around 900..
PC#2: P4 2.4GHZ , 256 RAM , Radeon9250. FPS: 264.
On my old laptop it runs at 54fps ...but it has a crappy on board gfx card.

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