Clootie graphics pages

Home | Articles | Projects | Delphi | C++Builder | TMT pascal | Links | About
 

NVIDIA Cg - Delphi and C++Builder toolkit

  
NVIDIA Cg ToolKit logo

This page is dedicated to NVIDIA Cg support in Borland Delphi and C++Builder (including Borland C++). Starting from release 1.5 of Cg I've added official support for FreePascal 2.0. Here you can find headers, helper DLL's what allows NVIDIA Cg to be used with above mentioned compilers. Also samples of Cg usage are provided.

Currently Release 1.5 beta2 of NVIDIA Cg dated May-2006 is supported

Also you can find Release 1.4 (Jun-2005), Release 1.3 (Jan-2005), Release 1.2 (Feb-2004), Release 1.1 (Mar-2003) and Beta 2.1 (Sep-2002) of NVIDIA Cg Toolkit for Borland tools (with examples) at bottom of page.

NVIDIA Cg is high level C-like language for writing pixel and vertex shaders.
Delphi/C++Builder toolkit allows to use this language internaly in your programs either in DirectX or OpenGL. Cg programs are compiled internally in PixelShader/VertexShader programs under DirectX and to register combiners and VertexPrograms under OpenGL. This behaviour allows to use NVIDIA Cg language in DirectX 8.x applications on any DX8 class GPU - like ATi Radeon 8500, SiS Xabre, Matrox Parhelia, 3DLabs P10, ets. And now for DirectX9 class cards: Radeon 95xx/X800/X1xxx and GeForceFX, GeForce6, GeForce7, GeForce8 series!

Release 1.5 of the NVIDIA Cg Toolkit includes the following features and improvements:

  • OpenGL GLSL profiles
  • Direct3D9 SM3.0 profiles
  • Procedural API for Effect creation (COLLADA support)
  • Program combining for inter-program optimization
  • Rewrite of major portions of the Cg Runtime for enhanced performance
  • Cg 1.3 and 1.4 style Effects files supported
  • Cg 1.5 Beta 1 should be backward compatible with apps written against Cg 1.4.1.
  • Runtime now supports loading pre-compiled objects through runtime API (CG_OBJECT for cgCreateProgram)
Release 1.4 of the NVIDIA Cg Toolkit includes the following features and improvements:
  • Significantly improved code generation in most of the profiles
  • Complete rewrite of CgFX. CgFX now works on all platforms, and works on non-NVIDIA OpenGL drivers. Substantial documentation for CgFX will be coming in a subsequent build of Cg 1.4
  • CgFX now supports unsized arrays and Interfaces
  • Substantially faster at compiling many long shaders, especially those that make heavy use of Cg’s “Interfaces” feature
  • The Cg Runtime is now substantially faster in many cases
  • Cg 1.4 now ships with native implementations for Win32, Win64, Linux (32-bit and 64-bit), and MacOS 10.3 (Panther) and 10.4 (Tiger)

Note that some of this new functionality is currently only supported when using the CgGL OpenGL runtime library. The Direct3D-specific Cg runtime libraries currently do not support shared parameters, for example. We have also not yet provided Direct3D profiles for Shader Model 3.0.

All Cg 1.2 or Cg 1.3 programs should work with Cg 1.4 without the need to recompile the program. The compiler, runtime, and standard library changes were all made to be backward compatible. However, programs which used previous versions of CgFX will require changes, both to the calling application code, and also to the effect files.  CgFX has been completely rewritten and is now incorporated directly into the Cg Runtime libraries.

Release 1.3 of the NVIDIA Cg Toolkit includes the following features and improvements:
  • New 'vp40' profile, which enables texture sampling from within vertex programs
  • New 'fp40' profile, which provides a robust branching model in fragment programs, and support for output to multiple draw buffers (‘MRTs’)
  • Support for writing more than one color output (i.e., ‘MRTs’) in the arbfp1 and ps_2* profiles
  • New semantics to access OpenGL fixed-function state vectors from within ARB_vertex_program and ARB_fragment_program
  • New ‘-fastprecision’ option for arbfp*, fp30, and fp40 profiles, to use reduced precision storage (fp16) when appropriate.
