OpenGL ES 2.0 Camera Issues

心已入冬 提交于 2019-11-30 21:15:19
Mārtiņš Možeiko

That is normal - that is how perspective projection should look like. Although in your case it looks really stretched one - with wide field of view.

Try using instead of frustumM method perspectiveM(projection_matrix, 0, 45.0f, ratio, near, far). Or if you must use frustumM, calculate left/right/bottom/top like this:

float fov = 60; // degrees, try also 45, or different number if you like
top = tan(fov * PI / 360.0f) * near;
bottom = -top;
left = ratio * bottom;
right = ratio * top;

If you don't want any perspective effect at all, then use Matrix.orthoM instead of Matrix.frustumM.

To just make the perspective effect less extreme, you need to reduce the field of view -- That is, increase near or bring top and bottom closer to zero. (You probably want right = top * ratio, and similarly with left if you're going to fiddle with top and bottom values.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!