ARB_color_buffer_float help


I am working on a blur example by using multiple FBOs. The program will makes objects blur when the object’s color components are set greater than 1.0.

For example,
glColor3f( 2.0, 2.0, 2.0 );
glColor3f( .5, .5, .5 );

The first cube is going to be blurred.

The 3D rendering happens in a framebuffer object, so I can use the texture in the FBO to generate blur effects. Shaders are used to manipulate the texture. I try to make the shaders identify which fragments need to be blurred by its rgb values. If all the values are greater than 1.0, than the fragment need to be blurred.

The problem is in fragment shader, gl_Color is already clamped, even the rgb values are set greater than 1.0 in OpenGL program. So I found that ARB_color_buffer_float can make the rgb values in OpenGL program un-clamped. However, my Mobility Radeon 9600 does not support it. Wondering is there any other way to transfer the un-clamped values from OpenGL program to shaders?

You could use uniform variables…

Or vertex attributes.

glColor is actually a vertex attribute (you can define it separately for each vertex), but in your case you can use uniform variable since it’s a constant you use once per object.

You could also use texture coordinate (this is also vertex attribute), but I suggest gong straight for uniforms or generic vertex attributes.

Sounds like you need to render to a floating point texture.
There are other ways to do blur. Search for glow effect. It uses a regular RGBA8 texture and the alpha layer to know what needs to be blurred.

I understood that he wants to pass a per-object floating-point parameter to the shader. Was I wrong?

yes, I am using floating-point texture now. My mobility 9600 supports it. :slight_smile:

I just got the idea of uniform variables before went to bed last night. I’ll look at vertex attribute too.

Thanks guys.