Re: Unapply fog...

New Message Reply Date view Thread view Subject view Author view

From: Yves Strube (czys++at++ocag.ch)
Date: 12/18/2001 23:55:58


Hi Brian,

Thanks for your answer. I solved the problem in between to be OK for my
purpose. If I call apply() once then the scene is fogged forever so I do
not have to call apply() per frame. To disable the fog I call
pfDisable(PFEN_FOG) and do a pfOverride(). But I really want to exchange
the fog object by deleteing the old one.
And I do this now as follows. After having drawn the image (called
pfFrame()) I ask for the fog object with pfGetCurFog(). If this fog
object differs from the one I got in the last frame (I store the fog
object as returned by pfGetCurFog() in a variable) then the fog changed
in between and now I am able to delete it because its reference count is
zero since the new fog object is now applied to the scene.
So assuming there is a fog object currently applied via apply(). Then
I must apply the new fog object first via apply(), then call pfFrame()
once. After having called pfFrame() the new fog object as a reference
count of 1 and the old one a reference count of 0, so that I can delete
it now. Without calling pfFrame() in between the new fog is not applied
and the reference count of the old one is therefore not decreased by
one.
So this works fine for me.

Thanks again for your answer,
Yves

Brian Furtaw wrote:
>
> Yves,
>
> Apply() is more of rendering command then a scenegraph command. You can
> add your fog object to an instance of pfEarthSky which gets attached to
> your channel.This will apply the fog for you to the entire scene every
> frame. But what you have done, I assume you are doing this in some sort
> of draw callback, should work just fine.You have to call apply() every
> frame in the draw callback in order to fog your scene. So their is no
> UnApply or Apply(NULL) because if you don't call apply() you won't get
> fog. Try that and see if it works. As far as deleteing the pfFog object
> I am not sure why you can't. Did you attach it to anything? Or are you
> simply keeping a global pointer to it in the draw callback so you can
> call apply() every frame. If you have a pfEarthSky you might want to use
> the getFog(int which=PFES_GENERAL) method to see if a pfFog object is
> attached.
>
> Brian
>
> Yves Strube wrote:
>
> > Hi all,
> >
> > How can I 'unapply' a light model or a fog object? I use pfFog::apply()
> > to apply a fog object m_pFog to the whole scene like this:
> >
> > // Override off so that changes are accepted
> > pfOverride(PFSTATE_FOG | PFSTATE_ENFOG, PF_OFF);
> >
> > // Change fog properties
> > pfEnable(PFEN_FOG);
> > m_pFog->apply();
> >
> > // Override on to apply changes
> > pfOverride(PFSTATE_FOG | PFSTATE_ENFOG, PF_ON);
> >
> > Now I would like to delete the fog object but calling
> > pfDelete(m_pFog) does not succeed since the fog object m_pFog is still
> > referenced by someone (reference count 1).
> >
> > So how do I get the reference count to zero? There is no
> > pfFog::unapply(). I also thought that calling pfApplyFog(NULL) might
> > help but this function seems not to be available when using the C++ fog
> > API?
> >
> > Thanks for any answers,
> > Yves
> >
> >
>
> --
> ----oOOo---- ----oOOo---- ----oOOo---- ----oOOo----
>
> Brian Furtaw (brian++at++sgi.com) Mailstop: DSE-2612
> Graphics Guru Office:(301)572-3293 Fax: (253)323-8182
> 12200-G Plum Orchard Drive OpenGL/Performer/OpenInventor/ImageVision
> Silver Spring, Maryland 20904 Volumizer/Optimizer/React/PCI Device Drivers

-- 

Oerlikon-Contraves AG Yves Strube, S-EMI Birchstr. 155 Email: czys++at++ocag.ch CH-8050 Zurich Phone: +41 1 316 2675 Switzerland Fax: +41 1 316 2032


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Dec 18 2001 - 23:56:11 PST

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