A bug in Wiki-LWJGL tutorial?

Hi,

I’ve checked out the speedy VBO in
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/speedyvbo#interleaving_a_vbo

and I’ve notived that:


// texture coordinates offset = (3 + 3 + 2) * 4;
GL11.glTexCoordPointer(2, GL_FLOAT, stride, offset);

Looks a little bit strange… shouldn’t it be offset = (3 + 3 + 4) * 4 instead?

Anyway, i’ve solved my bug problems… it was all due to an unupdated driver of my laptop, and apperantly, now i DO have VBO supported… yey!

I wrote that tutorial, im glad it helped.

Lets regard each “component” as a unit. So the x component of the vertex is 1 unit. That means each vertex has 3 units, each normal has 3 units and 2d texture coordinates have 2 units (remember its just ST coordinates). Thats the reason behind the 3 + 3 + 2 offset. The * 4 is to change that to be in terms of bytes.

DP :slight_smile:

yes, i understand what the x4 means, but if u decided that the interleaved structure is like this:
V[xyz]N[xyz]C[rgba]T1[st]

then the offset for the starting of the texture should be (3+3+4)*4 and not (3+3+2)*4, since the color have rgba channels = 4 channel…, and it comes before the texture channels…

btw - i already implemented it, and its 3+3+4.
please check ur tutorial again (it really helped me, though !).

no, since the offset for vertices is 0 not 3

And Ive implemented the 3+3+2 successfully in a game engine a very long while back

DP

sorry, but i insist :slight_smile:

the structure should be
V[34byte]N[34byte]C[44byte]T1[2byte]

so if i need the texture (s,t) , i need to do :


intlvdarr[4*(3+3+4)+0] = texture_s;
intlvdarr[4*(3+3+4)+1] = texture_t;

the texture offset WOULD be 3+3+2 for the following structure:
V[34byte]N[34byte]T1[2byte]C[44byte]

please check it again :wink: thanks.

sorry, it would be 4*(3+3).

in any case it should not be (3+3+2) …