CelticDaddio
12-02-2008, 04:54 PM
In my glsl frag shader I calculate a value which is a float. I want to write it to the RGB channels of the frame buffer...
float myFloat = Calculate();
vec4 fragColor = Format(myFloat);
gl_FragData = fragColor;
fragColor.r will have 1 byte of the float, .g will have 1 byte, etc.
I have tried dinking around with converting the float to fixed point but I am not sure I am doing this right.
Has anyone tried this yet? Any pointers?
I need to do this because my rendering output is pass to a post processing app via the DVI output, and it will reassemble the rgb into the calculated float on it's end.
Thanks,
CD
float myFloat = Calculate();
vec4 fragColor = Format(myFloat);
gl_FragData = fragColor;
fragColor.r will have 1 byte of the float, .g will have 1 byte, etc.
I have tried dinking around with converting the float to fixed point but I am not sure I am doing this right.
Has anyone tried this yet? Any pointers?
I need to do this because my rendering output is pass to a post processing app via the DVI output, and it will reassemble the rgb into the calculated float on it's end.
Thanks,
CD