Hi Robert,
switching off all camera manipulators does not make disappear the
jitter. I create my viewer with
viewer->setUpViewer(osgProducer::Viewer::NO_EVENT_HANDLERS |
osgProducer::Viewer::HEAD_LIGHT_SOURCE) and do not add any camera
manipulators elsewhere. But I get the same unlovely effect when I move
the window. Is there another possibility? What else could I try?
Tommes
2007/6/4, Robert Osfield <[EMAIL PROTECTED]>:
Hi Tommes,
The jitter you see is most likely down to the viewer's camera
manipulator fighting with the Producer Camera's view matrix. If you
want to set the view matrix yourself then you'll need to switch off
the Viewer's default camera manipulators. Use options mask in the
Viewer::setUpViewer(options) to select what facilities you need.
Robert.
On 6/4/07, Tommes <[EMAIL PROTECTED]> wrote:
> Hi Robert, hi Chase,
>
> thank you very much for your fast response! And yes, I'm developing a
> Win32 application.
>
> Adapting the window resize behavior in my
> MyGUIEventHandler::handle(ea,us) method works fine. Or should I move
> this in the main Producer event loop (somewhere between
> viewer->sync(), viewer->update(), and viewer->frame())?
>
> I tried to adapt the window move behavior in the same way, but this
> produces a kind of jitter as long as I move the window. It looks as
> though the scene is moved/rendered in the common way first and
> "corrected" by my handle() routine afterwards. How can I avoid this or
> is there another reason for this?
>
> For horizontal movements I use the following code:
>
> if ( ea.getEventType() == osgGA::GUIEventAdapter::FRAME )
> {
> ...
> Producer::Camera* cam = _viewer->getCamera(0);
> cam->getRenderSurface()->getWindowRectangle(x, y, width, height);
>
> if(_width != width) {
> // Get matrix as view frustum
> Producer::Matrix prodMatrix(_cam->getProjectionMatrix());
> osg::Matrixd osgMatrix(osg::Matrix(prodMatrix.ptr()));
> osgMatrix.getFrustum(left, right, bottom, top, near, far);
> // Calculate differences and set new view frustum
> sizeDiff = width - _width;
> frustDiff = sizeDiff/_width * (right-left);
> _cam->setLensFrustum(left, right+frustDiff, bottom, top, near, far);
> }
> ...
> }
>
> Tommes.
>
>
> 2007/6/4, Bradford, Chase <[EMAIL PROTECTED]>:
> > If this is for a Win32 application, the code in Producer (not
> > osgProducer) that processes WM_SIZE events and triggers the callback to
> > add the resize event to osgGA's event queue is currently commented out.
> > When I uncomment it and rebuild Producer, mouse coordinate tracking gets
> > messed up because the coordinates are normalized inside the Producer
> > event processor and again in the osgGA, but as long as a resize event is
> > never dispatched, osgGA assumes the window is a 1x1 screen.
> >
> > Chase
> >
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:osg-users-
> > > [EMAIL PROTECTED] On Behalf Of Robert Osfield
> > > Sent: Monday, June 04, 2007 3:54 AM
> > > To: osg users
> > > Subject: Re: [osg-users] osgProducer::Viewer - Window resize events
> > >
> > > Hi Tommes,
> > >
> > > Producer does not generate resize events, it catches them internally
> > > and tracks. On each new frame you can query the window dimensions and
> > > do what you want with it. There are also some controls for the aspect
> > > ratio of the camera lens that you could try out.
> > >
> > > Alternatively you could look at the new osgViewer library, it does
> > > pass on window resize events that you can catch by attaching the event
> > > handling to the viewer. The Camera's on the window being resized will
> > > also be automatically be resized like in Producer, and there are also
> > > controls of how the projection matrix is adjusted on resize.
> > >
> > > Robert.
> > >
> > > On 6/4/07, Tommes <[EMAIL PROTECTED]> wrote:
> > > > Hello,
> > > >
> > > > I need to handle window resize events in my application, which is
> > > > based on osgProducer::Viewer. I want to avoid the viewer from
> > > > automatically scaling the scene to fit in the new window (for
> > example
> > > > when toggling from fullscreen to window mode). What's the best way
> > to
> > > > do this?
> > > > Where does Producer handle this event? Or is this done by the OS?
> > > >
> > > > Any advices appreciated.
> > > > Tommes
> > > > _______________________________________________
> > > > osg-users mailing list
> > > > [email protected]
> > > > http://openscenegraph.net/mailman/listinfo/osg-users
> > > > http://www.openscenegraph.org/
> > > >
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
> > > http://openscenegraph.net/mailman/listinfo/osg-users
> > > http://www.openscenegraph.org/
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://openscenegraph.net/mailman/listinfo/osg-users
> > http://www.openscenegraph.org/
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/