We Have an Aspect Ratio Problem
We’re now pretty familiar with the fact that everything we render in OpenGL gets mapped to a range of [-1, 1] on both the x- and y-axes; this is also true of the z-axis. Coordinates in this range are known as normalized device coordinates and are independent of the actual size or shape of the screen. Unfortunately, because they are independent of the actual screen dimensions, we can run into problems if we use them directly, such as a squashed table in landscape mode.
Let’s say that our actual device resolution is 1280 x 720 in pixels, which is a common resolution on new Android devices. Let’s also pretend for a moment that we’re using the whole display for OpenGL, as it will make this discussion easier.
If our ...
Get OpenGL ES 2 for Android now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.