pfLightOn in node draw-Callbacks

New Message Reply Date view Thread view Subject view Author view

Ekkehard Klaerner (EK++at++AITEC.de)
Fri, 4 Nov 1994 11:48:34 GMT+1


> From: jrohlf++at++tubes.asd.sgi.com (John Rohlf)
> Subject: Re: pfLightSource
> To: guest++at++holodeck.asd.sgi.com (Ekkehard Klaerner)
> Date sent: Thu, 3 Nov 94 13:01:17 PST
> Copies to: info-performer++at++sgi.com

> > 3) Another solution could be to illuminate just certain objects of the
> > scene. To get this I wrote another nodeDrawCallback-function for a
> > certain object (node), where I switch the respective lightsources
> > on. These are the sources of the pre- und post-callback:
> >
> > /* Pre Node DRAW Callback for lighting */
> > long preDrawLight(pfTraverser *trav, void *data)
> > {
> > pfVec3 xyz, hpr;
> >
> > int i;
> > userNodeDataTyp *myData =
> > (userNodeDataTyp*)pfGetUserData(pfGetTravNode(trav));
> > ASSERT(myData);
> >
> > pfPushIdentMatrix();
> >
> > for (i=0; i<shared->nSpotLs; i++) {
> > pfLightPos(shared->spotLs[i],0,0,0,1); // for testing
> > pfLightOn(shared->spotLs[i]);
> > }
> >
> > pfPopMatrix();
> > /* normal continue */
> > return(PFTRAV_CONT);
> > }
> >
> > /* Post Node Draw Callback */
> > long postDrawLight(pfTraverser *trav, void *data)
> > {
> > int i;
> > for (i=0; i<shared->nSpotLsAll; i++) {
> > pfLightOff(shared->spotLs[i]);
> > }
> > // pfPopMatrix();
> > return(PFTRAV_CONT);
> > }
> >
> > Unfortunately, this solution is working just like a headlight,
> > because the lightsource is moving depending on the viewer-position.
> > If I move the pfPopMatrix to the PostNodeCallBack-function, the
> > node is not rendered, which is understandable. Is there any chance to
> > solve the problem with the method above ? I suppose pfLightOn is
> > not of any use in nodeDrawCallbacks at all. If so, is there an other
> > way to illuminate certain objects only, except modifying the
> > pfGStateAttr ?
>
> John wrote:
>
> This callback method will work if you have the appropriate
> ModelView matrix set up. If you don't want headlight mode, then
> don't load an identity matrix - leave the ModelView matrix alone.
>
>
> Another option is to set the PFSTATE_LIGHTS attribute of
> your pfGeoStates. Just call pfGStateAttr and pass it an array of
> pfLights that you wish to use.
>
>
Hallo John,
Thanks for your reply.
Your first suggestion sounds interesting, but in that case the
current ModelView matrix is on the stack and the spotlight then is
at that positition. Instead of that, is it possible to place a
spotlight in absolut world coordinates independent from the
ModelView matrix in the nodeDrawCallback ? We need it for static
lights in the scene. The position of the spotlight is not
necessaryly the same as the position of the node in the callback.

Another try was to use pfLightSource instead of pfLight, but there
was absolutely no effect of pfLightOff and pfLightOn. Are these
functions ignored in nodeDrawCallbacks ?

Thanks,

Ekki

AITEC GmbH & CO Informationstechnologie KG
Ekkehard Klaerner
Alter Hellweg 50
D-44379 Dortmund
GERMANY
Tel.: +49 231 9646545
Fax.: +49 231 9646598
EMail: ek++at++aitec.de


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:39 PDT

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