Re: [osg-users] depthbuffer question

2010-09-21 Thread Peter Wraae Marino
Hi Ulrich,

on an earlier test of the near and far plane we saw a difference of the far
and near plane values to be the size of the box.. so I assumed that the near
and far is computed to fit the objects in the scene.

or is this wrong?

Peter

On Tue, Sep 21, 2010 at 2:12 PM, Ulrich Hertlein wrote:

> Hi Peter,
>
> On 21/09/10 21:52 , Peter Wraae Marino wrote:
> > I've been trying to read some values from the DepthBuffer and I don't
> seem to get what I
> > would expect. Here is a cut down version of my code (should be able to
> run):
> >...
> > I get a value of 0.0642448 and this is not what I expect.
> > I would expect that the near and far plane are automatically computed to
> fit the box,
> > which should mean the near plane is collinear with front of the box..
> which should result
> > with a value of 0
> >
> > can someone explain to me what I'm doing wrong?
>
> The auto-computed near/far planes would fit the bounding sphere around the
> box, which is
> larger than the box itself.  Would that fit?  Maybe you're assumptions are
> off?
>
> Cheers,
> /ulrich
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Bellinge Gymnasterne: http://www.bellingegymnasterne.dk
Power Tumbling: http://www.powertumbling.dk
OSG-Help: http://osghelp.com
Personal Site: http://www.marino.dk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] depthbuffer question

2010-09-21 Thread Ulrich Hertlein
Hi Peter,

On 21/09/10 21:52 , Peter Wraae Marino wrote:
> I've been trying to read some values from the DepthBuffer and I don't seem to 
> get what I
> would expect. Here is a cut down version of my code (should be able to run):
>... 
> I get a value of 0.0642448 and this is not what I expect.
> I would expect that the near and far plane are automatically computed to fit 
> the box,
> which should mean the near plane is collinear with front of the box.. which 
> should result
> with a value of 0
> 
> can someone explain to me what I'm doing wrong?

The auto-computed near/far planes would fit the bounding sphere around the box, 
which is
larger than the box itself.  Would that fit?  Maybe you're assumptions are off?

Cheers,
/ulrich

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] depthbuffer question

2010-09-21 Thread Peter Wraae Marino
Hi osgUsers,

I've been trying to read some values from the DepthBuffer and I don't seem
to get what I would expect. Here is a cut down version of my code (should be
able to run):

class CTestDrawCallback : public osg::Camera::DrawCallback
{
public:
void operator()( const osg::Camera& cam ) const
{
osg::Image* pTest = new osg::Image;
pTest->readPixels( 256,256,1,1, GL_DEPTH_COMPONENT, GL_FLOAT );
float f = (*(float*)pTest->data());

osg::notify(osg::ALWAYS) <<
"f = " << f <<
std::endl;
}
};

osg::Node* CreateScene()
{
osg::Group* pGroup = new osg::Group;

osg::Geode* pGeode = new osg::Geode();
pGeode->addDrawable( new osg::ShapeDrawable( new
osg::Box(osg::Vec3(0.0f,0.0f,0.0f),2.0f) ) );
pGroup->addChild( pGeode );

return pGroup;
}

int _tmain(int argc, _TCHAR* argv[])
{
osg::ref_ptr rViewer;

// construct the viewer
rViewer = new osgViewer::Viewer;

// make the viewer create a 512x512 window and position it at 32, 32
rViewer->setUpViewInWindow( 32, 32, 512, 512 );

// set the scene-graph data the viewer will render
rViewer->setSceneData( CreateScene() );

rViewer->getCamera()->setPostDrawCallback( new CTestDrawCallback );

// execute main loop
return rViewer->run();
}


I get a value of 0.0642448 and this is not what I expect.
I would expect that the near and far plane are automatically computed to fit
the box, which should mean the near plane is collinear with front of the
box.. which should result with a value of 0

can someone explain to me what I'm doing wrong?

regards,
Peter Wraae Marino

-- 
Bellinge Gymnasterne: http://www.bellingegymnasterne.dk
Power Tumbling: http://www.powertumbling.dk
OSG-Help: http://osghelp.com
Personal Site: http://www.marino.dk
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org