Traditional OpenGL vs GLSL vs CG


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?


Well, do you think the fixed-function pipeline has a future? Programmability is not even the future, it’s been established for many years now. Since GL3.1 (in 2009!) there is no fixed-function pipeline anymore. The only reason you’re not forced to use GLSL anyway is GL_ARB_compatibility…

If you think about it, using GLSL is actually more intuitive because you can look at how stuff is computed. Simple example, compare fixed-function shadow mapping in its most basic form to the GLSL approach. The former is completely nontransparent - you only know how it’s supposed to work. Fixed-function means supplying data, configuring the pipeline through API calls and let the GL do the rest when rendering. That severely limits what things you can implement and if you need some new feature you have to wait until an implementor supplies you with new extensions to do new stuff. Ever tried to implement the Cook-Torrance lighting model with fixed-function OpenGL? With shaders, you can implement a much wider array of algorithms right off the bat and while the compilers and thus the language evolves, your possibilities expand naturally on all platforms.

CG is a different language with a wider feature-set than GLSL but is only available when using NVIDIA GPUs. If you want to target only the latter than CG is probably a good choice since it brings some other neat features like a standalone shader compiler etc. However, as soon as you want to preserve hardware independence, you need to use GLSL.

Granted, good old GL2.1 has it’s appeal when it comes to very small, very simple prototypes and demos where you don’t want to use a 3rd party math library just to rotate a cube among other things. However, if you want to be serious about graphics programming with OpenGL, there is absolutely no way of passing GLSL (or CG if NV only) by.

Well, do you think the fixed-function pipeline has a future?

I would be pretty sure about that as OpenGL is the de-facto standard on pretty much every platform except ms-windows when it comes to writing 3d-apps.That is the useage-profile of opengl is far beyond the range of applications that make replacing the fixed-functionality pipeline senseful and/or necessary.

Just because the uses-cases in a lot of legacy applications may not warrant using stuff like shader image load-stores makes the fixed-function pipeline the future? Do you really believe client-side vertex arrays are the future? Or fixed function Gouraud shading? I’m currently working on an application with a complete legacy code path and I’m completely aware of why companies stick with their renderers for a long time. However, the fact that investing time and money to refactor or rewrite code is not available or that customers are not even willing to spend 50 bucks on a GL3/4 capable hardware doesn’t make legacy OpenGL the future. Period.

BTW, may I remind you that, even though a subset of core OpenGL, that the very fast moving mobile market uses GLES2 as the standard? Does GLES2 feature a fixed-function pipeline? How about WebGL?

You seriously need to invest some time researching the OpenGL ecosystem.

You take my wording. Legacy-OpenGL will surely not go away. It is too easy to reformulate the functionality using the core-profile functions. The work-shift for doing so towards the implementors of openGL instead of the users is something I do appreciate.

Legacy-OpenGL will surely not go away

I agree but programming new code in it generally results in slower executing code and restricted functionality and so is best avoided.

Thank you so much. From now on, I will begin my journey of GLSL!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.