PDA

View Full Version : ARB_color_buffer_float help



firegun9
05-21-2007, 07:30 PM
Hi,

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 );
glutSolidCube(1.0);
glColor3f( .5, .5, .5 );
glutSolidCube(1.0);

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?

Zengar
05-22-2007, 12:47 AM
You could use uniform variables...

k_szczech
05-22-2007, 01:07 AM
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.

V-man
05-22-2007, 02:56 AM
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.

Zengar
05-22-2007, 08:33 AM
I understood that he wants to pass a per-object floating-point parameter to the shader. Was I wrong?

firegun9
05-22-2007, 09:04 AM
yes, I am using floating-point texture now. My mobility 9600 supports it. :)

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

Thanks guys.