Release 1.2 of the NVIDIA Cg Toolkit includes the following features and improvements:
  • Interfaces, a language construct that facilitates the creation of general, reconfigurable Cg programs
  • Unsized arrays
  • Parameter instances may be created and shared between multiple programs
  • Parameters may be marked as compile-time constants, leading to more efficient compiled code
  • enhancements in many other areas

In Release 1.1 of Cg Toolkit support for CgFX were added. CgFX is file format compatible with MS DirectX 9.0 Effect file 2.0. Main difference between MS and NVIDIA tools: NVIDIA CgFX allows to use FX 2.0 files not only in DirectX9 but in DirectX8 and OpenGL.

Note: You will need to download and install NVIDIA Cg toolkit (available here).

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.

NVIDIA Cg headers and libraries

Info Description
cg.zip

31-Jul-2006
819Kb
Delphi and FreePascal adaptation of NVIDIA Cg headers.

This release contains seven Direct3D examples of Cg runtime usage. Examples start from empty Direct3D device window and go up to multitexturing and vertex shaders programming.

Download it.
CBuilder_cg.zip

31-Jul-2006
18Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit.


Download it.


  
Release 1.4 of NVIDIA Cg toolkit
(deprecated and supported only for backward compatibility reasons)


NVIDIA Cg headers and libraries for Release 1.4 of toolkit

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.
Info Description
cg.zip

12-Jul-2005
42Kb
Delphi adaptation of NVIDIA Cg headers. This package also includes helper DLLs needed for implementing Direct3D deprecated Cg runtime link in Delphi and CgFX API.

Download it.
CBuilder_cg.zip

12-Jul-2005
20Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit. Also includes modified ICgFXEffect.h headers compatible with C++Builder and helper DLL needed for implementing CgFX runtime link in C++Builder.


Download it.

Samples from NVIDIA Cg toolkit

Info Description
ogl_runtime.zip

14-Mar-2003
74Kb
NVIDIA Cg OpenGL sample Cg OpenGL sample for Delphi. This sample designed for new (Release 1.0 and up) API.

Download source with EXE.


  
Release 1.3 of NVIDIA Cg toolkit
(deprecated and supported only for backward compatibility reasons)


NVIDIA Cg headers and libraries for Release 1.3 of toolkit

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.
Info Description
cg.zip

12-Mar-2005
61Kb
Delphi adaptation of NVIDIA Cg headers. This package also includes helper DLLs needed for implementing Direct3D deprecated Cg runtime link in Delphi and CgFX API.

Download it.
CBuilder_cg.zip

12-Mar-2005
42Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit. Also includes modified ICgFXEffect.h headers compatible with C++Builder and helper DLL needed for implementing CgFX runtime link in C++Builder.


Download it.


  
Release 1.2 of NVIDIA Cg toolkit
(deprecated and supported only for backward compatibility reasons)


NVIDIA Cg headers and libraries for Release 1.2 of toolkit

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.
Info Description
cg.zip

14-Mar-2004
60Kb
Delphi adaptation of NVIDIA Cg headers. This package also includes helper DLL needed for implementing CgFX API.

Download it.
CBuilder_cg.zip

14-Mar-2004
44Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit. Also includes modified ICgFXEffect.h headers compatible with C++Builder and helper DLL needed for implementing CgFX runtime link in C++Builder.


Download it.


  
Release 1.1 of NVIDIA Cg toolkit
(deprecated and supported only for backward compatibility reasons)


NVIDIA Cg headers and libraries for Release 1.1 of toolkit

Info field below contains Name / Date / Size with links to file and description field contains some notes about sample and screenshot from run-time.

