views:

265

answers:

1

Hey everyone,

I'm porting an OpenGL app from the iPhone to Android, and I need to render OpenGL content to a texture. Since framebuffers are not available in OpenGL 1.0 and the DROID is the only Android phone with the framebuffer OpenGL extension, I'm trying to draw using OpenGL and then copy the result into a texture using glCopyTexImage2D. However, my initial findings are not good:

  1. glCopyTexImage2D works in the Android emulator (OS v. 1.5), but only with GL10.GL_RGB, not GL_RGBA. If you try to copy the alpha data from the scene into the texture, you just get a completely white texture.

  2. glCopyTexImage2D doesn't seem to work at all on the Android G1. glCopyTexImage2D does not throw an UnsupportedOperationException, but after calling it the texture is completely white.

Has anyone successfully used glCopyTexImage2D in an Android app? If so, could you please post a bit of the code you're using, and the devices your app is limited to? I suspect it works only with specific parameters on specific devices, if at all. Right now, I'm calling it like this:

gl.glCopyTexImage2D(GL10.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0,0, 256,
256, 0);
+1  A: 

According to the documentation glCopyTexImage2D is available only if the GL version is 1.1 or greater. This means that it's not guaranteed in Android.

CaseyB
That being said, you can specify a minimum OpenGL version in an application's manifest. The app won't appear on all devices, but it will make sure that if it does appear, that the device supports OpenGL 1.1.
Trevor Johns
I've done some more research on this issue, and it looks like certain devices only support certain parameter combinations. Great fun... :-)
Ben Gotow