I want to play a video into an OpenGL texture on XOOM using Android 3.0. I have come across SurfaceTexture in the goole developer docs which has been added in API 11 http://developer.android.com/reference/android/graphics/SurfaceTexture.html
The documentation talks about using GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, I cannot find any reference to this define in the latest android-ndk-r5c, it's not defined in in the ndk and it only goes up to platform-9, so I guess I would need platform-11 and there appears to be no android.opengl.GLES20Ext which I guess is where it would reside on the java side.
I have the latest of all released android tools from google and I cannot find any extra things from NVidia or Motorola on their developer sites.
Do anyone have a working example of using SurfaceTexture to either put the camera image or video onto an OpenGL texture? and/or know what I am missing to be able to use this new functionality?
If using API level 11 to 14 you can just define GL_TEXTURE_EXTERNAL_OES yourself by placing
in your code. This seems to work just fine for me.
A demo locate https://github.com/crossle/MediaPlayerSurface
Example code. This creates a new external texture suitable for use in a SurfaceTexture, then wraps it in said SurfaceTexture and passes it to the camera as a surface to write the preview into.
Note that if you render this object, you'll need to be careful: It's NOT a 2D texture, so it needs special treatment in the shader.
NVIDIA has a full and working sample in their TEGRA Android Developer pack. The sample is written pure Java and runs in Standard Eclipse+Android SDK - so you just need to install the samples. The name of the project is surfacetexture (or something like it). It works nice! Hopes it helps you.