渲染到iOS下的浮点纹理

渲染到iOS下的浮点纹理

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

问题描述

iPad现在支持 OES_texture_half_float
扩展名。不幸的是我无法将浮点纹理绑定到帧缓冲对象。这是我的尝试:

The iPad now supports the OES_texture_half_floatextension. Unfortunately I'm having trouble binding a floating-point texture to a framebuffer object. Here's my attempt:

GLuint textureHandle;
glGenTextures(1, &textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
assert(GL_NO_ERROR == glGetError()); // this passes

GLuint fboHandle;
glGenFramebuffers(1, &fboHandle);
glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureHandle, 0);
assert(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER)); // this asserts

这在替换 GL_HALF_FLOAT_OES 使用 GL_UNSIGNED_BYTE

这是iOS的限制还是我做错了?

Is this a limitation with iOS or am I doing something incorrectly?

推荐答案

我在这个主题上发布了类似的问题。

I posted a similar question on this topic here.

似乎目前仅支持iPhone 4S和iPad 2,即使它没有明确支持在。

It seems that the OES_texture_float extension is currently only supported on iPhone 4S and iPad 2, even though it's not explicitly mentioned in Apple's guide.

感谢kal21为。

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

09-01 15:24