PDA

View Full Version : vertex buffer object and Display list



DungeonLords
11-12-2009, 01:32 PM
Hi all,

I use Display list in my first project and I use vertex buffer object in my second project. DL shows better FPS than VBO, why? And second question, is GeForce 8XXX generates indexex for for repeating points in VBO geometry?

P.S. Sorry if my problem has been discussed, I bad speak english.

DmitryM
11-12-2009, 01:51 PM
1. Well, if you don't draw much data, but rather frequently change OpenGL state, then DL might be faster.
Anyway, comparing these draw methods is as old as world.
Use VBO for drawing geometry and DL for anything else you like.

2. The driver will _not_ go through all attributes and compare them to create index buffer internally.

V-man
11-12-2009, 05:58 PM
There could be several reasons:
VBO state change can be expensive. If you have 10,000 VBOs and each is for rendering a few quads, then rendering all those will be slow. Make 1 big VBO for all.
Perhaps DL are slow if used in this fashion as well.

Using certain formats like double or byte for vertices or what have you can force the driver to convert the data live, every time you render with your VBO.
For DL, it would be faster in this case.

You can read about VBOs here
http://www.opengl.org/wiki/General_OpenGL

and more stuff here
http://www.opengl.org/wiki/Common_Mistakes#Unsupported_formats_.231

Fugitive
11-13-2009, 04:28 AM
I've noticed that for extremely large data sets, creating a display-list with immediate mode rendering (glBegin, glEnd) is much slower than VBOs if you have a newer card (tested on the ATI Radeon 4870x2), but faster than VBOs if you have an older card (ATI radeon x1950).

DungeonLords
11-13-2009, 05:34 AM
I think the reason is something else. Maybe I bad told about my VBO project?

This is a Delphi code:
var vertexBuffer:GLInt;

type
Vertex=array[0..1] of GLFloat;

var
Vertexes:array of Vertex;

Procedure VBOInit;
begin
glGenBuffers(1, @vertexBuffer);

glBindBuffer( GL_ARRAY_BUFFER, vertexBuffer);
glBufferData( GL_ARRAY_BUFFER, sizeof(GLFloat)*(high(Vertexes)+1), @Vertexes[0], GL_STATIC_DRAW );
glVertexPointer( 2, GL_FLOAT, 0, nil);
glBindBuffer( GL_ARRAY_BUFFER, vertexBuffer);
end;

procedure TForm1.GLDirectOpenGLRender(Sender: TObject;
var rci: TRenderContextInfo);
begin
glEnableClientState( GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
glVertexPointer( 2, GL_FLOAT, 0, nil);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_VERTEX_ARRAY);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
setlength(Vertexes,6*2);
Vertexes[0][0]:=-1; Vertexes[0][1]:=-1;
Vertexes[1][0]:=1; Vertexes[1][1]:=-1;
Vertexes[2][0]:=1; Vertexes[2][1]:= 1;
Vertexes[3][0]:=1; Vertexes[3][1]:= 1;
Vertexes[4][0]:=-1; Vertexes[4][1]:= 1;
Vertexes[5][0]:=-1; Vertexes[5][1]:=-1;

VBOInit;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
glDeleteBuffers(1,@vertexBuffer);
end;

Procedure TForm1.FormCreate use once in project start. Procedure GLDirectOpenGLRender use for rending two triangles. I use GLScene (www.glscene.org (http://www.glscene.org)), but in this project I almost (http://translate.google.ru/translate_t?prev=hp&hl=ru&js=y&text=%D1%80%D0%B0%D 1%81%D1%81%D0%BA%D0%B0%D0%B7%D0%B0%D0%BB&file=&sl= ru&tl=en&history_state0=#ru|en|%D0%BF%D0%BE%D1%87% D1%82%D0%B8) do not it's functional.

My project with DL use GLScene only because it do not know about VBO =) and use older display list. if necessary I can show this source code.

"2. The driver will _not_ go through all attributes and compare them to create index buffer internally."
Sorry, I do not understand, fps would be better if I created indexes for VBO?

Thanks for your answers!!!

DmitryM
11-13-2009, 07:39 AM
As long as you draw 2 triangles there is no sense of arguing about speed :)
First, make a scene with 100k triangles - the difference between DL and VBO will become obvious.
Next, use indices (in case your geometry is smooth) and see how caching vertex data helps the performance.

DungeonLords
11-13-2009, 02:05 PM
Next, use indices (in case your geometry is smooth) and see how caching vertex data helps the performance.
I written:"is GeForce 8XXX generates indexex for for repeating points in VBO geometry?" because in my GeForce 8800 GT with indexes 4446 fps and without indices 4446 fps!

DmitryM
11-13-2009, 02:27 PM
Again, there is no point of measuring speed difference if you have more than 1000 fps. Try more complex data.

Dark Photon
11-16-2009, 07:55 PM
...because in my GeForce 8800 GT with indexes 4446 fps and without indices 4446 fps!
Read this: Performance (Humus) (http://www.humus.name/index.php?ID=279) and The evils of fps (RTR blog) (http://www.realtimerendering.com/blog/the-evils-of-fps/)