Cg Examples Distributed with NVIDIA Cg Compiler 
-----------------------------------------------

In this directory, you will find a collection of basic and advanced Cg
examples for both OpenGL and Direct3D.  These examples are designed
to be simple enough give you a feel for the Cg language and runtime,
rather than to demonstrate cool effects.

Subdirectories
--------------

Note : The examples marked with (Win32) are only available on 
       Windows platforms.

OpenGL_Basic:

   A collection of Cg examples from the book "The Cg Tutorial".

   If you've read "The Cg Tutorial" but wanted to see complete ANSI C
   examples for OpenGL, look no further.

OpenGL_Advanced:

   A collection of advanced Cg examples.

   cgfx_bumpdemo -- uses an effect written as a CgFX file to implement
   the bump-mapped torus example from "The Cg Tutorial".

   cgfx_procfx -- uses the new Cg 1.5 API for procedural
   effects generation to re-implement the cgfx_bumpdemo with
   procedurally-generated effects.

Direct3D9_Basic (Win32):

   A collection of Direct3D9 examples matching the OpenGL_Basic examples.

   These examples use a version of Microsoft's DXUT called miniDXUT.

   You need to have a recent version of the Microsoft DirectX SDK
   installed and your DXSDK_DIR environment variable set to build these
   examples.

old/runtime_CgFX:

   This example shows how to load a CgFX effect file, and cycle through the
   various effects within it, by mapping them onto a teapot.

   CgFX is a very powerful way of expressing shaders, because it also allows
   the other OpenGL state to be expressed through the CgFX file, thus making
   all of the render state for an object fully self-contained in the effect.
   Applications which use CgFX files can often avoid effect-specific C/C++
   code to be written in the app, since the CgFX runtime makes all of the
   necessary OpenGL calls on the app's behalf.  This means that new effects
   can be added to your application, without having to recompile the application
   source code.

old/interfaces_ogl:

   This OpenGL example shows how to use interfaces and unsized arrays
   to implement multiple different light sources for a shader.

old/runtime_d3d: (Win32)

   Example applications that demonstrate the use of the Cg Runtime
   for Direct3D to compile Cg programs and use the compiled outputs as
   DirectX 8 and DirectX 9 vertex shaders and pixel shaders.

   You might need to fix up the paths in the project file if you have
   installed the DX SDK elsewhere.

   To build example executables, please make sure that you set the active
   configuration to build Release or Debug version of executable.

old/runtime_ogl:

   Example application that uses the Cg Runtime for OpenGL to compile
   a Cg program and use the compiled output as a vertex program through
   NV_vertex_program or ARB_vertex_program.

   Building and using the runtime examples requires that you have a
   reasonably up-to-date glext.h include file somewhere in your
   include path (in a "GL") sub-directory, i.e. we #include
   <GL/glext.h> (<OpenGL/glext.h> on OSX).

   You also need to have a copy of GLUT installed on your machine.
   GLUT is available from
   http://www.opengl.org/developers/documentation/glut.html

old/runtime_ogl_vertex_fragment:

   Example application that uses the Cg Runtime for OpenGL to compile
   Cg programs and use the compiled outputs as a vertex program and a
   fragment program.

old/simple_dx8vs

   Examples of some simple Cg programs suitable for DirectX 8-level of
   vertex shader functionality.

old/simple_dx8ps

   Examples of some simple Cg programs suitable for DirectX 8-level
   of pixel shader functionality.

Building the Examples
---------------------

Solutions and projects for various Visual Studio versions (Visual C++ 6.0,
Visual Studio .NET 2003, Visual Studio 2005) are included for Windows
users.  The Visual Studio 2005 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
programmable shading.

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 DirectX 9 runtime installed.

