LWJGL Forum

Programming => OpenGL => Topic started by: gopgop on June 21, 2013, 11:09:46

Title: Stride And Offset for a VBO that contains Normals Vertecies and Colors
Post by: gopgop on June 21, 2013, 11:09:46
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);
            
Title: Re: Stride And Offset for a VBO that contains Normals Vertecies and Colors
Post by: Fool Running on June 21, 2013, 12:51:40
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).
Title: Re: Stride And Offset for a VBO that contains Normals Vertecies and Colors
Post by: gopgop on June 21, 2013, 14:37:30
Thanks.