Using CG

I am interested in CG, in particular vertex programs. for example:


struct appin
{
    float3 position  : POSITION;
    float3 normal    : NORMAL;
    float2 texcoord0 : TEXCOORD0;
};

struct vertout
{
      float4 position  : POSITION;
      float4 color0    : COLOR0;
    float2 texcoord0 : TEXCOORD0;
};

//-----------------------------------------------------------------------------
// IN                  = Incoming per-vertex data to be processed
// modelViewProjection = Combined model-view-projection matrix
// currentAngle        = A value that goes from 0 to 360 and repeats
//-----------------------------------------------------------------------------
vertout main( appin IN, 
              uniform float4x4 modelViewProjection,
              uniform float4 currentAngle )
{
      vertout OUT;

      float4 v = float4( IN.position.x, IN.position.y, IN.position.z, 1.0f );
    
   
    v.y  = sin( IN.position.x + currentAngle.x );
    v.y += sin( IN.position.z + currentAngle.x );
    v.y *= IN.position.x * 0.08f;

      OUT.position = mul( modelViewProjection, v );

    OUT.color0    = float4( 1.0f, 1.0f, 1.0f, 1.0f );
      OUT.texcoord0 = IN.texcoord0;

      return OUT;
}


So question… what platforms are CG supported? What versions of opengl is it supported?

Is this something I can hope to use on win, linux and max across a variety of cards which are Geforce II and equivelent ATI?

Anyone have any experience using CG?

With certainty I can say that the Mac platform currently has no Cg runtime and nVidia has been dragging their feet about it. Last I checked, there was fairly strong support for Cg under Linux.

well i been messing with the Cg. all abit mad if u ask me. i wouldnt make anything at this time - unless its just messing around.

Cg on my PC laptop GF2Go 460 has only a handful of Cg power. My DeskTop PC has a stack load but not all of um and thats a GFTi48000 so i guess thats abit poor. i havnt got a GFFX coss it sucks. but i bet it can do the Cg action to the max. ATI is not in the Cg as far as i can tell. When it comes to Apple Mac - i thought all u needed was a GF Card?

so all in a Cg rocks - but noone has the the cool effects u would want on there cards cap yet. worth a look mind. if u want to play with um- get the CgSDK it has a cool Browser where u can check out what your card can do. and see the Cg code that did there effects.

To avoid relying on Cg you could just offline compile your programs and use ARB_vertex_program, available in newer drivers. It’s only hardware supported from gf3 and up, not sure about ati.

  • elias