Code example for GL10

Methods: glColor4f, glDisableClientState, glDrawElements, glEnableClientState, glFrontFace, glVertexPointer

0
		indexBuffer[5].put(face_six);
		indexBuffer[5].position(0);
	} 
	 
	public void glColor4i(GL10 gl, int r, int g, int b, int a) {
		gl.glColor4f((float)r/255.f, (float)g/255.f, (float)b/255.f, (float)a/255.f);
	} 
	 
	public void initTransformation(GL10 gl) {
 
		 
	} 
 
	/** 
	 * The object own drawing function. 
	 * Called from the renderer to redraw this instance 
	 * with possible changes in values. 
	 *  
	 * @param gl - The GL Context 
	 */ 
	public void draw(GL10 gl) {
		gl.glLoadIdentity();					//Reset The Current Modelview Matrix
		 
		//Drawing 
		gl.glTranslatef(pos.x(), pos.y(), pos.z());		//Move 5 units into the screen
		gl.glScalef(0.1f, 0.1f, 0.1f); 			//Scale the Cube to 80 percent, otherwise it would be too large for the screen
		 
		//Rotate around the axis based on the rotation matrix (rotation, x, y, z) 
		gl.glRotatef(rot.x(), 1.0f, 0.0f, 0.0f);	//X
		gl.glRotatef(rot.y(), 0.0f, 1.0f, 0.0f);	//Y
		gl.glRotatef(rot.z(), 0.0f, 0.0f, 1.0f);	//Z
		 
		drawCube(gl);
	} 
	 
	public void drawCube(GL10 gl) {
		//Point to our buffers 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
 
		//Set the face rotation 
		gl.glFrontFace(GL10.GL_CCW);
		 
		//Enable the vertex and texture state 
		gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
		 
		glColor4i(gl, 60, 232, 148, 255); // pastel green
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[0]);
		 
		glColor4i(gl, 100, 213, 237, 255); // aquamarine blue
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[1]);
		 
		glColor4i(gl, 0, 70, 153, 255); // dark blue
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[2]);
		 
		glColor4i(gl, 0, 100, 200, 255); // blue
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[3]);
		 
		glColor4i(gl, 122, 245, 210, 255); // teal
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[4]);
		 
		glColor4i(gl, 91, 91, 91, 255); // gray
		gl.glDrawElements(GL10.GL_TRIANGLES, face_one.length, GL10.GL_UNSIGNED_BYTE, indexBuffer[5]);
		 
		//Disable the client state before leaving 
		gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
	} 
	 
	/** 
	 * Load A single texture 
	 *