OpenGLES 2 Get Device Resolution on Startup with GL/GLUT and Native C/C++

I am trying to provide a full device resolution on mobile es2 and trying to get the max resolution available. How do I achieve this with GL/Glut?

I have tried this one, but getting unstable results (on some device it is deformed or stretched and inverted)

glGetIntegerv(GL_MAX_VIEWPORT_DIMS, results);

That tells you the maximum supported viewport. Any viewing transformation (i.e. the projection matrix) needs to be based upon the actual viewport, which won’t be any larger than the window.

GLUT might be able to give you a full-screen window via glutFullScreen(); call this after creating the window and registering a resize callback (which will report the window dimensions needed to set the viewport). Otherwise, you’ll need to use the platform’s native API.

Thanks. I will try the GLUT fullscreen method or perhaps just go with the native/jni way of getting the device resolution.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.