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.

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


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 u.hertl...@sandbox.de 写道:


发件人: Ulrich Hertlein u.hertl...@sandbox.de
主题: Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0].
收件人: OpenSceneGraph Users osg-users@lists.openscenegraph.org
日期: 2009年4月2日,周四,下午5:14


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.

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



  ___ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org