Last Ray of Hope Home of Kaluriel Hargrove

13Apr/09Off

Cg/HLSL Saturate

I've been converting my Cg shaders I wrote for my AGT work in university into GLSL, however I came by an annoying problem, Cg uses a function that doesn't exist in GLSL, but does exist in HLSL. I eventually found documentation on what it does and so looked up the GLSL equivilant. The Cg version shown below...

float3 outValue = saturate( inValue );

Becomes the following when converted to GLSL...

vec3 outValue = clamp( inValue, 0.0, 1.0 );

 

Thought this might be useful for others who might be having the same problem.

Tagged as: , , No Comments