Search code examples
opengldirectxglslhlslcg

Cg: Proper way to write/read from a floating point texture


I currently have a R8G8B8 floating point render target and want to use it as a R24 target. The code

//cg
out = float4(v, v, v, v);

seems to clamp out between 0 and 1.

What's the proper way to write/read to a floating point texture in Cg?


Solution

  • In OpenGL, you need to use a floating point texture format, such as R32F or RGBA32F. Then you won't get clamping. I bet it's the same in D3D.