Jump to content
  • Advertisement
Sign in to follow this  
superwave

OpenGL Traditional OpenGL vs GLSL vs CG

This topic is 2024 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

Hi,

 

I was just wondering which of the three is best right now?

 

I used traditional OpenGL like glBegin...glEnd. 

 

Last semester, I tried GLSL, which I think is more flexible, however, not so intuitive and very time consuming (Maybe I am not proficient)

 

One student recommend CG programming.

 

How do you think? 

 

Cheers

Share this post


Link to post
Share on other sites
Advertisement

What you're calling "traditional OpenGL" is actually deprecated functionality that is no longer likely to be supported in hardware.

 

It's important to remember that glBegin/glEnd pairs (also known as immediate mode) was always the slowest path, even in the pre-GLSL days, when use of vertex arrays would be what you would want if performance mattered to you.  Vertex arrays, by the way, are a feature going all the way back to GL1.1 in 1997 (they were even available under GL1.0 - even earlier - as an extension) so they should not be considered any kind of "new way of doing things" either.

 

It's also important to realize that you're actually talking about two different things here.  GLSL is not a replacement for glBegin/glEnd pairs and it's perfectly possible to use GLSL with glBegin/glEnd.  GLSL is a replacement for glTexEnv calls (as well as a few other things unrelated to glBegin/glEnd), and when you start trying to express any kind of moderately complex texturing setup using glTexEnv/etc you'll quickly see how much simpler a shader-based approach is (and that's not even saying anything about those things that glTexEnv/etc just flat-out cannot do).

 

Cg is just another shading language so that's a matter of personal preference (so long as you're sticking with OpenGL) more than anything else.

Share this post


Link to post
Share on other sites

GLSL works only on OpenGL, like HLSL only works for DirectX. CG is made and managed by NVIDIA and it works in Both OpenGL and DirectX. The best way to look at this is if you are making an engine where you will have both DirectX and OpenGL for your rendering and one to have a single shader code based then by all mean use CG. But if your engine is going to be specific then use either HLSL if you are going to use DirectX or use GLSL if you are going to use OpenGL.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!