开发者

How to Calculate Visible range in Opengl ES Android?

I am developing a new game for Android. In this I am using Android OpenGL ES 1.1. In this when I translate in Z axis to -2, the triangle moves backwards. Now when I translate in X axis and Y axis the triangle is visible till a limit of say -1.4 to 1.4 in Y axis and -0.8 to 0.8 in X axis.

Now If I move further down say about -4 in Z axis, I can move the triangle in Y-axis to say about from -1.9 to 1.9 and X- axis from开发者_如何学C -1.2 to 1.2. The numbers provided are only approximate values. The point is that when I move back wards in Z axis, I am able to move triangle for a longer range in X and Y axis. This keeps increasing as I move backwards.

Now I would like to know calculate this visible range for a given value of Z. I mean If I know the Z value to be as -3 I would like to calculate in code what is the visible range of triangle to which i can translate in X and Y axis. I right now do it manually by trying trial and error with different values. Please let me know how to calculate it in code. Thank you very much in advance for your time and help.


This greatly depends on what matrices you put the triangle through, or you have loaded into opengl. Last time I checked, by default, the clip coordinates for opengl was -1 to 1 in the x, y, and z axis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