I have got a problem handling orientation changes from a nativeactivity for my opengl related app.
I have the JNI setup for two functions:
- One for setting the orientation and
- One for getting what the orientation currently is.
I am using the constants for setRequestedOrientation(int)
:
6 is SENSOR_LANDSCAPE,
7 is SENSOR_PORTRAIT,
4 is just SENSOR.
Now, im using config changes to handle it myself. And in this function I'm calling the java getorientation()
function i setup. It is reporting correctly either landscape or portrait.
The problem comes in when i go to initialize my EGL display again. ANativeWindow_getWidth(window)
is not reporting the correct width at all times. It'll work half the time. I think the engine->app->window
is something being set from the parameter in android_main()
and is used by egl to determine the screen dimensions.
But the value is wrong because i dont know how you go about updating the window with the correct one via config changes. anyone have any idea what i can do?