NVIDIA Cg headers and libraries

Info Description
cg.zip

05-Apr-2003
183Kb
Delphi adaptation of NVIDIA Cg headers. This package also includes helper DLLs needed for implementing Direct3D deprecated Cg runtime link in Delphi and CgFX API.

Download it.
CBuilder_cg.zip

05-Apr-2002
145Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit. Also includes modified cgD3D.h headers compatible with C++Builder and helper DLL needed for implementing Direct3D deprecated Cg runtime link in C++Builder.


Download it.

Samples from NVIDIA Cg toolkit

Info Description
ogl_runtime.zip

14-Mar-2003
74Kb
NVIDIA Cg OpenGL sample Cg OpenGL sample for Delphi. This sample designed for new (Release 1.0) API.

Download source with EXE.
runtime_d3d_depr.zip

11-Jan-2003
299Kb
NVIDIA Cg DirectX sample Cg Direct3D sample (deprecated API) for Delphi. NVIDIA modified MS DirectX 8 SDK sample "VertexShader" to get this sample.
This sample uses Pixel and Vertex Shaders internally, so to see it in full mode you should either use DirectX8 compliant video-adapter or switch to reference rasterizer under debug version of DirectX SDK.
You can read read "How to compile ObjectPascal DirectX examples" page containing instructions how to compile example in Delphi.
Note: Sample uses deprecated Cg toolkit API.

Download source with EXE.
ogl_runtime_depr.zip

11-Jan-2003
97Kb
NVIDIA Cg OpenGL sample Cg OpenGL sample for Delphi (uses deprecated API).

Download source with EXE.

Direct3D examples

Info Description
DepthColoringCG.zip

14-Sep-2002
71Kb
DepthColoring image DepthColoring sample

Direct3D DepthColoring sample demonstrate how to convert depth information to color during vertex processing with help of NVIDIA Cg. Color calculation (hue channel of HSL color model) done completely in DirectX8 vertex shader, generated by NVIDIA Cg.

In addition you can look for pure DirectX8 DepthColoring sample, what use plain vertex shader assembler syntax along with other methods of depth coloring.
This sample requires DirectX 8.1 headers and libs.

Download source with EXE.


  
Beta 2.1 of NVIDIA Cg toolkit
(deprecated and supported only for backward compatibility reasons)


NVIDIA Cg headers and libraries for Beta 2.1 of toolkit

Info Description
cg_beta.zip

27-Sep-2002
199Kb
Delphi adaptation of NVIDIA Cg headers. This package also includes helper DLL's needed for implementing Cg runtime link in Delphi.

Download it.
CBuilder_cg_beta.zip

14-Dec-2002
249Kb
C++Builder libraries required to compile against NVIDIA Cg toolkit. Also includes modified cgGL.h and totaly new cgD3D.h headers compatible with C++Builder.
Note: DirectX link for C++Builder can run into MS VC RTL runtime errors without a reason.

Download it.

Samples from NVIDIA Cg toolkit for Beta 2.1 of toolkit

Info Description
runtime_d3d_beta.zip

26-Aug-2002
297Kb
NVIDIA Cg DirectX sample Cg Direct3D sample for Delphi. NVIDIA modified MS DirectX 8 SDK sample "VertexShader" to get this sample.
This sample uses Pixel and Vertex Shaders internally, so to see it in full mode you should either use DirectX8 compliant video-adapter or switch to reference rasterizer under debug version of DirectX SDK.
You can read read "How to compile ObjectPascal DirectX examples" page containing instructions how to compile example in Delphi.

Download source with EXE.
ogl_runtime_beta.zip

26-Aug-2002
96Kb
NVIDIA Cg OpenGL sample Cg OpenGL sample for Delphi.

Download source with EXE.


Please inform me of any grammar or general errors, contained on these pages, Alexey Barkovoy
Last updated: 31-Jul-2006