OpenGL ES: getting a fixed size for an object

I have an open GL ES (1.1) scene with many 3d objects and a โ€œplayerโ€ model. I would like the player to have the same pixel size, regardless of the screen orientation on the Android phone or Iphone. I do not use glOrtho or billboards. This is a promising three-dimensional scene, but I just want the objects to be the same size in both screen orientations. Currently, if I rotate the phone, I keep the same aspect ratio, but the scene "scales" in landscape mode. I suspect that I need to play with glFrustrum parameters to get this; but I canโ€™t figure out how to do it yet. Therefore, any ideas are welcome!

thank

+3
source share
1 answer

You will need to change the aspect ratio when the device is rotated to switch from another, otherwise the size of the objects will change. If you look out the window, the objects on the other side of the window will only be the same size, if you do not change the distance from the window (i.e. the zoo there and back), when you "rotate", the aspect ratio of the window in the sidewayse window changes (metaphor starting to not work).

If you draw a square in the view and the side length is the short side of the screen, then you should have a square when you rotate the phone to the side, while still covering the same area on the screen.

, , , gluPerspective. , fovy . , fovx fovy .

0

Source: https://habr.com/ru/post/1780094/


All Articles