Horde3D
http://horde3d.org/forums/

GLSL vs CG
http://horde3d.org/forums/viewtopic.php?f=1&t=452
Page 1 of 1

Author:  DDd [ 03.08.2008, 04:59 ]
Post subject:  GLSL vs CG

Ok i have to admit i never used CG, i have always used opengl so i naturally also used glsl. What are the main differences between both languages, and is the code generated by CG to GLSL efficient?

I guess my question is: Is it worth it spending time learning CG if you already know GLSL? I can see how it would be efficient to just have to code one set of instructions to generate several target profiles plus hlsl code.

Author:  marciano [ 05.08.2008, 20:50 ]
Post subject:  Re: GLSL vs CG

One nice thing with CG is that the syntax is very similar (basically the same) to HLSL. So by learning the one you get the other for free. But since Horde should be as lightweight as possible it was clear that it would use "native" GLSL and not an additional library. Well, honestly I like GLSL even a bit more than HLSL but of course that is a matter of taste.

Author:  swiftcoder [ 05.08.2008, 23:40 ]
Post subject:  Re: GLSL vs CG

DDd wrote:
What are the main differences between both languages, and is the code generated by CG to GLSL efficient? I guess my question is: Is it worth it spending time learning CG if you already know GLSL? I can see how it would be efficient to just have to code one set of instructions to generate several target profiles plus hlsl code.
The differences between the languages themselves are just syntax - once you know one, you can pick up the others in a day or two.

The compilation model is a little different, mostly because CG must support multiple backends. On ATI cards, GLSL can be slightly more efficient, but on NVidia cards GLSL is implemented on top of CG (you can see this in the debug output), and should be pretty the same. This might be changing as OpenGL 3.0 shows up this September, but it might stay the same.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/