Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0].

2009-04-02 Thread YangXiao
Thanks ulrich I paste this code from others,and not check! --- 09年4月2日,周四, Ulrich Hertlein 写道: 发件人: Ulrich Hertlein 主题: Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0]. 收件人: "OpenSceneGraph Users" 日期: 2009年4月2日,周四,下午5:14 Hi YangXiao, On 2/4/09 3:22 PM, YangXiao

Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0].

2009-04-02 Thread Ulrich Hertlein
Hi YangXiao, On 2/4/09 3:22 PM, YangXiao wrote: z = float ( (depthBuffer->data())[i*4] ); Could it be your cast is wrong? You're only reading every fourth byte and casting that to float, which explains why you're only seeing 0-255. Try "z = ((float*) depthBuffer->data())[i];" instead. /ul

[osg-users] Depth buffer data is not clamp to [0.0,1.0].

2009-04-01 Thread YangXiao
Hi everyone:  Here is My code:   depthBuffer->allocateImage(width, height, 1,GL_DEPTH_COMPONENT,GL_FLOAT);   viewer.getCamera()->setPostDrawCallback( new ScreenShotCallback());    while (!viewer.done())  {     viewer.getCamera()->attach(osg::Camera::DEPTH_BUFFER, depthBuffer);      viewer.frame();