Page 1 of 1
Cg, GLSL, and OpenGL3
Posted: Thu Mar 27, 2014 1:32 pm
by Herb
So, I'm starting to write some pretty involved shaders. I was hoping to use Cg for portability with DirectX and OpenGL, but I heard Cg was no longer being developed by nvidia on their site
here. So, what are Ogre devs planning on doing for both open source projects and commercial applications? I heard through some other ogre posts that OpenGL3 support with Ogre should be superior performance on-going compared to DirectX. This makes me think of just bagging Cg and writing everything in GLSL. Any thoughts from the community?
Re: Cg, GLSL, and OpenGL3
Posted: Sat Mar 29, 2014 1:30 am
by Herb
Was hoping for some discussion on this topic...as I can't be the first person to wrestle with it. I guess I was a bit annoyed with hearing the Cg project was abandoned, and not sure on a direction for my new project that I was targeting as cross platform. Thinking about it a bit more my options seem to be:
- 1. Write in Cg anyways, but might run into unsupported features and will have more issues with that as time goes on
- 2. Write it in GLSL, but lose DirectX support. I hear OpenGL support (performance-wise) still isn't as good as DirectX on Windows
- 3. Write it in HLSL, but lose Linux / Mac support. But maybe I could "convert" it to GLSL with what scrawl just posted here... not sure how well that would work
Sounds like OpenGL libraries (which aren't updated well with Windows by default), are typically updated when someone installs their video card drivers. So, maybe GLSL would just be the way to go. As I look for good shader reference material most seem to focus on HLSL

Anyways, anyone with some thoughts, I'd welcome them. I'd stop my rambling now

Re: Cg, GLSL, and OpenGL3
Posted: Sat Mar 29, 2014 9:13 pm
by madmarx
I still use it because I don't need the most advanced shaders.
The portability is really useful for me snice I teach, and the students might have problem one day with direct3D or opengl on their systems.
Re: Cg, GLSL, and OpenGL3
Posted: Mon Mar 31, 2014 10:42 am
by areay
Ah, that's bad news re:Nvidia stopping support. People on these forums have been prophesying its doom for a while though. Take a look at this similar query thread
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=80638
The good news is that Cg is almost identical to HLSL so you just (ha just!) need to create GLSL versions of all your shaders and then maintain them too... I think this is what they call shader hell, I shall be joining you

Re: Cg, GLSL, and OpenGL3
Posted: Mon Mar 31, 2014 11:05 am
by TheSHEEEP
Or you write OpenGL from the get-go, as that will allow the same shaders on all platforms (except Windows Phone, and probably slightly modified versions for GL ES if you need other mobile).
That is what we do with our project (desktop only, linux + windows, mac later) and we're pretty happy with it.
Re: Cg, GLSL, and OpenGL3
Posted: Mon Mar 31, 2014 6:20 pm
by Herb
Okay, sounds like GLSL might be the way to go... Is it fair to say most of the OpenGL drivers on Windows are fairly up-to-date now? Since it appears that OpenGL drivers tend to get updated when you install your video card drivers? I know in the past that was the big issue with OpenGL on the Windows platform.
Re: Cg, GLSL, and OpenGL3
Posted: Sat Apr 12, 2014 4:54 am
by Tiggilyboo
I recommend using Shiny, able to write a script once, and have it parse into GLSL/HLSL/CG.
Check it out
https://github.com/scrawl/shiny
Quick and easy to setup!

Re: Cg, GLSL, and OpenGL3
Posted: Wed Apr 23, 2014 10:55 am
by NotCamelCase
Here is a short but nice post on the problem with different approaches. My money is on #4
