The Cg Toolkit is a legacy NVIDIA toolkit no longer under active development or support. Cg 3.1 is our last release and while we continue to make it available to developers, we do not recommend using it in new development projects because future hardware features may not be supported.
NVIDIA was proud to introduce programmable shading with Cg, which supported dozens of different OpenGL and DirectX profile targets. It allowed developers to incorporate interactive effects within 3D applications and share them among other Cg applications, across graphics APIs, and most operating systems (Windows XP, Vista and Windows 7, Mac OS X for Leopard, Snow Leopard & Lion, Linux 32-bit & 64-bit) as well as balance effect complexities with client GPU capabilities.
Going forward, we recommend new development with GLSL, or HLSL for Windows applications, rather than Cg.
C for Graphics. Cg is the high-level GPU shader authoring language designed, developed and implemented by NVIDIA.
The Cg Language Specification is published and open in the sense that other vendors may implement products based on it.
Cg layers on top of OpenGL, DirectX 9, 10 or 11.
The Cg compiler outputs assembly, GLSL or HLSL code in various formats supported by OpenGL or DirectX.
Cg is a GPU shading language. A shading language is a type of programming language that tells the GPU how to shade pixels. The main program will still be written in C, C++, C#, Java, Python or other CPU programming language.
The Cg language has a syntax and grammar suitable for real-time programmable GPUs.
A Cg compiler is an application that accepts Cg language input, and produces output in one of the assembly language, GLSL or HLSL formats that are accepted by modern GPUs.
NVIDIA provides developers with the NVIDIA Cg Toolkit, comprising of:
Yes, the NVIDIA Cg Compiler aggressively optimizes shaders for multiple target GPU architectures.
Download the current release of the Cg Toolkit.