View Full Version : FBOs and textures other that RGBA

05-04-2009, 08:16 AM
In a deferred project of mine Im trying to store the normals of the scene in a texture. Everything works alright with the classic RGBA texture but the precision is horrible. 8bits per normal coordinate is not enough.

I've tried to create a GL_RGBA_FLOAT32_ATI texture but the FBO wont attach it. What should I change in the following code to be able to write in higher precision textures?

Here is the code for the FBO:
glGenFramebuffersEXT( 1, &fbo_id );
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbo_id );

// create the texture
glGenTextures( 1, &norm_txtr_id );
glBindTexture( GL_TEXTURE_2D, norm_txtr_id );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, window_width, window_height, 0, GL_RGBA, GL_FLOAT, NULL );

// attach the buffers to the FBO
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, render_targets[RT_NORMAL].norm_txtr_id, 0 );

PS: Im using Ubuntu and I have, unfortunately, an ATI 4870

05-04-2009, 08:27 AM
Make sure all your color attachments use same internal format. ATI doesn't support different type attachements for FBO.

05-04-2009, 09:43 AM
Thanks very much! That did it!

05-04-2009, 11:21 AM
I suggest that since your project is deferred you check back for current solutions at the time they become necessary.

05-05-2009, 08:41 AM
English in not my mother language so Im not sure I understand what do you mean.

05-05-2009, 12:35 PM
It was just a silly joke about your project being deferred as opposed to the shading (deferred just means postponed, delayed). I'm not making fun of your English, which is anyway very good.

05-05-2009, 01:39 PM
Hehe now I got it. I've made a few mistakes in my initial post and it seems I cannot edit it. Anyway