OpenGL坐标系是右手还是左手? [英] Is the OpenGL Coordinate System right-handed or left-handed?

查看:450
本文介绍了OpenGL坐标系是右手还是左手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我在OpenGL ES 2.0程序的modelViewTransformation Matrix上使用了Identity Matrix.在这种情况下,坐标系是从(-1,-1,-1)扩展到(1,1,1)的规范OpenGL坐标系.

Say I am using an Identity Matrix for my modelViewTransformation Matrix on an OpenGL ES 2.0 program. The Co-ordinate system in this case is the canonical OpenGL co-ordinate system which extends from (-1,-1,-1) to (1,1,1).

该坐标系是右手还是左手?

Is this coordinate system right-handed or left-handed?

一个更广泛的问题:是否存在带有OpenGL的文档,该文档可以列出API遵循的所有数学约定?

A broader question: Is there a document with OpenGL which can list all the mathematical conventions followed by the API?

推荐答案

我的问题是,这是座标吗 系统是右手还是左手?

My question is, is this coordinate system right-handed or left-handed?

默认情况下,OpenGL始终是惯用右手的.您可以通过自动正常创建来观察此情况.您可以通过为每个点指定左手法线创建来强制左手法线创建,但是通常,右手法则始终适用.有关右侧的更多讨论,请参见OpenGL常见问题解答中的 9.150 . OpenGL的唯一特性.

By default, OpenGL is always right-handed. You can observe this by the automatic normal creation. You can force a left-handed normal creation by specifying it per point but, in general, right hand rule applies all the time. See 9.150 in the OpenGL FAQ for more discussion of the right-hand-only nature of OpenGL.

...所有数学约定 然后是API?

... all the mathematical conventions followed by the API?

不清楚您要的是什么.数学是基本的线性代数,非常注重矩阵数学和线性变换.

It's not clear what you're asking for. The math is basic linear algebra with a strong focus on matrix math and linear transformations.

编辑以回复评论问题:

记住,但是,如果您使用统一矩阵调用而不是较旧的glRotates等,则必须指定使用的是行矩阵还是列矩阵.在这种情况下(根据注释中提到的代码):

REMEMBER, however, that if you are using the uniform matrix calls rather than the older glRotates, etc, that you must specify whether you are using row-major or column-major matrices. In this case (from the code mentioned in the comment):

glUniformMatrix4fv(uniforms[UNIFORM_MVP], 16, GL_FALSE, mvpMatrixZRotation);

在此呼叫中,GL_FALSE告诉呼叫这是一个列主矩阵,因此,所产生的旋转将是预期的转置.因此,旋转将被反转,看起来像一个左手坐标系.

In this call, GL_FALSE is telling the call that this is a column-major matrix and, as such, the rotation that results will be the transpose of what was intended. Therefore, the rotation will be inverted, looking like a left-handed coordinate system.

将其更改为GL_TRUE,一切都会好起来.

Change that to GL_TRUE and all will be well.

这是非常简单的示例与该特定主题相关的OpenGL讨论板.

Here is a very simple example from the OpenGL discussion board that's relevant to this specific topic.

还有另一种修改以回应评论请求:此处是OpenGL中矩阵流水线的另一种详细说明.注意带有三个轴的GL_MODELVIEW图:它们显示了右手坐标系. FAQ中的上述引用也仍然适用.

Yet another edit to respond to the request for comment: Here is another detailed explanation of the matrix pipeline in OpenGL. Notice the GL_MODELVIEW diagram with the three axes: they illustrate the right-handed coordinate system. The above citation in the FAQ also still applies.

这篇关于OpenGL坐标系是右手还是左手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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