Question

There are several shading languages available today like GLSL, HLSL, CG, which one to pick to keep up with the trend?

Was it helpful?

Solution

HLSL is specific to DirectX and GLSL is specific to OpenGL. There's no way to compile a GLSL shader in DirectX or a HLSL shader in OpenGL. If you were to pick one of these two you would be picking it because you chose DirectX or OpenGL.

Cg is an intermediate language created mainly by nVidia that can be compiled as both GLSL and HLSL. From what I have seen, Cg isn't quite as popular as GLSL or HLSL, but I haven't looked into it much.

All 3 have extensive guides and tutorials, pick Cg if you are planning on writing a system that can support both OpenGL and DirectX as the underlying API or pick one based on the API you choose. None of them are going to fall out of fashion any time soon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top