Compiling CG to GLSL


Dark Photon posted how to compile code to glsl. I was hoping that there was a way to convert cg to glsl automatically.

you can probably do with with the nvidia CG compiler. It can convert GLSL to arb assembly and other such wonderful things.

so, how do I convert from CG to GLSL ?
I will keep searching how. But you are saying that this is possible…great!

Dark Photon posted a full command line for doing it. So use that. It’s not going to get more “automatic” than that.

that command is to compile glsl
not to convert CG to GLSL. I tried that already.

Hadn’t actually done that. But IIRC you can cross-compile Cg to GLSL with cgc as well. Something like:

cgc -profile glslv

Just tried it on this vertex shader:

you are right. thanks!