Multitexturing with vertex buffer object

Started by
1 comment, last by nhatkthanh 15 years, 8 months ago
Hi, I'm trying to do multi texture with vbo, but I ran into this and I'm not sure how to go about it. let say my vertex is: struct Vertex { float x, y, z; DWORD specularColor; float nx, ny, nz; float tu, tv; float tu2, tv2; }; the problem comes when I need to specify the array pointers as well as enable/disable clientstate. glVertexPointer(3, GL_FLOAT, stride, BUFFER_OFFSET(0)); glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, stride, BUFFER_OFFSET(12)); glNormalPointer(GL_FLOAT, stride, BUFFER_OFFSET(16)); glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(28)); then I'm not sure how to specify for the last set of texture coordinate. The same goes for enable client state: glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); I'm just not sure what I need to set for the last set of texture coordinate. Appreciate any help and info on this. Thanks.
Advertisement
http://www.opengl.org/wiki/index.php/GL_ARB_vertex_buffer_object#Sample_Code
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Great, that is what I'm looking for, thank you.

This topic is closed to new replies.

Advertisement