Hi all,
I have a problem that’s really confusing me.
I’m rendering a cube using array (vertex, color & normals), each side of the cube has a different color.
this works fine.
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, currentObj.objGetTextureArray());
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL.GL_FLOAT ,0, currentObj.objGetVertexArray ());
gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
gl.glNormalPointer(GL.GL_FLOAT,0,currentObj.objGetNormalArray ());
gl.glEnableClientState(GL.GL_COLOR_ARRAY);
gl.glColorPointer(4, GL.GL_FLOAT ,0,currentObj.objGetColorArray ());
I want to add a texture to one face of the cube. I use a Texture bind & Texture Array.
texture.bind();
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, currentObj.objGetTextureArray());
This works fine, I can see the texture on one side, but all the other faces of the cube have the texture color.
It is because, I think,the faces with no textures have 0,0 UV coordinates in the array, and OpenGL applies its color.
The problem is I want to render the cube in one pass.
If I remove the 0.0 UV coordinates, the array wont match the vertex list.
Is this possible in one pass ?
Thanks for your help.