Code example for GL10

Methods: glBlendFunc, glClearColor, glCullFace, glEnable, glEnableClientState, glGenTextures

0
 
	@Override 
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		// SETTINGS 
		// Set the background color to black ( rgba ). 
		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
 
		// DRAWING SETUP 
		// NOTES: As we are always drawing with textures and viewing our 
		// elements from the same side all the time we can leave all these 
		// settings on the whole time 
		// Enable face culling. 
		gl.glEnable(GL10.GL_CULL_FACE);
		// What faces to remove with the face culling. 
		gl.glCullFace(GL10.GL_BACK);
		// Enabled the vertices buffer for writing and to be used during 
		// rendering. 
		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		// Telling OpenGL to enable textures. 
		gl.glEnable(GL10.GL_TEXTURE_2D);
		// Tell OpenGL to enable the use of UV coordinates. 
		gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
		// Blending on 
		gl.glEnable(GL10.GL_BLEND);
		gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
 
		// Get unique texture ids 
		int[] textureIds = new int[texturesByResourceId.size()];
		gl.glGenTextures(textureIds.length, textureIds, 0);
 
		// Iterate over textures 
		Texture currentTexture;
		for (int i = 0; i < texturesByResourceId.size(); i++) {
			currentTexture = texturesByResourceId.valueAt(i);