80,472
社区成员




//bottom
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==0,4,1
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==4,5,1
//front
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==4,6,5
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==6,7,5
//left
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==0,2,4
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==2,6,4
//right
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==5,7,1
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==7,3,1
//back
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==1,3,0
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==3,2,0
//top
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==6,2,7
07-21 20:38:55.835: I/System.out(22790): putIndices Triangles index:==2,3,7
private static float[][] texCoords = {
//bottom
{0,1, 0,0,1,1,1,0},//不是我不想用下面注释的那个数组,一旦用了别的面就花了
/*{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,},*/
// front
{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,},
// left
{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,},
// right
{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,},
// back
{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,},
//top
{0,1, 0,0,1,1,1,0}//不是我不想用下面注释的那个数组,一旦用了别的面就花了
/*{0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f,}*/
};
public void draw(GL10 gl,int[] texture){
mIndexBuffer.position(0);
mVertexBuffer.position(0);
mColorBuffer.position(0);
mTextureBuffer.position(0);
gl.glFrontFace(GL10.GL_CW);
gl.glShadeModel(GL10.GL_FLAT);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureBuffer);
for(int i = 0 ;i < 27 ;i++){
for(int j =0 ;j <6 ;j++){
gl.glBindTexture(GL10.GL_TEXTURE_2D, texture[j]);
GLCubeFace face = mWorldCubeList.get(i).mCubeFaceList.get(j);
face.mIndexBuffer.position(0);
gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, face.mIndexBuffer);
// mWorldCubeList.get(i).mCubeFaceList.get(j).draw(gl, texture[j]);
}
}
//gl.glDrawElements(GL10.GL_TRIANGLES, mIndexCount, GL10.GL_UNSIGNED_SHORT, mIndexBuffer);
}