[osg-users] Camera::setPreDrawCallback -> add?

Anders Backman andersb at cs.umu.se
Wed Sep 5 00:49:29 PDT 2007


Yes, thats the way we are using it now.
The problem as I see it is that if someone is adding a callback inside a
3:rd library (not uncommon), then someone can undo that by accessing the
camera and attaching their own callback.

void setupCamera(Camera *cam)
{
  cam->setPreDrawCallback(new cb);
}

setupCamera(cam);
cam->setPreDrawCallback(new myCb);

Which sort of moves the responsibility of the callbacks to the documentation
of any method that accesses the callbacks.
Mixing a bunch of libraries will then be......less easy :-)

I totally agree about keeping the API simple.

So I guess I have to stick whats there....
It was just a suggestion.

Cheers,
Anders.


On 8/31/07, Robert Osfield <robert.osfield at gmail.com> wrote:
>
> Hi Anders,
>
> There is only one callback for pre and post draw callbacks to keep the
> API as simple as possible - just two methods per callback - a get and
> set.  Once you add a list you end with add/remove/get/getnumber.
>
> One way to do multiple callbacks is to nest the callbacks, so you have
> your own CompositeCameraCallback which contains a list of Camera
> callbacks.
>
> Robert.
>
> On 8/31/07, Anders Backman <andersb at cs.umu.se> wrote:
> > Hi.
> >
> > In osgProducer there was the concept of a list of pre/post
> drawcallbacks.
> >
> > In osgViewer there can be only one.
> >
> > Is purposely done for a specific reason (performance, complexity, ..)?
> > It is not very uncommon to have several pre/post draw callbacks for a
> > viewer, and if you are developing an API where you internally to the API
> add
> > drawcallbacks, and the user of the api accesses the camera later on and
> do
> > camera->setPreDrawCallback(myCallback), well then you are
> > fried.
> >
> >
> > So could it be possible to refactor that into a list of callbacks?
> > /Anders
> > --
> >
> >
> > ________________________________________________________________
> >  Anders Backman               Email:     andersb at cs.umu.se
> >  HPC2N/VRlab                  Phone:    +46 (0)90-786 9936
> >  Umea university              Cellular: +46 (0)70-392 64 67
> >  S-901 87 UMEA SWEDEN         Fax:      +46 90-786 6126
> >                                http://www.cs.umu.se/~andersb
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 


________________________________________________________________
Anders Backman               Email:    andersb at cs.umu.se
HPC2N/VRlab                  Phone:    +46 (0)90-786 9936
Umea university              Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN         Fax:      +46 90-786 6126
                               http://www.cs.umu.se/~andersb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070905/6d726c2e/attachment-0002.htm>


More information about the osg-users mailing list