PDA

View Full Version : Problem with diffrent sizes of VBOs



christianmüller
05-31-2010, 05:14 AM
Hi,
I'm experimenting on OpenGL ES 1.1 with CUDA.
I want to implement a Coverflow. Therefore, I calculate the Positions of each Cover with CUDA and put them into a Vertex Buffer Object. In OpenGL ES, there are no QUADS, so i make them with 2 triangles and make indices for the vertices.
For every Cover, the tex coordinates and the indeces are the same (because 1 Cover ever are 2 triangles). So I think it must be enough to have the one big Buffer, with the vertices for the triangles and two small, for the texture and the indices. But how can i get this together. Is there a method to get an Offset, of the Big Buffer, like this?

for(int i = 0; i<=NUM_COVERS; i++)
{
glBindTexture(GL_TEXTURE_2D, loadTexture(i));

glBindBuffer(GL_ARRAY_BUFFER, buf[0]);
glTexCoordPointer(3, GL_FLOAT, 0, 0);

glBindBuffer(GL_ARRAY_BUFFER, buf[1]);
//How can I jump to any position in buf[1]? With an Offset?
glVertexPointer(3, GL_FLOAT, 0, OFFSET);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buf[2]);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);
}