Welcome to the Cg example source code! Here you will find a collection of Cg examples written for OpenGL and Direct3D (DirectX 9, 10 and 11). This collection of example code will be expanded in the future. Suggestions are welcome. To use this source code, make sure you have the latest version of the Cg Toolkit from http://developer.nvidia.com/object/cg_toolkit.html Cg 1.5 or later is recommended for basic examples. Some advanced examples require Cg 2.0 or Cg 3.0. You will find several categories of example code: OpenGL/basic: Find in this directory ANSI C source code for 18 OpenGL-based example applications demonstrating the use of Cg programs found in "The Cg Tutorial". In the future, this directory will have 27 example applications from "The Cg Tutorial". For information about the Cg programs, refer to their discussion in "The Cg Tutorial". OpenGL/advanced: Find in this directory ANSI C source code for 13 OpenGL-based advanced example applications. cgfx_bumpdemo demonstrates loading effects from CgFX files. cgfx_procfx demonstrates Cg 1.5's new API for procedurally generating effects. gs_-prefixed examples demonstrate geometry shaders. Direct3D9/basic: Find in this directory C++ source code for Direct3D9-based example applications demonstrating the use of Cg programs found in "The Cg Tutorial". These Direct3D examples match the OpenGL/basic examples. Direct3D9/advanced: Find in this directory Visual Studio C++ source code for Direct3D9-based advanced example applications. cgfx_bumpdemo demonstrates loading effects from CgFX files. Direct3D10/basic: Find in this directory Visual Studio C++ source code for Direct3D10-based basic example applications using Cg and CgFX. Direct3D10/advanced: Find in this directory Visual Studio C++ source code for Direct3D10-based advanced example applications using Cg and CGFX. These examples show the usage of Geometry Shaders and Parameter (constant) Buffers. Some of these examples match the OpenGL/advanced examples. Direct3D11/basic: Find in this directory Visual Studio C++ source code for Direct3D10-based basic example applications using Cg and CgFX. Direct3D11/advanced: Find in this directory Visual Studio C++ source code for Direct3D11-based advanced example applications using Cg and CGFX. These examples show the usage of Geometry Shaders and Parameter (constant) Buffers. Some of these examples match the OpenGL/advanced examples. Solutions and projects for various Visual Studio versions (Visual Studio .NET 2003, Visual Studio 2005, Visual Studio 2008) are included for Windows users. The Visual Studio 2005 and 2008 projects provide x64 configurations for building 64-bit versions of the examples. You need a 64-bit version of the Windows operating system (such as 64-bit Windows XP) to run the 64-bit examples. There are also Makefiles for GNU make provided for the OpenGL examples. Use these Makefiles for Linux, Mac OS X, and Solaris systems. These Makefiles can also work on Windows systems with the Cygwin Linux-like enviornment for Windows (http://www.cygwin.com/) installed for those without Visual Studio. The OpenGL examples require an OpenGL implementation with extensions supporting programmable shading. For building the OpenGL examples on Debian or Ubuntu Linux systems additional software packages are required as follows: make GNU make build tool gcc GNU C Compiler g++ GNU C++ Compiler libglu1-mesa-dev Mesa GLU library and headers freeglut3-dev Freeglut GLUT library and headers libxi-dev X11 XInput client library and headers libxmu-dev X11 miscellaneous utility library and headers Command line for Debian or Ubuntu: $ sudo apt-get install make gcc g++ libglu1-mesa-dev freeglut3-dev libxi-dev libxmu-dev Comand line for RedHat or Fedora: $ sudo yum install make gcc gcc-c++ mesa-libGLU-devel freeglut-devel libXi-devel libXmu-devel The Direct3D examples only build for Windows platforms. To build the Direct3D examples, you will need the Microsoft DirectX SDK installed. Download the latest version from http://msdn.microsoft.com/directx/sdk/ The DXSDK_DIR environment variable (set by the DirectX SDK installer) is used to locate the necessary DirectX headers and libraries. To run the Direct3D examples, you must have the latest DirectX runtime installed.