Code example for GL10

Methods: gluOrtho2DglLoadIdentityglMatrixModeglScalefglViewport

0
 
	/** Called when the surface changed size. */ 
	@Override 
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		// sets the viewport 
		gl.glViewport(0, 0, width, height);
		// switches to the projection matrix stack 
		gl.glMatrixMode(GL10.GL_PROJECTION);
		// loads identity matrix 
		gl.glLoadIdentity();
 
		// scales the width to get equal proportions on x and y (thus making the 
		// x = (-1, 1), y = (1, -1) region squared) 
		gl.glScalef((float) height / (float) width, 1, 1);
 
		// sets up a 2D orthographic projection reducing the (-1, 1) area of 2 * 
		// BORDER (thus leaving a border around the board) 
		GLU.gluOrtho2D(gl, -1.0f - BORDER, 1.0f + BORDER, 1.0f + BORDER, -1.0f
				- BORDER);
 
		// switches back to the modelview matrix stack 
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		// loads identity matrix 
		gl.glLoadIdentity();
	} 
 
	/** Called when the surface is created or recreated. */ 
	@Override 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
Connect your IDE to all the code out there  Get Codota for Java