Question

I'm getting some STRANGE behavior on a Galaxy S3 (none of my other test devices (not S3s) bug out like the following).

Scenario:

I'm taking YUV data via JNI from an RTSP stream processed by libffmpeg. I take these values and feed them into C++ code using openGL so they may be mapped to a texture. (Basically, display the video from an RTSP stream in openGL).

Issues:

I've been trying to add an overlay to the video (with normal Android widgets/views/xml) and I noticed on the Galaxy S3 (nowhere else) the backgrounds to buttons (whether they're an R.color, R.drawable, etc.) are all missing. **The text on buttons IS visible.

The biggest issue is: after pressing back to return to regular old non opengl activites they're all corrupted (screenshots follow). The only thing visible on these views is the text. If the text moves (think pagination) the text will blur (see screenshot).

I've tried my app on 5 other devices with no issues. Both of these issues happen on my Galaxy S3, so I think they're related.

Despite my best Google-fu I've not found anything relevant. Any info is greatly appreciated. TY

Text visible after openGL paused (back to activity before it), but blurred when moved. No other elements visible (they should be): Text visible after openGL paused (back to activity before it), but blurred when moved. No other elements visible (they should be)

This is what the video looks like (should be a real life scene) if one resumes it after returning to previous activity. Note: there's no grey background on the button. This is true when the OpenGL activity is first opened and there's no other corruption: This is what the video looks like (should be a real life scene) if one resumes it after returning to previous activity. Note: there's no grey background on the button (as there should be). This is true when the OpenGL activity is first opened and there's no other corruption

Was it helpful?

Solution

It turns out I was calling the function to setup openGL on the UI Thread. I was calling my draw() (etc) methods in the thread created by the Renderer attached to my GLSurfaceView . Because the setup method was being called on the UI thread the openGL used for hardware acceleration was being corrupted.

TL;DR: don't make ANY (even setup) calls outside of the Renderer class used for GLSurfaceView as it creates a separate thread so your openGL calls don't interfere with the openGL running on the UI Thread used for hardware acceleration.

An easy test to see if your app is plagued by this issue is to disable hardware acceleration in your android manifest and check whether the issue goes away or not:

<application android:hardwareAccelerated="false" ...>

I hope this helps someone else :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top