Code example for GL10

Methods: glActiveTexture, glBindTexture, glClear, glDisableClientState, glDrawArrays, glEnable, glEnableClientState, glLoadIdentity, glMatrixMode, glTexCoordPointer

0
 
		@Override 
		public void onDrawFrame(GL10 gl) {
			// TODO Auto-generated method stub 
 
			gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
			gl.glMatrixMode(GL10.GL_MODELVIEW);
			gl.glLoadIdentity();
 
			// ���鿪�� 
			gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
			gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
		 
			// �������� 
		 float[] vertexArray = new float[] {
					-4.65f,2.77f,0f, 
					-4.65f,-2.77f,0f, 
					 
					-2.325f-a*s,2.77f,0-z*s,
					-2.325f-a*s,-2.77f,0-z*s,
					 
					0-b*s,2.77f,0,
					0-b*s,-2.77f,0,
					 
					2.325f-c*s,2.77f,0-z*s,
					2.325f-c*s,-2.77f,0-z*s,
					 
					4.65f-d*s,2.77f,0f,
					4.65f-d*s,-2.77f,0f,
			}; 
		 	FloatBuffer vertexBuffer = FloatBuffer.wrap(vertexArray);
 
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
//			gl.glColor4f(0.3f, 0.8f, .0f, 1); 
 
			gl.glEnable(GL10.GL_TEXTURE_2D); // ����2D����
			gl.glActiveTexture(image);// ��������
			gl.glBindTexture(GL10.GL_TEXTURE_2D, image); // ָ�������ĸ�����
			gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texBuffer); // ����������������
 
			 
			 
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 10);
  
		  
 
			 
			 
			 
			 
			 
			 
			float[] vertexArray2 = new float[] {
			  
					4.65f-d*s,2.77f,0f,
					4.65f-d*s,-2.77f,0f,
					 
					4.65f-c*s,2.77f,z*s-z,
					4.65f-c*s,-2.77f,z*s-z,
					 
					4.65f-b*s,2.77f,0f,
					4.65f-b*s,-2.77f,0f,
					 
					4.65f-a*s,2.77f,z*s-z,
					4.65f-a*s,-2.77f,z*s-z,
					 
					4.65f,2.77f,0f, 
					4.65f,-2.77f,0f, 
			}; 
		 	FloatBuffer vertexBuffer2 = FloatBuffer.wrap(vertexArray2);
			 
		 	gl.glEnable(GL10.GL_TEXTURE_2D); // ����2D����
			gl.glActiveTexture(image2);// ��������
			gl.glBindTexture(GL10.GL_TEXTURE_2D, image2); // ָ�������ĸ�����
			gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, texBuffer); // ����������������
			 
			 
			gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer2);
			 
			gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 10);
			 
			 
 
			 
 
			 
			 
			 
			 
			 
			 
			// �����ر� 
			gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
			gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
 
		} 
 
	} 
private float beginX;