[info-performer] pfFragmentShader question

Date view Thread view Subject view Author view

From: Benjamin Chang (bchang++at++artic.edu)
Date: 07/20/2005 02:03:28


i've been doing a little experimentation with the pfVertexProgram and
pfFragmentProgram. while i can get the vertex program to work well, the
fragment program doesn't seem to do anything at all.

the vertex program is just the basic diffuse + specular lighting calculation.
the fragment program, as a test, just tries to output flat white; but it's as if
it isn't running at all.

i'm using performer 3.2 on suse 9.2, with a geforce ti 4600. i'm using Cg,
compiling with the arbvp1 and arbfp1 profiles.

code for fragment shader:

// frag1.cg
// cgc frag1.cg -profile arbfp1 -o frag1.fp
struct vertout
{
 float4 HPosition : POSITION;
 float4 Color0 : COLOR0;
};
void main ( in vertout IN, out float4 color : COLOR )
{
  color = float4 (1.0, 1.0, 1.0, 1.0);
}

code to apply it:

fprogram = new pfFragmentProgram ();
fprogram->loadProgram("frag1.fp");
geostate->setAttr("PFSTATE_FRAGPROG,fprogram);
geostate->setMode("PFSTATE_ENFRAGPROG,PF_ON);

the geostate has a gray pfMaterial applied to it. the vertex program creates a
blue diffuse + white specular material. when i apply it, that material shows up
correctly; when i also apply the fragment program, i still just get the blue
material. when i apply only the fragment program, i get the gray material.

thanks in advance,

-- 
Ben Chang
Assistant Professor, Art and Technology Studies
School of the Art Institute of Chicago
112 S. Michigan, Chicago IL 60603
312.345.3561
bchang++at++artic.edu


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Jul 20 2005 - 02:03:42 PDT