iPhone,浮动纹理 [英] iPhone, float textures

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

问题描述

我需要GL_ RGBA32F 作为内部格式,但是我没有在OpenGL ES实现中得到这个。取而代之,我只获得 GL_FLOAT 作为纹理数据类型。 OES_texture_float 规范没有什么可说的。所以我不知道,我的纹理数据是否会被标准化为[0,1]。基本上我需要存储纹理unclamped纹理数据,无论是浮点数或整数值。我的纹理里面的数据如何得到不规范化?解析方案

悲哀的是,OpenGL ES将参数视为glTex(Sub)Image *与桌面OpenGL不同。



在桌面OpenGL中,定义纹理的实际格式是 internalformat 。在GL ES 2.0中,这是定义这个的格式类型值。所以如果你上传了一个(GL_RGBA,GL_UNSIGNED_BYTE)纹理,这就相当于使用GL_RGBA8作为内部格式。

这意味着如果你想要一个浮点运算您可以使用(GL_RGBA,GL_FLOAT)作为格式类型参数。这两个规范之间是毫无意义的不一致。


I need to have GL_RGBA32F as internal format, but i do not get this in OpenGL ES implementation. Instead of this i get only GL_FLOAT as a texture data type. The OES_texture_float spec has nothing to say what's inside. So i do not know, whether my texture data will be normalized to [0, 1] or not. Basically i need to store in texture unclamped texture data regardless it's float or integer value. How i can get not normalized data inside my texture?

解决方案

Sadly, OpenGL ES treats the parameters to glTex(Sub)Image* differently from desktop OpenGL.

In desktop OpenGL, what defines the actual format of the texture is the internalformat. In GL ES 2.0, it is the format and type values that define this. So if you upload a (GL_RGBA, GL_UNSIGNED_BYTE) texture, that's the equivalent of using GL_RGBA8 as the internal format.

What this means is that, if you want a floating-point texture, you use (GL_RGBA, GL_FLOAT) as the format and type parameters. It's a pointless inconsistency between the two specifications.

这篇关于iPhone,浮动纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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