I'm trying to use a 32F-per-channel texture attached to a frame buffer to do render to texture. I did it properly with a normal unsigned RGBA texture, but I need more resolution in every channel.
I changed texture's internal format, but doing the attachment the app threw me INVALID_ENUM error. I read that is possible to attach textures with this kind of format link link. So the error might be elsewhere.
Here are the snippets of code:
glGenTextures(1, &mTexId);
glBindTexture(GL_TEXTURE_2D, mTexId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, _width, _height, 0, GL_RGBA32F , GL_UNSIGNED_BYTE, nullptr);
glBindFramebuffer(GL_FRAMEBUFFER, mBufferId);
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTexId, 0);
checkErrors(); // <<--- Here I check the possible errors and it's where i got the INVALID_ENUM
Can anybody helps me? Thank you very much.
Your glTexImage2D
call is invalid.
GL_RGBA32F
is a valid internal format, but not a valid client side format enum. Since you are only creating the texture without copying pixel data from client memory, the format you specify there does not even matter, but it must be still valid.
Use
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, _width, _height, 0, GL_RGBA, GL_FLOAT, nullptr);
instead.