SFML community forums

Help => Window => Topic started by: FraKtus on May 14, 2017, 08:20:45 am

Title: Window not redrawing after onResume on Android
Post by: FraKtus on May 14, 2017, 08:20:45 am

I have an application running 4 OS with SFML and Nuklear, congrats for the amazing API!

There is one issue where the Android app does not redraw after onResume on Android, when I switch the app it does not redraw anymore.

I see that sometimes several main are running, it's like ANativeActivity_onCreate is called again and the main is recreated and of course it's a problem...

That may be in the Nuklear code https://github.com/vurtun/nuklear/blob/master/demo/sfml_opengl2/nuklear_sfml_gl2.h
There is a static that I did remove for testing but it did not solve the issue...

I receive the events sf::Event::MouseEntered and sf::Event::MouseLeft correctly...

Should I recreate the window when I receive sf::Event::MouseEntered ?
Title: Re: Window not redrawing after onResume on Android
Post by: FraKtus on May 18, 2017, 09:44:43 am
After using logcat I see this OpenGL error after a resume:

sfml-error: An internal EGL call failed in EglContext.cpp (189) : EGL_BAD_SURFACE, an EGLSurface argument does not name a valid surface (window, pbuffer, or pixmap) configured for rendering

This is how I create the window:
sf::ContextSettings settings;
sf::VideoMode mode = sf::VideoMode::getDesktopMode();
sf::Window win(mode, "SFAppDelegate", sf::Style::Fullscreen, settings);

Does that seems correct ?
Title: Re: Window not redrawing after onResume on Android
Post by: FraKtus on May 18, 2017, 10:19:42 pm
So I fixed the issue after adding messages to logcat.. I saw that the OpenGL context was not correctly selected after resuming.

In the end it's really important to do win.setActive(false) when receiving sf::Event::LostFocus... and making win.setActive(true) on sf::Event::GainedFocus...

Now the 4 platforms are working fine :-)
Title: Re: Window not redrawing after onResume on Android
Post by: eXpl0it3r on May 19, 2017, 05:41:03 pm
Good to hear that you figured it out! :)

Did you change anything in the SFML source code?