struct Vertex { float x, y; // Vert point float tx, ty; // Texture point};
I create an array of these to represent a quad:
Vertex verts[] = {{0,0,0.5f,0}, {32,0,1,0}, {32,32,1,0.5f}, {0,32,0.5f,0.5f}};
Then to draw the the square using VBOs in openGL they require these two method calls:
glVertexPointer(2, GL_FLOAT, sizeof(Vertex), 0); glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), (char*)8);
My question is what is (char*)8 doing exactly? I know that in my struct, each float is 4 bytes. So to point the gpu to the location of each texture coordinate I have to tell it to look 8 bytes into the buffer to get the texture coordinates. That is basically what is happening right? Is it creating a pointer to 8 bytes so it knows how far to jump?