I cant figure out the stride and offset for my VBO. I have been trying for a very long time so please dont reply saying its better you figure it out your self or stuff like that..
My VBO contains the following:
per 1 face (one quad) {
3 floats - normal
3 floats - vertex
3 floats - color
3 floats - vertex
3 floats - color
3 floats - vertex
3 floats - color
3 floats - vertex
3 floats - color
}
Then there is 6 faces per cube and there are a lot of cubes.
my question is what would be the stride and offset when you have 1 normal per 24 elements
glNormalPointer(GL_FLOAT, /* stride **/? << 2, /* offset **/0 << 2);
glVertexPointer(3, GL_FLOAT, /* stride **/? << 2, /* offset **/3 << 2);
glColorPointer(3, GL_FLOAT, /* stride **/? << 2, /* offset **/6 << 2);
I'm pretty sure you can't do that. You need to have one normal per vertex/color. Thus your stride for everything should be 12 bytes (3 floats * 4 bytes).
Thanks.