4

I've written an application which is rendering video into a texture basically using the code found in many posts here. I guess the original comes from some nVidia samples (VideoSurfaceView) found here: Using SurfaceTexture in Android

This example works perferctly fine on a mobile device and on a tablet - both based on a Tegra. I've then tried the same code on a MALI 400 based android system (Minix Neo5) and I can see that the video plays but I get mainly a black screen with some garbage on it (just 3 or 4 lines)

I've tried to use the OpenGL ES tracer to check what is copied from the SurfaceTexture back to the texture itself but it looks like the Tracer cannot show it correctly (neither on the tegra systems nor on the tegra devices. Note that I don't get any OpenGL error nor any warnings whatsover. It looks like everything is working fine.

Is there any other tool that can show me what if anything is copied to the TEXTURE_EXTERNAL ? All TEXTURE_2D are available on the tracer.

One strange thing I've noticed on the MALI system is that it can't play high-def videos at all. And my videos 1280x720 report on the debuger that they are using a SoftwareRenderer. Perhaps that's why the frames are not copied correctly to the OGL_IMAGE that will be used as a texture.

I guess I need some better understanding of what's going on under the hood, but I expected an error telling the system can't do it or it should simply work, even if the performance is poor. Perhaps this is a modified version of android and the mediaplayer code is just broken...

1
  • I've now tested on a second Mali-400 MP GPU based android (giadatech Q11), and I get just a black screen. I thought all features must be implemented on Android devices !?
    – Marco
    Apr 5, 2013 at 9:37

1 Answer 1

0

Thank you for your post! This is exactly what I observed on two other Android devices (both Mali-400 MP) and I have no idea why this happens. It seems like the video is played in the background. I added the following lines to the constructor of my GLSurfaceView-class:

setEGLConfigChooser(8,8,8,8,0,0);
getHolder().setFormat(PixelFormat.RGBA_8888);

The video is visible "behind" my OpenGL scene then. Both devices claimed to support the "GL_OES_EGL_image_external" extension.

3
  • How did you get it showing the video on the background? I;ve tried to set the bleding function: 'GLES20.glClearColor(0.0f, 1.0f, 0.0f, 0.5f);' 'GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT |GLES20.GL_COLOR_BUFFER_BIT);' 'GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);' 'GLES20.glEnable(GLES20.GL_BLEND);' 'GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);' 'GLES20.glDisable(GLES20.GL_BLEND);'
    – Marco
    Apr 22, 2013 at 10:53
  • Blending was not necessary in my case. Just add the two lines posted above did the job for me. You may use ´getHolder().setFormat(PixelFormat.TRANSLUCENT); for transparent background
    – MatSch3D
    Apr 25, 2013 at 14:59
  • If you use setEGLConfigChooser(8,8,8,8,0,0); you are asking for a config with no depth buffer... so OpenGL drawing will be composited purely based on drawing order. This might not be what you intended.
    – bleater
    May 28, 2014 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.