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

Started by
4 comments, last by 3Dgonewild 16 years, 5 months ago
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]
Advertisement
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.

Previously "Krohm"

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.......!!!)
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.

Previously "Krohm"

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?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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.

This topic is closed to new replies.

Advertisement