Jump to content
  • Advertisement
Sign in to follow this  
Bulma

OpenGL Cg or GLSL

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

I need to write some shader code in openGL, for windows platform. It is targeted for Geforce7800, and I`ll be using SM3. Which shader language do you recommend? Which one is easier to use, more stable(I saw some posts about problems with some functions in GLSL), has more features? Also, Cg has CgFX, is there something like GlslFX? Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Personally I am trying to learn NVidia Cg and CgFX. I am trying to use this for my scenegraph's material system so that I can support fallback for lower spec hardware and the CgFX techniques stuff appear to support this.

I previous created a few fragment shaders in plain Cg which was really straight forward - and I think it would have been just as easy in GLSL. But GLSL as far as I know does not support techniques etc. from a single source file.

Have a look at my material thread and hopefully there will be some feedback from others soon :)

Cheers,
Dave

Share this post


Link to post
Share on other sites
I'd like to weigh in here also; my preference so far has been GLSL only because it is not vendor-specific; which Cg may or may not be (is it?) I was concerned that some functions in Cg may not work exactly the same on non-nvidia cards but I may be wrong.

It is true that GLSL uses seperate files / structures for Vertex and Fragment shaders, but that's not a big deal for me.

Share this post


Link to post
Share on other sites
Hi,

I believe with the 1.5 public betas NVidia have released their profiles are now better supported by non-NVidia hardware. There is also a GLSL profile available. But I have never tried it on non-NVidia cards so I could not make a comparison.

Quote:

It is true that GLSL uses seperate files / structures for Vertex and Fragment shaders, but that's not a big deal for me.


Yep I can agree with that, generally its not a big deal. However, I want to supply easily packaged materials that have a fall back, and the CgFX runtime helps a lot with the automatic determination which techniques are valid. If I went down plain Cg or GLSL route I would not have this helper API to determine things like this for me.

I agree the work for each kind is probably the same because a CgFX file still contains separate shaders (potentially) for different hardware revision (just like I would have to do for GLSL).

I think there are pros and cons for each and I think I would be right in saying once you know one quite well its easy to apply your existing knowledge. Good luck with which ever one you decide.

Cheers,
dhm

Share this post


Link to post
Share on other sites
I have been working with CG only so I cant say anything about GLSL.

CG works fine on NVidia hardware and can work on ATI but I found lots of little issues when working with ATI. I spent about 2 weeks trying to get some shadowmapping code running on an ATI card that worked perfectly on NVidia.

On the other hand there is lots of resources from NVidia with good examples and code.

Just my 2 cents.

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!