pfLightSource and texture projection

New Message Reply Date view Thread view Subject view Author view

rvandepo++at++csc.com
Thu, 11 Nov 1999 17:08:02 +1000


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;
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


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Thu Nov 11 1999 - 07:39:54 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.