Brian Furtaw (brian++at++sgi.com)
Thu, 11 Nov 1999 12:10:11 -0500
Notice they us fog in the manpage to attenuate the light source once you
get the light working you could try playing with that.
One question though what graphics hardware are you rendering this on?
Brian
rvandepo++at++csc.com wrote:
>
> I am currently implementing a pfLightSource with texture projection enabled. I
> am following the example given in the man page but can't get the thing to work;
> the entire scene gets darker and the projected texture is vaguely visible for a
> split second at start up. Perhaps somebody has some idea what is going on; a
> code example will be appreciated too!
>
> Any feedback would be welcome!
>
> Thanks,
>
> Rene
>
> -----
>
> The code I have been using is given below
>
> tex = new pfTexture;
> tex->loadFile("spotlight.inta");
>
> frust = new pfFrustum;
> frust->makeSimple(60.0f);
> frust->setNearFar(1.0f, 1000.0f);
>
> lamp = new pfLightSource;
You realize the line below has a syntax error it should be....
lamp->setAttr(PFLS_PROJ_TEX, tex);
> lamp->setAttr(PFLS_PROJ_TEX. tex);
> lamp->setAttr(PFLS_PROJ_FRUST, frust);
> lamp->setMode(PFLS_PROJTEX_ENABLE, 1);
> lamp->setPos(0.0f, 0.0f, 1.0f, 1.0f); // w = 1.0f for local light
> lamp->setDir(0.0f, 1.0f, -1.0f); // I tried a few combinations
>
> dcs = new pfDCS;
> dcs->addChild(lamp);
> scene->addChild(dcs);
>
> dcs->setCoord(coord); // coord is a pfCoord with the eye point coordinates
>
> lm = new pfLightModel;
> lm->setLocal(PF_ON);
> lm->apply();
> //pfOverride(PFSTATE_LIGHTMODEL, PF_ON);
>
> pfEnable(PFEN_LIGHTING);
> //pfOverride(PFSTATE_ENLIGHTING, PF_ON);
>
> // Modelview matrix corresponds to a view in the y direction
> // pfMaterial has been applied
> // Geometry has got normals
>
> lamp->on();
>
> Draw scene
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
--
----oOOo---- ----oOOo---- ----oOOo---- ----oOOo----
Brian Furtaw (brian++at++sgi.com)
Graphics Guru Office:(301)572-3293 Fax: (301)572-3280
12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision
Silver Spring, Maryland 20904 Optimizer/React/PCI Device Drivers
This archive was generated by hypermail 2.0b2 on Thu Nov 11 1999 - 09:16:24 PST