What can cause glDrawArrays with VBO to draw nothing?

I am trying to figure out how to work with VBOs using the OpenGL 2.0 rendering context. I have 2D spelling set up and I can draw a simple rectangle like this:

glBegin(GL_QUADS);
   glColor4f(1, 1, 1, 1);
   glVertex2f(0, 0);
   glVertex2f(0, 10);
   glVertex2f(100, 10);
   glVertex2f(100, 0);
glEnd;

But when I try to do this with VBO, it fails. I created a VBO like this with the same data as before:

procedure initialize;
const
   VERTICES: array[1..8] of single =
   (
   0, 0,
   0, 10,
   100, 10,
   100, 0
   );
begin
   glEnable(GL_VERTEX_ARRAY);
   glGenBuffers(1, @VBO);
   glBindBuffer(GL_ARRAY_BUFFER, VBO);
   glBufferData(GL_ARRAY_BUFFER, sizeof(VERTICES), @VERTICES[1], GL_DYNAMIC_DRAW);
   glBindBuffer(GL_ARRAY_BUFFER, 0);
end;

and I am trying to do the following:

begin
   glColor4f(1, 1, 1, 1);
   glEnableClientState(GL_VERTEX_ARRAY);
   glBindBuffer(GL_ARRAY_BUFFER, VBO);
   glVertexPointer(2, GL_FLOAT, 0, 0);
   glDrawArrays(GL_QUADS, 0, 1);
   glBindBuffer(GL_ARRAY_BUFFER, 0);
end;

, , . gDEBugger, GL, VBO , , . ( 0..1.0) . , ? (, , GL .)

+5
1

glDrawArrays(GL_QUADS, 0, 1);

, . :

glDrawArrays(GL_QUADS, 0, 4);

:

glDrawArrays(GL_POINTS, 0, 1);
+6

All Articles