System: Windows Vista, AMD 64 X2 Dual Core 2.7 Ghz, ATI Radeon 2600 PRO HD
Compiler/IDE: Delphi 2009 for Win32
API: OpenGL
Hello,
I am trying to optimize my code since it seems to be rather slow. I am drawing 10.000 lines and I heard that the usage of a VBO would be drastically faster. But I have some problems with it. So maybe someone could help me since I can't find good examples/tutorials. Maybe someone can help me with my little example. I try to draw 2 lines:
(0,0) - (100,100) and (0,100) - (100,0).
This is what I have so far:
Code:
var:
arrLines: array[4] of array [2] of GLFloat;
FVBO: GLUInt;
begin
glGenBuffers(1, @FVBO);
glBindBufferARB(GL_ARRAY_BUFFER, FVBO);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, ); // What should be here?
//Initialize array:
arrlines[0][0] := 0;
arrlines[0][1] := 0;
arrlines[1][0] := 100;
arrlines[1][1] := 100;
arrlines[2][0] := 0;
arrlines[2][1] := 100;
arrlines[3][0] := 100;
arrlines[3][1] := 0;
//Draw the lines
glDrawElements(GL_LINES, 2*4 , GL_FLOAT, arrLines); //Is this correct?
glDisableClientState(GL_VERTEX_ARRAY);
Please help and thanks in advance
Bookmarks