for Linux
|
Introduction
Things to install
Examples
- NVIDIA Linux SDK
- Open Inventor
Important Webpages (more examples links)
Cg for Python
Introduction |
|
The idea of this page is give you a brief guide to use and install
everything that you need to run a Cg program. I present some examples ready to run on
Linux Machines. These examples are based on nVidia examples which come with the Cg Toolkit.
Let's begin with some questions:
Who is NVIDIA?
NVidia designs 3D graphics processors ...
|
|
What is Cg?
Cg, C for Graphics, is a high-level language which allows programmers to combine the inherent power of
the GPU (Graphics Processing Unit) with a language that makes GPU programming easy ...
|
|
Things to install |
|
Hardware
1) Linux machine (our examples were tested on RedHat 9.0)
2) Video card which supports Cg
 *Products supported (for Linux display drivers)
Software
1) OpenGL Utility Toolkit (GLUT)
2) Linux Graphics Drivers
 *Review Documentation (text file)
3) NVIDIA's Cg Toolkit for Linux
Examples |
|
|
Based on cgGL_vertex_example from NVIDIA
|
Based on cg_sinewave from NVIDIA (NVSDK)
|
|
Linear interpolation accross polygons (Gouraud shading)
cgGL_Vertex.tar.gz
|
|
Time-varying displacement of vertex position
sineWave.tar.gz
|
|
Torus suface with a procedural Bump
|
Surface of revolution and Bump Mapping texture.
|
|
Parametric torus surface implemented on vertex program and a wave Bump function on fragment program.
cg_torus_Bump.tar.gz
|
|
Parametric quadratic surface of revolution implemented on vertex program and a simple Bump Mapping texture on fragment program.
Note: it needs NVSDK libraries.
cg_drawPolynomials.tar.gz
|
About the source code
- The vgl.c and vgl.h are C source code to manipulate the basic mouse interaction (rotations, zoom ...)
in the 3D scene. This source code was taken from Tecgraf Puc-rio.
- The userData.h file is only the definition of some flags to carry out the mouse interaction. The programer
can change this code (definition) to develop other interations.
Some coments and tips.
In our examples the Cg program is loaded inside the C or C++ program in a char*
variable but the general idea is to make a Cg program file which is separed of the application.
With this idea you can change your Cg shader program without compile again your application.
You can compile your Cg shader program using the cgc compiler to be sure that the Cg program compiles without errors.
Example : $ cgc [myCgprogram.cg]
If your geometry is complex, try to apply the Cg shader first on simple shapes (such as a cube or flat grid).
NVIDIA Linux SDK
The follows examples come from NVIDIA Linux SDK, thanks Jason Allen for a great help.
For more Cg examples for Linux, you can download
(NVSDK 6.0 for Linux).
Once you've downloaded the SDK (Downloads for Linux - NVSDK 6.0 for Linux) you must build all the required libraries:
1) Compile the libraries; go to ./NVSDK/LIBS/src -> 'make'
2) Verify that there are these libraries in ./NVSDK/LIBS/lib directory:
| |
libnvio.a
libnvmath.a
libnvpng.a
|
libnvvarpdrhelper.a
libunzip.a
libnvmanip.a
|
libnvparse.a
libnvutil.a
libparamgl.a
|
3) You can go into ./NVSDK/DEMOS/OpenGL/src and any folder in there that starts with "cg_" is a Cg demo
4) Changing the Makefile
|
|
ifeq ($(OS), "Linux")
CFLAGS += -DUNIX
LFLAGS += -L/usr/X11R6/lib -lXi -lXmu -lCgGL -lCg -lglut -lGLU -lGL
endif
Note: for Linux display driver - version: 1.0-5336 (January 26, 2004) and Cg 1.2 add -lpthread
|
5) Compile the demos.
The GPU's programability do not support the same basic capabilities like the CPUs. Cg addresses this issue by
introducing the concept of language profile.
Ussing OpenGL ARB vertex program profile (NV2X vertex).
|
|
|
|
|
| cg_dispersion |
cg_dot_product_depth |
cg_grass |
cg_lights |
cg_sinewave |
|
|
|
|
|
| cg_VolumeLine |
cg_terrain |
cg_ShinySprite |
cg_vnoise |
cg_refract |
Ussing OpenGL NV30 vertex and fragment program profile
|
|
|
|
|
| cg_skin |
proctex3d |
cg_water2 |
cg_brush |
cg_eye |
For more explanation of the examples go to here
Open Inventor
This software simulates waves generated by an oscillator.
Properties of the oscillator, the medium, and the grid can be
controlled by clicking and dragging on 3D widgets in the scene.
This example was delveloped by David C. Banks
to support a multi-disciplinary graduate course titled Interactive Computational Simulation at
FSU. For more details about the software chick
here.
We decided to calculate the time-varying displacement of vertex position on the GPU using Cg vertex shader.
We also take advantages of Open Inventor
interface (3D manipulation, draggers, etc ...).
The Wave Simulator that use Cg shader require some libraries from NVIDIA Linux SDK, so it's good
idea install this version in /NVSDK/DEMOS/OpenGL/src/myDemos/cg_wave.07 ...
Did you update your old Cg source code? check this out
Important Webpages |
|
http://www.nvidia.com/
Applications: Linux
http://developer.nvidia.com/
NVSDK
Cg Toolkit for Linux
Cg Bug Reporting
More examples and papers about GPU's programing
http://www.cgshaders.org/
Mark Harris Real-Time Graphics Research
Timothy John Purcell ( Photon Mapping, Ray Tracing ... )
Aaron Lefohn ( Interactive Deformation and Visualization of Level Set Surfaces using Graphics Hardware )
Jens Krüger ( Acceleration Techniques for GPU-based Volume Rendering )
Caltech Multi-Res Modeling Group ( Sparce matrix Solvers on the GPU )
GPUs at Siggraph 2003 and more
General Purpose Computation Using Graphics Hardware
Paralelo (Cg Shader Demos)
Frustum (OpenGL examples and some shader programs)
Date: 09/25/2002 Last Update: 05/05/2004
|
|
|
|
|
|