Code example for GL10

Methods: glEnable, glLightfv, glLoadIdentity, glMatrixMode, glViewport, gluPerspective

0
		} 
	} 
 
	public void onSurfaceChanged(GL10 gl, int width, int height) {
		//ÉèÖÃÊÓ¿Ú 
		gl.glViewport(0, 0, width, height);
		//¼ÆËã¸ß¿í±È 
		float ratio = (float)width / (float)height;
		//ÉèÖõ±Ç°²Ù×÷¾ØÕóΪͶӰ¾ØÕó 
		gl.glMatrixMode(GL10.GL_PROJECTION);
		//ÖØÖþØÕó 
		gl.glLoadIdentity();
		//ÉèÖô°¿Ú±ÈÀýºÍ͸ÊÓͼ,ʵ¼ÊÊÇÉú³ÉÒ»¸öͶӰ¾ØÕó 
		GLU.gluPerspective(gl, 45.0f, ratio, 0.1f, 100.0f);
		//Ñ¡ÔñÄ£Ð;ØÕó 
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glLoadIdentity();
		//´ò¿ª¹âÔ´ 
		gl.glEnable(GL10.GL_LIGHTING);
		//ÉèÖùâÔ´ 
		gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_AMBIENT, lightAmbient);
		gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_DIFFUSE, lightDiffuse);
		gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_POSITION, lightPosition);
	} 
 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		//³õʼ»¯Á¢·½Ìå×ø±êºÍÎÆÀí 
		cube = BufferUtils.floatBuffer(cubeData);