The iPad now supports the OES_texture_half_float
extension. 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
This works fine when replacing GL_HALF_FLOAT_OES
with GL_UNSIGNED_BYTE
.
Is this a limitation with iOS or am I doing something incorrectly?