opengl平移与glulookat [英] opengl panning with glulookat

查看:443
本文介绍了opengl平移与glulookat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将相机横跨3D物体,向左或向右或上下移动。上下很容易(只是增加/减少y值)。当x为0或z为0时,左和右很容易。但是,当x或z都不为0时,只是用常数递增/递减不起作用。有没有数学公式为这?

I want to pan the camera across a 3d object, either left or right or up and down. Up and down is easy enough ( just increment/decrment the y value). Left and right is easy when x is 0 OR when z is 0. However in the case when neither x or z is 0, simply incrmeenting/decrementing by a constant does not work. Is there a mathematical formula for this?

推荐答案

这真的不重要什么值你的x OR z,gluLookAt

It really doesn't matter what value has your x OR z, gluLookAt() is just defining your starting point of view with current parameters.

我建议你阅读一些关于平移。这是非常好的文档,只有在理解原则后,你会闭上眼睛:)

I suggest you read some documentation about panning. It's very nice documentation, only after understanding the principle, you will do it with closed eyes :)

您可以在这里阅读更多关于LookAt函数:
1。 http://msdn.microsoft.com/en-us/library/windows/desktop/dd368663(v=vs.85).aspx
2.http://www.felixgers.de/teaching/jogl/ gluLookAt.html

You can read more about LookAt function here: 1.http://msdn.microsoft.com/en-us/library/windows/desktop/dd368663(v=vs.85).aspx 2.http://www.felixgers.de/teaching/jogl/gluLookAt.html

这篇关于opengl平移与glulookat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