Hello,I’m trying to use this extension…mhh…but it doesn’t work correctly!!
Here’s my code:
//-------------------------------------------------------
// Indexes Buffer Allocation !!
for(int i=0 ; i< Scene.NObj ; i++)
{
Size = SINT*Scene.Obj.NVertex;
glBindBufferARB( ELEMENT_ARRAY_BUFFER_ARB, Scene.Obj[i].IBuffer);
glBufferDataARB( ELEMENT_ARRAY_BUFFER_ARB, Size, Scene.Obj[i].Triangle, GL_STATIC_DRAW_ARB);
}
Size = sizeof(_Vertex)*(Scene.NVertex);
glBindBufferARB( ARRAY_BUFFER_ARB, Scene.VBOBuffer);
glBufferDataARB( ARRAY_BUFFER_ARB, Size, Scene.VBuffer, GL_STATIC_DRAW_ARB);
//--------------------------------------------------------
glTexCoordPointer(2,GL_FLOAT,sizeof(_Vertex),&Scene.VBuffer[0].UV );
glNormalPointer(GL_FLOAT,sizeof(_Vertex),&Scene.VBuffer[0].Normal);
glVertexPointer(3,GL_FLOAT,sizeof(_Vertex),&Scene.VBuffer[0].Coord );
glColorPointer(4,GL_FLOAT,sizeof(_Vertex),&Scene.VBuffer[0].Color );
glEnableClientState ( GL_VERTEX_ARRAY );
glEnableClientState ( GL_NORMAL_ARRAY );
glEnableClientState ( GL_TEXTURE_COORD_ARRAY );
glDisableClientState( GL_COLOR_ARRAY );
//…and render…
glDrawArrays( GL_TRIANGLES, 0, O.NVertex );
All I can see It’s just a mixture o texture and triangle in random position.
If I render the same scene using standard Vertex Array (…commenting the first part of the code) all works correctly.
Standard vertex array:http://utenti.lycos.it/frenz1979/std.jpg
Same scene with buggy VBO:http://utenti.lycos.it/frenz1979/vbo.jpg
Some help?
Moreover…in the extension documentation a find the definition of the function “GenBuffersARB”…but there’s no example of it…is it useless!!!
Thanks to all!!