LookAt目标位置与z = 0或z = 1000或-1000无关紧要? [英] The LookAt target location doesn't matter if it is z = 0 or z = 1000 or -1000?

查看:96
本文介绍了LookAt目标位置与z = 0或z = 1000或-1000无关紧要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在OpenGL ES中尝试LookAt,

I am trying LookAt in OpenGL ES,

    gluLookAt(512, 384, 2000,
              512, 384, 0,
              0.0f, 1.0f, 0.0f);

第二行是目标的位置...所以我想知道,如果我将z0更改为1000-1000,应该看不出有什么不同吗?他们原来都是一样的,为什么呢?

The second row is the Target's position... so I wonder, if I change the z from 0 to 1000 or -1000, shouldn't what is seen different? They turn out to be all the same, why is that?

推荐答案

根据OpenGL规范中的gluLookAt,其输入内容为:

From the OpenGL spec for gluLookAt, it states the inputs as:

gluLookAt(GLdouble eyeX , GLdouble eyeY , GLdouble eyeZ , 
          GLdouble centerX , GLdouble centerY , GLdouble centerZ , 
          GLdouble upX , GLdouble upY , GLdouble upZ );

您的当前值只能沿z平面移动center向量,因此您实际上是从eye向量向下看的.根据您要渲染的内容,可能根本看不到任何变化(多维数据集的顶部或底部看起来都一样).

Your current values only move the center vector along the z plane so you're actually looking down from your eye vector. Depending on what it is that you're rendering, you might not see any change at all (a cube will look the same from either the top or the bottom).

尝试更改您的xy值,而不是将相机移动到与您要查看的向量不垂直的位置.

Try changing your x and y values instead to move the camera to that it is not perpendicular to the vector you're trying to look at.

这篇关于LookAt目标位置与z = 0或z = 1000或-1000无关紧要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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