Code example for GL10

Methods: gluPerspectiveglLoadIdentityglMatrixModeglViewport

0
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		if (height == 0) { // Prevent A Divide By Zero By
			height = 1; // Making Height Equal One
		} 
 
		gl.glViewport(0, 0, width, height); // Reset The Current Viewport
		gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix
		gl.glLoadIdentity(); // Reset The Projection Matrix
 
		// Calculate The Aspect Ratio Of The Window 
		GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,
				100.0f); 
 
		gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix
		gl.glLoadIdentity(); // Reset The Modelview Matrix
	} 
 
	/** 
	 * Override the touch screen listener. 
	 *  
	 * React to moves and presses on the touchscreen.