Exemplo n.º 1
0
  @Override
  public void onDrawFrame(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

    if (lightingEnabled) {
      gl.glEnable(GL10.GL_LIGHTING);
    } else {
      gl.glDisable(GL10.GL_LIGHTING);
    }

    if (blendingEnabled) {
      gl.glEnable(GL10.GL_BLEND);
      gl.glDisable(GL10.GL_DEPTH_TEST);
    } else {
      gl.glDisable(GL10.GL_BLEND);
      gl.glEnable(GL10.GL_DEPTH_TEST);
    }

    gl.glLoadIdentity();
    gl.glTranslatef(-1.5f, 0.0f, 0.0f);
    gl.glScalef(0.8f, 0.8f, 0.8f);
    //        gl.glRotatef(anglePyramid, 1.0f, 1.0f, 1.0f);
    //        triangle.draw(gl);

    //        pyramid.draw(gl);
    gl.glTranslatef(0.0f, 0.0f, z);
    gl.glRotatef(angleX, 1.0f, 0.0f, 0.0f);
    gl.glRotatef(angleY, 0.0f, 1.0f, 0.0f);
    photoCube.draw(gl);
    angleX += speedX;
    angleY += speedY;

    gl.glLoadIdentity();
    gl.glTranslatef(1.5f, 0.0f, -6.0f);
    //        gl.glRotatef(angleSquare, 1.0f, 0.0f, 0.0f);

    gl.glTranslatef(3.0f, 0.0f, 0.0f);
    //        square.draw(gl);

    //        gl.glScalef(0.8f, 0.8f, 0.8f);
    //        gl.glRotatef(angleCube, 1.0f, 1.0f, 1.0f);
    gl.glTranslatef(0.0f, 0.0f, z);
    gl.glRotatef(angleX, 1.0f, 0.0f, 0.0f);
    gl.glRotatef(angleY, 0.0f, 1.0f, 0.0f);
    textureCube.draw(gl, currentTextureFilter);
    angleX += speedX;
    angleY += speedY;

    anglePyramid += speedPyramid;
    angleCube += speedCube;

    //        angleTriangle += speedTriangle;
    //        angleSquare += speedSquare;
  }
 @Override
 public void onDrawFrame(GL10 gl) {
   // Clear color and depth buffers using clear-value set earlier.
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   // Reset the model-view matrix.
   gl.glMatrixMode(GL10.GL_MODELVIEW);
   gl.glLoadIdentity();
   // Translate into the screen depending on scale.
   gl.glTranslatef(0.0f, 0.0f, dragControl.getCurrentScale());
   // Rotate depending on touch rotation.
   gl.glMultMatrixf(dragControl.currentRotation().toMatrix(), 0);
   // Draw the cube.
   photocube.draw(gl);
 }