Original Post
I implemented VBO in my Engine. But when i draw them they look very weird. Here is a Screen:
This is the generation of the VBO
This is the generation of the VBO
// Generate And Bind The Vertex Buffer
Graphics::CGLExtManager::glGenBuffers(1, &mesh->VBOIDv);
Graphics::CGLExtManager::glBindBuffer(GL_ARRAY_BUFFER, mesh->VBOIDv);
Graphics::CGLExtManager::glBufferData(GL_ARRAY_BUFFER, mesh->getVertexCount()*sizeof(Graphics::SVertex), mesh->getVertices()[0].position, GL_STATIC_DRAW);
// Generate And Bind The Texture Coordinate Buffer
Graphics::CGLExtManager::glGenBuffers(1, &mesh->VBOIDt);
Graphics::CGLExtManager::glBindBuffer(GL_ARRAY_BUFFER, mesh->VBOIDt);
Graphics::CGLExtManager::glBufferData(GL_ARRAY_BUFFER, mesh->getVertexCount()*sizeof(Graphics::SVertex), mesh->getVertices()[0].uv, GL_STATIC_DRAW);
And so i am drawing them:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
CGLExtManager::glBindBuffer(GL_ARRAY_BUFFER, entity->rendermesh->VBOIDv);
glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL );
CGLExtManager::glBindBuffer(GL_ARRAY_BUFFER, entity->rendermesh->VBOIDt);
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL );
glDrawArrays(GL_TRIANGLES, 0, entity->rendermesh->getVertexCount());
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
Can anyone help?