为什么用Android的frustumM产生的矩阵从红皮书的有什么不同? [英] Why does the matrix generated by Android's frustumM differ from the Redbook's?

查看:1024
本文介绍了为什么用Android的frustumM产生的矩阵从红皮书的有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些事情似乎好笑Android的frustumM的工作方式。如果我检查的OpenGL红色的书,矩阵生成看起来像这样:

Songho.ca似乎都同意这一点:

Something seems funny about the way that Android's frustumM works. If I check the OpenGL red book, the matrix generated looks like this:

Songho.ca seems to agree with this:

然而,一个分量乘以2与Android的frustumM,而不是在其他示例矩阵。下面是它似乎是这样做的:

However, one component is multiplied by 2 with Android's frustumM, and not in the other example matrices. Here's what it seems to be doing:

一切似乎功能上投其所好,除了的第一行,第三列。这是为什么被乘以二?下面是code从android.opengl.Matrix的frustumM方法生成的第三列的前三个元素的行:

Everything seems to functionally match up, except the first row, third column. Why is that being multiplied by two? Here's the lines of code from android.opengl.Matrix's frustumM method that generate the first three elements of the third column:

final float A = 2.0f * ((right + left) * r_width);
final float B = (top + bottom) * r_height;
final float C = (far + near) * r_depth;

通过r_width,r_height,r_depth定义为:

With r_width, r_height, r_depth defined as:

final float r_width  = 1.0f / (right - left);
final float r_height = 1.0f / (top - bottom);
final float r_depth  = 1.0f / (near - far);

以最终浮动A线似乎是误乘以2

The line starting with "final float A" appears to be mistakenly multiplying by 2.

这是在Android的code错了,还是我只是失去了一些东西?我知道的是,术语抵消如果截锥是对称的。当运行code与非对称锥台,生成的矩阵实际上是不同的,因此是得到的载体,当同一矢量乘以这些不同的矩阵。

Is this a mistake in Android's code, or am I just missing something? I know that the term cancels out if the frustum is symmetrical. When running the code with an asymmetrical frustum, the generated matrices actually are different and so are the resulting vectors when the same vector is multiplied with those differing matrices.

推荐答案

这是与Android的错误。请参阅 HTTP://$c$c.google.com / P /安卓/问题/详细信息?ID = 35646

It's a bug with Android. Please see http://code.google.com/p/android/issues/detail?id=35646

这篇关于为什么用Android的frustumM产生的矩阵从红皮书的有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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