Log in or register to post comments

onResume black screen, but pose matrix still being created

August 9, 2013 - 2:20pm #1

I'm using a modified version of the Image Targets sample project that I have integrated with an open source game engine. I'm having some issues dealing with the activity lifecycle of my app. When the main activity is paused and then resumed, I am getting the pose matrix information from Vuforia that I'm then sending to my game engine, but the glView is all black. I should mention that I changed the way views are working by using addContentView() with the glView and then I use addContentView() again but with a framelayout, and a child listview on the right. This setup works fine until the state changes take place and I'm wondering if there is anything I'm missing that I need to do with my game engine, or if maybe I've messed up how the glView is doing it's thing. Any advice?

onResume black screen, but pose matrix still being created

August 12, 2013 - 12:24pm #7

Vuforia uses the gl context to render the video background.

onResume black screen, but pose matrix still being created

August 12, 2013 - 12:11pm #6

From what I just read on the Android docs, it seems the glSurfaceView class does when you call onPause on it, which is required when you pause your activity.

 

Also, if I'm not rendering through gl like the image target example is, does Vuforia need to deal with gl contexts at all? Is that integrated in the system , or can I use the activity and gl context handling that the game engine I'm using has a demo of?

onResume black screen, but pose matrix still being created

August 12, 2013 - 11:11am #5

That sounds great!

Concerning the context destruction, afaik Vuforia does not destroy the gl context on pause.

 

onResume black screen, but pose matrix still being created

August 12, 2013 - 10:39am #4

I found a solution that works. There's a method for API 11 that allows gl contexts to be preserved for the glSurfaceView when the activtiy is paused. I just added

this.setPreserveEGLContextOnPause(true);

to the glSurfaceView constructor and my game engine is able to render correctly when I resume my application. I hope this doesn't cause any side effects, and I'm not sure if I'll run in to any issues when android destroys my activity.

 

What's confusing is I never "send" any gl contexts to my game engine, so I'm not sure how preserving it makes a difference, and also, doesn't Vuforia destroy and create a new gl context during onPause/onResume? If so, am I possibly using multiple contexts, and this won't work for other devices?

 

onResume black screen, but pose matrix still being created

August 12, 2013 - 7:14am #3

I'm assuming the OpenGL context between the game engine and vuforia is the same, so where can I find out more about how Vuforia handles that? I noticed in the logs that when pasuing/resuming, a line says "QCAR -------- Creating OpenGL ES 2.0 context"; could that have something to do with it? I'm not doing anything to my game engine during the pause or resume functions. I noticed onSurfaceChanged and onSurfaceCreated are called when pausing/resuming, and I'm only loading the scene for my game engine in onSurfaceChanged. I just modified it to only load the scene on the first run of the app though, but that isn't making a difference. I also removed my view and there's only that gl surface view, but it made no difference.

 

I could try reintegrating with the new image target sample, but it was such a pain to get my project where it is now that I don't even really remember everything I did.

onResume black screen, but pose matrix still being created

August 10, 2013 - 12:00pm #2

Hi, hard to tell what goes wrong: maybe some OpenGL state is not cleaned up properly in your engine when you pause/resume, or perhaps it could be that the view layout that you are using is creating some issues.

I would suggest to test one thing at a time, for instance integrating your engine in the IT sample while still using the original layouts of the sample, or similar strategies, so to be able to isolate the problem.

 

Log in or register to post comments