Question about Nvidia's Cg

Started by OrbitalFan, July 15, 2009, 22:12:55

Previous topic - Next topic

OrbitalFan

Hi everyone, I'm new here (and to LWJGL) - so sorry if this is a stupid question:

I've always had the impression that NVidia's CG is better supported by drivers than GLSL.  Is GLSL even used by any commercial game developers?  Does intel drivers do GLSL?

Is CG even supported by LWJGL?  Is it worth it?

Thanks!

Ciardhubh

Quote from: OrbitalFan on July 15, 2009, 22:12:55
I've always had the impression that NVidia's CG is better supported by drivers than GLSL.

Graphics drivers do not run CG programs. CG is compiled to a language that can be run by the driver. For Direct X that could be (for example) HLSL. For OpenGL that would be GLSL or ARB assembly.

Quote from: OrbitalFan on July 15, 2009, 22:12:55
Is CG even supported by LWJGL?  Is it worth it?

There are CG libraries in C or C++ that compile Cg to any of its profiles at runtime. I don't know of any Java bindings or ports for these libraries; LWJGL or not. However you can compile Cg to an OpenGL profile with Cg's command line compiler. You can even compile GLSL to ARB assembly with Cg.

As far as the CgFX framework is concerned, I don't know of any ports or bindings either.

OrbitalFan

Brilliant - thanks for clearing that all up.

shatterblast

Quote from: OrbitalFan on July 15, 2009, 22:12:55
Is GLSL even used by any commercial game developers?  Does intel drivers do GLSL?

As far as commercial applications, I believe World of Warcraft, City of Heroes, and possibly the last two versions of Unreal use GLSL to different extents.  I think that the virtual environments the objects relate with usually have limits on the number of polygons when GLSL becomes active.  Intel-based graphics hardware comes to mind as one reason.  So yes, Intel does GLSL in some creative manner.

Quote from: OrbitalFan on July 15, 2009, 22:12:55
Is CG even supported by LWJGL?  Is it worth it?

While I don't represent any project other than my own, Xith supports it so I would assume LWJGL does as well.  I think it's visually worth it if you take the time to pursue it.


OrbitalFan

I found this:

http://www.opengl.org/wiki/Shading_languages:_Which_shading_language_should_I_use%3F

Each vendor having to provide their own GLSL compiler just sounds like trouble waiting to happen.

shatterblast

I don't know about the J Monkey Engine, but Xith has a test case in TerrainTest5.java that uses GLSL, which derives from inside Water.java.  I think that project has another GLSL test case, but I can't think of it at the moment.  Anyhow, TerrainTest5.java uses LWJGL.  Also, I think I read comments and opinions half a year or more ago that suggested different strengths for GLSL and Cg in their areas of performance.  By most accounts, they supposedly behave in a similar fashion for moderate amounts of data.  It didn't make sense to me at the time since they access the same API.

OrbitalFan

Quote from: Ciardhubh on July 16, 2009, 09:20:28
You can even compile GLSL to ARB assembly with Cg.

After some research, I realize now what you mean by this.  Using the command-line compiler to generate ARB assembly sounds like a very good idea.  Even intel-integrated GPUs support ARB assembly.

Thanks again.