View Full Version : Mulitexturing wiht Vertex Arrays

07-26-2000, 09:45 AM
Here is the code I think I'm goofing up.

for(int z=0; z<bsp_numverts; ++z)
vertexArray[z*3+0] = bsp_verts[z].v_point.x;
vertexArray[z*3+1] = bsp_verts[z].v_point.y;
vertexArray[z*3+2] = bsp_verts[z].v_point.z;

texArray[z*2+0] = bsp_verts[z].tex_st.u;
texArray[z*2+1] = bsp_verts[z].tex_st.v;

texArray2[z*2+0] = bsp_verts[z].lm_st.u;
texArray2[z*2+1] = bsp_verts[z].lm_st.v;

glVertexPointer(3, GL_FLOAT, 0, vertexArray);
glTexCoordPointer(2, GL_FLOAT, 0, texArray);
glTexCoordPointer(2, GL_FLOAT, 0, texArray2);

What that code does is:
While(we still have vertexes)
put the vertexes into an array

change to texture0
put the texture coords into array1

change to texture1
put the texture coords into array2

glVertexPointer(3, GL_FLOAT, 0,array);
glTexCoordPointer(2, GL_FLOAT, 0, array1);
glTexCoordPointer(2, GL_FLOAT, 0,Array2);

All I want to do is to beable to be using multi texturing in vertex arrays. The thing that goofed this thing up is when I started assigning these two sets of texture coords. Anyone know what I'm doing wrong?

07-26-2000, 09:56 AM
Sure, those glClientActiveTextureARB(GL_TEXTUREn_ARB) calls are in the wrong spot. Move them down to where you are assigning the texture arrays, first select one texture unit then set that array pointer, then select the other texture unit and assign its texture array pointer.

[This message has been edited by DFrey (edited 07-26-2000).]

07-26-2000, 10:14 AM
I was just coming back to tell ya I figured it out.

Just was you said though. Now that I think about it makes sence.