测量与正交剪切平面一起使用的屏幕的好方法
嘿,我正在转换我的项目,以便它使用正交投影,因为我被告知它更简单且适合 2D 游戏。我真的不知道如何测量裁剪平面的屏幕参数。我可以对数字进行硬编码,但这会导致屏幕横向显示时拉伸。我什至不知道剪切平面是否应该固定在屏幕边缘,但情况似乎确实如此,因为我一直在尝试不同的数字,数字越大,绘制的形状越小。这让我假设我输入的数字只是轴的最末端。
我的假设正确吗?
避免拉伸的最佳方法是什么?
哪些命令最适合查找屏幕尺寸?
Hey I'm converting my project so that it uses orthographic projection because I've been told its simpler and ideal for 2D games. I don't know really know how I'm meant to measure the screen parameters for the clipping planes. I could hard code numbers but that would cause stretching when the screen is put into landscape. I don't even really know if the clipping planes are meant to be fixed to the edge of the screen but that appears to be the case because I've been trying different numbers and the larger the numbers the smaller the drawn shape gets. That leads me to assume that the numbers I'm putting in are just the extreme ends of the axis.
Are my assumptions correct?
What is the best way to avoid the stretching?
What commands are best for finding the size of the screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊哈刚刚明白了 =)
刚刚意识到我的 onSurfaceChanged 方法如下所示:
gl.glViewPort 找到屏幕尺寸,经过一番播放后,我终于得到了一个中心对齐的图像,当使用该行更改方向时没有拉伸
有人纠正我如果有更好的方法来实现这个=)
Ah Ha Just got it =)
Just realised that my onSurfaceChanged Method looks like this:
gl.glViewPort finds the screen size and after a bit of playing I finally got a centre aligned image with no stretching when orientation is changed using the line
Someone correct me if there is a better way to implement this =)