1
General / Losing context when changing views
« on: August 26, 2014, 01:16:06 pm »
Hi All,
I'm having a strange issue with SFML:
We have a C++ app which we have compiled for Android.
The app is using OpenGL for rendering.
Everything works fine, but we have had some trouble dealing with keyboard input since not all the keyboard events are mapped to sf::Keyboard values.
We then decided that we would create an activity which just takes a TextEdit and throws that up on the screen.
We then wrote some jni code which shows that activity when we need to get text input from the user.
This is where the problem starts:
Showing the activity is fine, we can switch back and forth as we wish.
However, when switching back to the Native activity for the second time (and all subsequent times) all we are getting is a white screen.
Everything else works, we can still get events and our application is still running, but the visual component (Textures) seem to be lost.
However, this only happens the second time we show that Native activity from the java code.
Is there a known workaround? This is a game and it takes quite a long time to start up, so restarting the activity from scratch is not really an option.
I was hoping there would be some way I could, from the native code, preserve the state of the OpenGL context, so that we can just attach that context to the window when it becomes visible again.
I hope this description was clear...
Thank you
Regards
I'm having a strange issue with SFML:
We have a C++ app which we have compiled for Android.
The app is using OpenGL for rendering.
Everything works fine, but we have had some trouble dealing with keyboard input since not all the keyboard events are mapped to sf::Keyboard values.
We then decided that we would create an activity which just takes a TextEdit and throws that up on the screen.
We then wrote some jni code which shows that activity when we need to get text input from the user.
This is where the problem starts:
Showing the activity is fine, we can switch back and forth as we wish.
However, when switching back to the Native activity for the second time (and all subsequent times) all we are getting is a white screen.
Everything else works, we can still get events and our application is still running, but the visual component (Textures) seem to be lost.
However, this only happens the second time we show that Native activity from the java code.
Is there a known workaround? This is a game and it takes quite a long time to start up, so restarting the activity from scratch is not really an option.
I was hoping there would be some way I could, from the native code, preserve the state of the OpenGL context, so that we can just attach that context to the window when it becomes visible again.
I hope this description was clear...
Thank you
Regards