Textures and colors do not display properly in OpenGL ES

I am following the tutorials at http://www3.ntu.edu.sg/home/ehchua/programming/android/Android_3D.html and I ran into a problem.

I managed to find both of the following examples:

2.7 Example 5: 3D shapes - a rotating color cube and a pyramid (Nehe Lesson 5: 3D Shapes) Example 2: Cube2.java

2.8 Example 6: Texture (Her Lesson 6: Texture)

But when I try to draw both a color cube and a textured cube, I get the following:

http://i.imgur.com/Smbsa.png (The first part of the image)

The color cube is invisible, but it grips the texture cube, and the texture cube textures are painted with the last color (yellow) of the color cube.

I basically just draw both cubes with:

  // ----- Render the Color Cube -----
  gl.glLoadIdentity();                // Reset the model-view matrix
  gl.glTranslatef(0.0f, 0.0f, -6.0f); // Translate right and into the screen
  gl.glScalef(0.5f, 0.5f, 0.5f);      // Scale down (NEW)
  gl.glRotatef(angleCube, 1.0f, 1.0f, 0.0f); // rotate about the axis (1,1,1) (NEW)
  cube.draw(gl);                      // Draw the cube (NEW)

  // Update the rotational angle after each refresh (NEW)
  angleCube += speedCube;         // (NEW)

  // ----- Render the Texture Cube -----
  gl.glLoadIdentity();                // Reset the model-view matrix
  gl.glTranslatef(-1.0f, 0.0f, -6.0f); // Translate right and into the screen
  gl.glScalef(0.5f, 0.5f, 0.5f);      // Scale down (NEW)
  gl.glRotatef(angleCube, 1.0f, 1.0f, 0.0f); // rotate about the axis (1,1,1) (NEW)
  texturecube.draw(gl);                      // Draw the cube (NEW)

"" "2.9 6a: -".

( 2 , imgur )

:

 gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);

, "" .

:

 gl.glColor4f(1.0f, 1.0f, 1.0f, 0.0f);

, .

:

  texturecube.loadTexture(gl, context);    // Load image into Texture (NEW)
  photocube.loadTexture(gl);    // Load image into Texture (NEW)
  gl.glEnable(GL10.GL_TEXTURE_2D);  // Enable texture (NEW)

:

( 2 , imgur )

.

:

, ? ( , )

"" /, "gl.glColor4f (1.0f, 1.0f, 1.0f, 0.0f);"?

+3
1

, , , . , , .

, :

-: , . , . glDisable(GL_TEXTURE_2D) .

: , ( , , 1,1,1,1, 1,1,1,0, - - ). , , OpenGL , .

+3

All Articles