OpenGL立方体贴图中面的约定 [英] Convention of faces in OpenGL cubemapping

查看:17
本文介绍了OpenGL立方体贴图中面的约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenGL 对立方体贴图的约定是什么?

What is the convention OpenGL follows for cubemaps?

我遵循这个约定(在网站上找到)并使用对应的 GLenum 指定 6 个面 GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 但我总是弄错 Y,所以我必须用负 Y 面反转正 Y.为什么?

I followed this convention (found on a website) and used the correspondent GLenum to specify the 6 faces GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT but I always get wrong Y, so I have to invert Positive Y with Negative Y face. Why?

          ________
         |        |
         | pos y  |
         |        |
  _______|________|_________________
 |       |        |        |        |
 | neg x | pos z  |  pos x |  neg z |
 |       |        |        |        |
 |_______|________|________|________|
         |        |
         |        |
         | neg y  |
         |________|

推荐答案

但我总是弄错 Y,所以我必须用负 Y 面反转正 Y.为什么?

but I always get wrong Y, so I have to invert Positive Y with Negative Y face. Why?

啊,是的,这是关于 Cube Maps 最奇怪的事情之一.请放心,你不是唯一一个爱上它的人.你看:

Ah, yes, this is one of the most odd things about Cube Maps. Rest assured, you're not the only one to fall for it. You see:

Cube Maps 已被指定为遵循 RenderMan 规范(无论出于何种原因),并且 RenderMan 假定图像的原点位于左上角,这与图像原点位于左下角的通常 OpenGL 行为相反.这就是为什么事情会在 Y 方向交换.它完全打破了通常的 OpenGL 语义,根本没有意义.但现在我们被它困住了.

Cube Maps have been specified to follow the RenderMan specification (for whatever reason), and RenderMan assumes the images' origin being in the upper left, contrary to the usual OpenGL behaviour of having the image origin in the lower left. That's why things get swapped in the Y direction. It totally breaks with the usual OpenGL semantics and doesn't make sense at all. But now we're stuck with it.

请注意,左上角和左下角是在从模型空间到 NDC 空间的恒等转换上下文中定义的

这篇关于OpenGL立方体贴图中面的约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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