FBO, ATI, and texture with only one float color component


here is my problem : I use shaders (Cg), I use FBO to render in a texture, and I want to store 32bits float in this texture.

Obviously I can write pack/unpack functions to store a 32bits float in an RGBA texture, but it really slows the shaders…

With DirectX, I can create a texture with D3DFMT_R32F flag, which means this texture will only have a red component where I can store a 32bits float. That’s fine : I can set this texture as render-target and store my floats in it.

So, I’m looking for an OpenGL texture’s internal format which would do the same thing.
At the beginning, I tried with GL_DEPTH COMPONENT32 texture and bound this texture on my color-framebuffer ; maybe it could have work, but obviously not : I can’t bind a depth-texture on a color framebuffer.
After that, I tried with a GL_ALPHA16 texture, which could give me at least 16bits of storage for my floats, but GL tells me I can’t bind this texture on my color-framebuffer.

Then, I just have few questions :

  • why can’t I bind a GL_ALPHA16 texture on a color-framebuffer ?
  • Should I understand I can just bind RGBA textures on my color-framebuffer, and one-color-component texture can’t be bound with FBO ?
  • Is there a “new” flag which allows creating textures with only one 32bits color-component (like D3DFMT_R32F in D3D) ?

Few information: I use an ATI 9800, with latest ATI’s drivers.

Thanks a lot for your help.




Not possible with FBO on ATI cards.

thanks for your replies.
Do you see another solution ?


Just use GL_RGBA32F_ARB and hope that this gets fixed some day.

Originally posted by spasi:
Not possible with FBO on ATI cards.
It’s possible in the sense that the hardware supports rendering to one and two channel formats. But the spec (for some reason that’s beyond me) clearly specifies that RGB and RGBA are the only valid color-renderable formats.

Ok. Thanks for these useful information.