How can I get screen size in pixels from OpenGL(ES) functions?
What platform are you developing on? I don't believe there is a way, based on the fact that for both Android and iOS devices, when I've followed books and tutorials, they use the OS's view/window size manager, rather than any intrinsic OpenGL ES function. It does seem to be an odd feature for a graphics api to lack, which is why I'm hesitant to claim this as the answer.
Also important, from @ognian:
You can call
glGetIntegerView
withGL_VIEWPORT
before you ever callglViewport
. It'll return{0, 0, window_width, window_height)
. If you know your app is executed in full-screen, this will match the screen size. That's the closest you could ever get to querying screen resolution from OpenGL API