As the title already says, I’d like to know how to create a 1024×1024 Texture with only one 8-bit value in Java for Android OpenGL-ES 2.0. The reason for this is that I only need it with 8-bit values and don’t want to waste the other 24-bits in a RGBA-Texture which would be 4MB instead of 1MB.
The only way I know to set textures in Java is with:
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, map, 0);
But I don’t know if that is of any use here, or if I have to do what I want with a different method or if the only way to achieve this is with the NDK.
I’d like to use that value as alpha for a shader but its not really important what it is, because I can set that in the shader.
Does anyone know how this is possible in Java?
The method
allows you to chose the internal texture format.
http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node51.html
In this web you have the existing formats explained. Btw, ALPHA8 seems to be the one that fits all the requirements.