Jump to content
  • Advertisement
Sign in to follow this  
neverland

What are the differences and relations among Cg, GLSL and HLSL

This topic is 4523 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Nvidia's Cg, Microsoft's HLSL and OpenGL's GLSL are all high-level shader language. What are the differences and relations among the three? Which one is most widely used in games development?

Share this post


Link to post
Share on other sites
Advertisement
I'll give this one a try, probably with errors.. ;] ( I have used all three, but Cg was some time ago..)

Cg was the first of the three, it was used alot but isn't anymore, mostly due to nVidia never releasing an optimized profile for ATI:s graphics-cards..

Cg has some nifty stuff that HLSL lacks, like tracking of matrices etc.. and in GLSL you have access to most states, including matrices (and their inverse/transpose) automatically.

HLSL is used in D3D games and GLSL in OpenGL games (more and more).

GLSL is almost only usable if you have a gfx card that supports VertexShader 2.0 or above (DX9 hardware), but HLSL works fine for 1.1 hardware, and Cg works on 1.1 hardware as well (if it comes from nVidia).

Cg can be used with both OpenGL and D3D.


Hope I didn't make to many errors.. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!