09 Mar

OpenGL Tutorial – Bind Texture

How enabling openGL texture?

gl.glEnable(GL10.GL_TEXTURE_2D);

How load texture from android drawable?

gl.glGenTextures(1, textureIDs, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIDs);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();

How to Set Texture in every Mesh / Polygon?

gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIDs[0]);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIDs[1]);
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4);

2 thoughts on “OpenGL Tutorial – Bind Texture

Leave a Reply

Your email address will not be published. Required fields are marked *