Hmm... you should try and set a breakpoint somewhere. Step through your code and pinpoint the exact location of the bug.
I could help you fix this, but i need you to get Online (MSN). :razz:
Hmm... you should try and set a breakpoint somewhere. Step through your code and pinpoint the exact location of the bug.
I could help you fix this, but i need you to get Online (MSN). :razz:
Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.
Could you paste your array declaration and code where pointers (both vertex and index buffers) are set to VBO.Originally Posted by Brainer
I'm online all the time, but I'm using an offline mode.Originally Posted by chronozphere
User137, I'm not sure what you mean, I'm posting this:
[pascal]
{ TBVertexBufforOGL }
{ .: BUsageToOGLUsage :. }
function BUsageToOGLUsage(const Usage: TBUsage): GLuint; inline;
begin
case Usage of
BUSAGE_RENDERTARGET: Result := GL_STATIC_DRAW_ARB;
BUSAGE_DYNAMIC: Result := GL_DYNAMIC_DRAW_ARB;
BUSAGE_WRITEONLY: Result := GL_WRITE_ONLY_ARB;
end;
end;
procedure TBVertexBufforOGL.CreateVertexBuffor(Size, SizeVertex: Integer;
FVF: DWORD; Pool: TBPOOL; Usage: TBUsage);
begin
glGenBuffersARB(1, @VBuffor);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBuffor);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, Size * SizeVertex, nil,
BUsageToOGLUsage(Usage));
FSizeVertex := SizeVertex;
end;
destructor TBVertexBufforOGL.Destroy;
begin
UnInit();
inherited Destroy();
end;
function BUFFER_OFFSET(I: Cardinal): Pointer;
var
Ptr: Pointer absolute I;
begin
Result := Ptr;
end;
function TBVertexBufforOGL.Lock(Start, Count: DWORD): Pointer;
begin
Result := glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB);
end;
procedure TBVertexBufforOGL.Render(Typ: TBShapetype; Count: DWORD);
var
TheType: GLuint;
begin
glEnableClientState(GL_VERTEX_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBuffor);
case Typ of
BPOINTLIST: TheType := GL_POINTS;
BLINELIST: TheType := GL_LINES;
BLINESTRIP: TheType := GL_LINE_STRIP;
BTRIANGLELIST: TheType := GL_TRIANGLES;
BTRIANGLESTRIP: TheType := GL_TRIANGLE_STRIP;
BTRIANGLEFAN: TheType := GL_TRIANGLE_FAN;
end;
glDrawArrays(TheType, 0, Count);
glDisableClientState(GL_VERTEX_ARRAY);
end;
procedure TBVertexBufforOGL.UnInit;
begin
glDeleteBuffersARB(1, @VBuffor);
end;
procedure TBVertexBufforOGL.UnLock;
begin
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
end;
[/pascal]
Bookmarks