Jump to content
  • Advertisement
Sign in to follow this  
mlt

OpenGL OpenGL = software, Cg = hardware?

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

As I understand code written in OpenGL is executed in software while code written in Cg is executed in hardware (on the GPU). Further is it true that everything made in Cg can also be made in OpenGL but its just faster when written/executed in Cg?

Share this post


Link to post
Share on other sites
Advertisement
Firstly, Cg and OpenGL are different things. Cg is a shading language and OpenGL is a Graphics API. i.e. Cg is code that is run on the graphics card for each vertex/pixel while OpenGL is what copies the information onto the graphics card and sets up render states etc for Cg to use. what you could be confusing it with is GLSL - a shader language for OpenGL.
If that is the case then on NVIDIA hardware (who make Cg) GLSL is converted to Cg first but is still compiled using the same compiler. So GLSL and Cg are basically the same on NVIDIA cards.
Hope this helps clear things up a bit - now go google :P

Share this post


Link to post
Share on other sites
both opengl + cg use the hardware when available, though opengl also has a software fallback if the hardware aint capable (though noone uses it)

glsl + cg will run at the same speed if youre doing the same thing on each

Share this post


Link to post
Share on other sites
What they said ^^

However, if you are referring to numerical operations (such as multiplying floating points), they are run on hardware in shader languages. If you implement OpenGL with C/C++, any such operations you do in your non-shader code will run on software. For example, if you calculate per-pixel lighting in C, it will run much slower (and be more complicated) than if you implemented it using a fragment shader.

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!