Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

render to floating point texture under iOS

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?

like image 416
prideout Avatar asked Oct 03 '10 16:10

prideout


1 Answers

I posted a similar question on this topic here.

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.

Thanks to kal21 for pointing this out.

like image 184
Frank Schlegel Avatar answered Nov 03 '22 00:11

Frank Schlegel