Torres Mario 678-3280 AMSRL-BE-M (mtorres++at++arl.mil)
Wed, 30 Aug 95 11:15:23 MDT
Its interesting to read from various sources about what will work or not
work, should and shouldn't do. Certainly, I am learning a great deal
from all this and thought I would share what HAS worked for me, maybe I
just got lucky.
Some suggest that its not a good idea to change scene geometry or
DCS in the draw callbacks, however, I am currently updating the
position of a helicopter by updating its DCS through its preDraw callback.
I have not run into problems yet. The trick to doing this is, however,
that I have the helicopter geometry in shared memory, maybe this is what
allows it to work so well. Some were concerned about the multiprocessing
mode screwing things up by not having access to the scene geometry, but I
think that it does have access to it via the ViewState structure (in
perfly) in shared memory.
Other (bizarro) things I tried using in the draw callback include
messing with a light model (in the shared memory) to update the
illumination of the helicopter. This works (I think) good, since I can
now update real-time the illumination of a helicopter as it flies through
cloud shadows. This is achieved by setting the pfLightAmbient of the sun
to zeros (for dramatic effects), and then setting the pfLModelAmbient of the
light model to my desired intensity. Then (this is the ify part), in
order for this changes to take effect I have to pfApplyLModel. Is there
a better/another way of getting light model effects to take effect?
I realize that the best method of illuminating this helicopter is by
attaching a light to its geoset, but since this helicopter model is flt
format, its going to take me a bit more to be able to grab its gstate and
attach a light to it.
Once again, thanks to everyone for their kind contributions. If
anything else perhaps my ignorance can spark some good discussion of what
callbacks are really for and how they should be used. I've followed this
list for about a year now and have not found too much on callback
discussions on the list's log that I've kept.
What fueled me to try callbacks is that the performer manuals say:
"Draw callbacks are commonly used to place tags or change STATE while a
subgraph is being rendered."
Mario Torres
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:51 PDT