Hi Terry,

Thanks for the extra data point.  The CameraNode's viewport will be
applied in the associated RenderStage, but the Viewport in the
StateSet will be push/applied/pop as part of the drawing of leaves.
Note sure why this should make a differnce, but my best guess is that
there is an order dependency issue with setting up the FBO.

Robert.

On 8/1/06, Terry Welsh <[EMAIL PROTECTED]> wrote:
The source of this problem is still a mystery to me, but I have found
a workaround:  Changing line 128 in
examples/osgshadowtexture/CreateShadowedScene.cpp from

camera->setViewport(0,0,tex_width,tex_height);

to

camera->setViewport(0,tex_height/2,tex_width,tex_height/2);

does not work.  But if I change it to

camera->setViewport(0,0,tex_width,tex_height);
osg::Viewport* vp = new osg::Viewport(0,tex_height/2,tex_width,tex_height/2);
camera->getOrCreateStateSet()->setAttribute(vp);

it does exactly what I want it to do.  The camera's render target
implementation does not matter.  In the broken case, glViewport is
never called with the desired parameters.  I still haven't figured out
why...
--
Terry Welsh - mogumbo 'at' gmail.com
www.reallyslick.com  |  www.mogumbo.com

> Message: 7
> Date: Mon, 24 Jul 2006 08:38:45 -0700
> From: "Terry Welsh" <[EMAIL PROTECTED]>
> Subject: Re: [osg-users] CameraNode viewport problems
> To: [email protected]
> Message-ID:
>         <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Robert,
> The driver is the first thing I suspected as well.  So I modified my old fbo
> test app ( http://www.reallyslick.com/src/fbo.tar.gz ) by shrinking the
> FBO's viewport.  That demo is pure OpenGL, and uses GLEW for extension
> code.  It worked perfectly with weird viewports, so my driver is fine.  Of
> course, six months ago there easily could have been driver problems as well
> :)
>
> I'm guessing it's just some little logic problem related to how
> osg::Viewports are applied, but digging through the OSG code hasn't gotten
> me anywhere yet.  Please note that this problem isn't just restricted to
> FBO.  All the render target implementations had some problem with using
> shrunken viewports.
> - Terry
>
>
> > Message: 42
> > Date: Mon, 24 Jul 2006 09:23:10 +0100
> > From: "Robert Osfield" <[EMAIL PROTECTED]>
> > Subject: Re: [osg-users] CameraNode viewport problems
> > To: "osg users" <[email protected]>
> > Message-ID:
> >         <[EMAIL PROTECTED]>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > Hi Terry,
> >
> > I have tried to render to portions of a FBO before but always failed,
> > only using the same size viewport as the textures has only ever work
> > for me.  When I experimented with this (over six months ago) I came to
> > the conclusion that it was most like a driver restriction.
> >
> > Robert.
> >
> > On 7/24/06, Terry Welsh <[EMAIL PROTECTED]> wrote:
> > > I can't seem to get a properly rendered texture from a CameraNode if I
> > > change the viewport to be something other than the full size of the
> > texture
> > > attached to it.  For example, in
> > > osgshadowtexture/CreateShadowedScene.cpp if line 128 is
> > > changed from
> > >
> > >  camera->setViewport(0,0,tex_width,tex_height);
> > >
> > >  to
> > >
> > > camera->setViewport(0,tex_height/2,tex_width,tex_height/2);
> > >
> > >  then no image is rendered at all.  If the render target implementation
> > is
> > > set to FRAME_BUFFER then an image is rendered, but it seems to ignore
> > the
> > > viewport setting and renders to the full texture size.
> > >
> > >  Sorry I don't have a fix yet.  Was hoping somebody who knows the code
> > > better might know what is causing the trouble.  Otherwise, I can
> > probably
> > > look at this in more detail in a couple weeks....
> > > --
> > > Terry Welsh - mogumbo 'at' gmail.com
> > > www.reallyslick.com  |   www.mogumbo.com
> > > _______________________________________________
> > > 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/

Reply via email to