Hi everybody, let me get straight to the point. I've got some code from somewhere to build and use a VBO, but it's not working at all. I'm pretty sure a more experienced person would see whats wrong with this in an instance. It all compiles without errors or warnings. So let me show you my code:
I'm loading in a heightmap and parse the vertex, uv and normal buffer I generate to this function. This is called once after I created the heightmap.
Code :unsigned int GraphicsManager::createVBO(int size, Vector3* mVertexBuffer, Vector3* mNormalBuffer, Vector2* mUvBuffer) { unsigned int id = mGraphicsManagerPimpl.mVboDictionary.size(); VboIdCollection* ids = new VboIdCollection(); ids->size = size; glGenBuffersARB( 1, &ids->vId ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->vId ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, size*3*sizeof(float), mVertexBuffer, GL_STATIC_DRAW_ARB ); glGenBuffersARB( 1, &ids->nId ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->nId ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, size*3*sizeof(float), mNormalBuffer, GL_STATIC_DRAW_ARB ); glGenBuffersARB( 1, &ids->uvId ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->uvId ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, size*2*sizeof(float), mUvBuffer, GL_STATIC_DRAW_ARB ); mGraphicsManagerPimpl.mVboDictionary.insert(std::make_pair(id, ids)); return id; }
And here's the code I call every frame when I want to display the VBO.
Code :void GraphicsManager::drawVBO(unsigned int id) { vboIdcollection* ids = mGraphicsManagerPimpl.mVboDictionary.find(id)->second; glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->vId ); glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->nId ); glNormalPointer( GL_FLOAT, 0, (char *) NULL ); glBindBufferARB( GL_ARRAY_BUFFER_ARB, ids->uvId ); glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); glDrawArrays( GL_TRIANGLES, 0, ids->size ); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); glDisableClientState( GL_NORMAL_ARRAY ); }
I would really appreciate the help.



. My FPS just quadrupled. succes \o/ Thanks alot.
