I found a curious problem when studying frustum (or view volume) of perspective view.
Given a cube at origine, 2.0 for each edge.
A viewer at (0,0,5), looking at origine,with near plane 2.0 and far plane 20.0
Each time we press âzâ, the viewer moves 1.0 along negtive z-axis.
The question is:
When we move the viewer to (0,0,3) and (0,0,-3), we canât see the cube plane overlapped with the near plane,
but when we move the viewer to (0,0,1) and (0,0,-1), we do can see the cube plane overlapped with the near plane.
It looks like the cubeâs edge is longer than 2.0!
Why?
example is in âInteractive computer GraphicsâA Top-down Approach with OpenGL 3rdâ , cubeview.c
I donât see any problem with projection and with example you talking about. In point 3 I can see one side of cube, in point 1 - another, in point -1 again I see first side and in point -3 - second. What a problem here?
Originally posted by CWiC: I donât see any problem with projection and with example you talking about. In point 3 I can see one side of cube, in point 1 - another, in point -1 again I see first side and in point -3 - second. What a problem here?
Iâve run it many times, but at point 3 and -3, I still canât see the cube face overlapped with near plane.
maybe with some texture or change some color you will see this problem.
If the problem is that some implementations show the front face of the cube if it is mathematically exactly on the front plane and others donât, youâre relying on floating point precision to be identical among implementations.
This is deemed to fail generally (not OpenGL related). You should never expect a floating point calculation to âequalâ some other floating point value this way.
Originally posted by Relic: If the problem is that some implementations show the front face of the cube if it is mathematically exactly on the front plane and others donât, youâre relying on floating point precision to be identical among implementations.
This is deemed to fail generally (not OpenGL related). You should never expect a floating point calculation to âequalâ some other floating point value this way.
I think thatâs the piont.
thanks for everyone