I believe I have all the components to make a simple green drawing, obviously I’m wrong. Maybe someone can shed some light on what I am missing?
@Override
public synchronized void onDrawFrame(GL10 unused) {
Bitmap b = Bitmap.createBitmap(512, 512, Bitmap.Config.RGB_565);
b.eraseColor(Color.GREEN);
GLES20.glEnable(GLES20.GL_TEXTURE_2D);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, b, 0);
}
glTexImage2D does not draw anything. It merely copies an image into a texture. You still have to draw some geometry (a quad or so) that’s being textured with said image.
Also glTexImage needs a bound texture object to work with. Which means you first have to use
glGenTexturesto obtain a new texture ID and thenglBindTextureto bind/create it.I should also point out that if the image remains constant you should not re-upload it upon every frame drawing.
But most importantly if you just want to draw some green quad, why not just draw a green quad? You don’t need a texture for this.