Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > 0243c8b7bca94179c78b9bd6ac76c033 > files > 577

cg-examples-3.0.0018-0.1.x86_64.rpm

// These pass-through vertex, geometry, and fragment programs are 
// used by gs_simple.c

// Vertex pass-through program for 2D positions with color
void vertex_passthru(float2 position  : POSITION,
                     float4 color     : COLOR,
                     
                 out float4 oPosition : POSITION,
                 out float4 oColor    : COLOR)
{
  oPosition = float4(position,0,1);
  oColor    = color;
}

// Geometry pass-through program for colored triangles
TRIANGLE void geometry_passthru(AttribArray<float4> position : POSITION,
                                AttribArray<float4> color    : COLOR)
{
  for (int i=0; i<position.length; i++) {
    emitVertex(position[i], color[i]);
  }
}

// Fragment pass-through program
float4 fragment_passthru(float4 color : COLOR) : COLOR
{
  return color;
}