public void onDrawFrame(GL10 gl) { // ... // 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); // Keep track of number of frames drawn numFrames++; long fpsElapsed = System.currentTimeMillis() - fpsStartTime; if (fpsElapsed > 5 * 1000) { // every 5 seconds float fps = (numFrames * 1000.0F) / fpsElapsed; Log.d( TAG, "Frames per second: " + fps + " (" + numFrames + " frames in " + fpsElapsed + " ms)"); fpsStartTime = System.currentTimeMillis(); numFrames = 0; } }