Horde3D

Next-Generation Graphics Engine
It is currently 29.09.2024, 06:28

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: GLSL vs CG
PostPosted: 03.08.2008, 04:59 
Offline

Joined: 26.03.2008, 02:58
Posts: 160
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: GLSL vs CG
PostPosted: 05.08.2008, 20:50 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: GLSL vs CG
PostPosted: 05.08.2008, 23:40 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
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.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group