PDA

View Full Version : Precision of gluUnproject



Rong Yao
01-29-2004, 12:20 PM
Anyone can tell me the precision of gluUnproject? I find the return values of the function are not so precise, especially when you rotate, scale the image(I did not try translation). Is there anyone who has the similar expenence? Or it is the problem of my program?

mikael_aronsson
01-29-2004, 09:49 PM
Most OpenGL hardware use float (32 bits) for all vertices and normals.

But it may also be the z values, this depends on the depth buffer resolution, and this in turn depends on the near/far clipping plane ratio.

Mikael

Rong Yao
01-30-2004, 06:33 AM
Thanks a lot!
I change my z-buffer depth from 8 bits to 32 bits, it makes obvious improvement, but it is still not perfect. I also change the near/far clipping ratio, no matter increase or decrease, it makes no improvement. Any new suggestions?


Originally posted by mikael_aronsson:
Most OpenGL hardware use float (32 bits) for all vertices and normals.

But it may also be the z values, this depends on the depth buffer resolution, and this in turn depends on the near/far clipping plane ratio.

Mikael



[This message has been edited by Rong Yao (edited 01-30-2004).]

McWare
01-30-2004, 09:29 AM
gluUnProject is specifically designed to function between depth values of 0.0 and 1.0.
If you need more resolution, then adjust the depth field with glDepthRange(GLclampd near, GLclampd far), and use gluUnProject4().

It's designed to handle depth coordinates outside 0.0 - 1.0

Hope that helps

Rong Yao
02-02-2004, 06:23 AM
Thanks! Which library should I use for
gluUnProject4()? It looks like my current compiler does not like it.


Originally posted by McWare:
gluUnProject is specifically designed to function between depth values of 0.0 and 1.0.
If you need more resolution, then adjust the depth field with glDepthRange(GLclampd near, GLclampd far), and use gluUnProject4().

It's designed to handle depth coordinates outside 0.0 - 1.0

Hope that helps