Code example for GL10

Methods: glClear, glLoadIdentity, glMatrixMode, glRotatef, glTranslatef

0
       
       
       
       
      // Clear the screen to black 
      gl.glClear(GL10.GL_COLOR_BUFFER_BIT
            | GL10.GL_DEPTH_BUFFER_BIT);
 
      // Position model so we can see it 
      gl.glMatrixMode(GL10.GL_MODELVIEW);
      gl.glLoadIdentity();
      gl.glTranslatef(0, 0, -3.0f);
 
      // Other drawing commands go here... 
       
       
      // Set rotation angle based on the time 
      long elapsed = System.currentTimeMillis() - startTime;
      gl.glRotatef(elapsed * (30f / 1000f), 0, 1, 0);
      gl.glRotatef(elapsed * (15f / 1000f), 1, 0, 0);
 
       
      // Draw the model 
      cube.draw(gl);