Jump to content
  • Advertisement
Sign in to follow this  
muhkuh

OpenGL opinions about cg 1.5?

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

Hello, I'm starting a new project using OpenGL/GLSL aimed to be quite platform independant. I really need an effect format for GLSL and now cg has been digged out of it's grave and supports GLSL as target profile. Rumors had it that the cg compiler didn't produce optimal code for other hardware than nvidia. Is this still true when using GLSL as target because the produced GLSL code is optimized by the OpenGL ICD later? Are there any alternative effect formats I could use? I read about ColladaFX but is it really suited to be used directly in an engine or just for exchanging FX data in the content pipeline? Thank you for your opinions. Markus

Share this post


Link to post
Share on other sites
Advertisement
the thing i like about cg is its similarity to dx hlsl, makes writting shaders easier to port. plus you can pretty much load shaders from fx composer or render monkey strait in to your game.

also i recon it compiles best on nvidia though simple because they wrote it and can optimise for thier hardware, but this is just a guess

Share this post


Link to post
Share on other sites
I agree with supagu. Cg is very similarity to HLSL which makes writting shaders easier to port.

One thing i like to add is that Cg 1.5 is still currently in beta. I havent experienced any problems so far but the documentation has alot of "To be written" comments.

Share this post


Link to post
Share on other sites
Quote:
Original post by supagu
also i recon it compiles best on nvidia though simple because they wrote it and can optimise for thier hardware, but this is just a guess


With the GLSL profile in Cg, this is no longer the case since the GLSL compiler is in the driver. We just translate to the GLSL language and let the IHV's driver do the dirty work. :) We have optimized the GLSL translation a lot so be sure to use 1.5 final now.

Share this post


Link to post
Share on other sites
A lot of that should be reduced with the new version but don't expect all redundancy to be gone. The reason is because of GL's state model. It really is GL's fault this happens, not ours.

When setting a parameter, we have to be sure the correct program for that parameter is the one bound. Since we have no way of knowing what the app is doing, the app could change to a different bound program using a GL call somewhere and if we just set the parameter anyway, you'd get an error or very wrong results. The only way to not rebind like that over and over for each parameter set is to do a glGet to make sure the bound program state hasn't changed.

With the new things we're adding to Cg right now combined with the new advancements in OpenGL, this problem will go away. A better solution is comming.

Share this post


Link to post
Share on other sites
Oh BTW, cgGL has always had this redundant binding problem. It's just the nature of GL. It just so happens that people started looking at the GL trace calls during the time 1.5 has been out which made it look like a 1.5 issue.

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!