Hi Folks,
This is based in Android and using NativeActivities to render 3D Content from my Engine.
Im having some issues with rendering UI in OpenGLES. Im Rendering UI from my engine by switching to a projection matrix and then rendering based on the screen coordinates:
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrthof(0, g_SystemProfile.GetSystemScreenWidth(), 0, g_SystemProfile.GetSystemScreenHeight(), -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Then popping back to Model view for next update and rendering the world. This works fine when rendering UI over our game engine when the OpenGLES context is set to the screen width and height.
However.... when the context is updated in the configureVideoBackground() function to retain the WxH ratio to match the camera WxH ratio all of my rendering becomes stretched. This means a button rendered at 0,0 is then rendered off screen when the context height changes from say 480 to 533.
The problem here is that all of my buttons arent rendered in relation to screen pixels, which means all of my touch event's and UI positions no longer match the button positions and frames sizes originally set.
Any advice would be very appreciated.
Jim
Projection rendering stretched when setVideoBackgroundConfig(con
Hi, this effect is probably a consequence of the fact that Vuforia defines a custom viewport (whose boudnaries are partially outside the screen view) as a consequence of setting the video background config.
Projection rendering stretched when setVideoBackgroundConfig(con
Thanks Alexandro,
Foolishly i had totally forgot about glViewport.
I fixed this by just switched between the 2 viewport sizes when rendering the camera and my UI. I should have seen that haha.
Jim
Projection rendering stretched when setVideoBackgroundConfig(con
You're welcome, Glad to hear it is solved.