Take the 2-minute tour ×

I'm a OpenGL ES 2.0 beginner and I don't understand why are different types of code for shaders. In particular, the differences between .cg and .vsh / .fsh.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Cg is a shading language owned and operated by NVIDIA. GLSL is the shading language for OpenGL. Cg works by being compiled into some form of GLSL, based on a "profile" that represents the GLSL version and shader stage type.

If you're using OpenGL ES, you should be ignoring Cg. You can't use Cg in OpenGL ES, because ES's version of GLSL has requirements that Cg can't fulfill. So if you're seeing some tutorial using Cg, ignore it.

The extension names are entirely irrelevant. Use whatever extension is clearest to you; OpenGL doesn't read files, so it's up to you to feed shader strings to glView.

share|improve this answer
add comment

If you are using the CG toolkit of Nvidia, you typically use .cg as the file extension,
but if you are using the GLSL shaders, you could use .vsh, .fsh, .frag, .vert or .glsl.

share|improve this answer
add comment

Your Answer


