View Full Version : Clipping Planes and Precision
04-22-2005, 06:09 AM
The OpenGL standard states that vertices that exist in a clipping plane are kept because they are >= to the plane. I am using this feature to display medical CT data. The points that exist in the plane are sometimes clipped depending on the size of the viewport. Is this some sort of floating point precision error?
04-22-2005, 11:13 AM
You should never rely on something being equal with floating point numbers. A solution is to move the clipping plane some small amount back, but then it could be that points that should be clipped will be drawn.
Another possibility is to use small quads instead of points. Then when a quad is erronously clipped, it will not be thrown away but only cut a little, which might not even be visible most of the time...
04-22-2005, 07:37 PM
Thank you for your response. I already moved the clipping plane back some and it worked well. I just felt such a fix was a bit of a hack from a software standpoint. Is there any way to force OpenGL into performing integer math instead of floating point math?
ive found with clipplanes, fragments tend to travel down a diffetrnt path, resulting in slightly different depth values, eg if u draw the same mesh twice once with clipplanes on and once with off, u will see z-fighting. the best solution is to not use clipplanes (perhaps use a texture with an alphachannel + alphatest, to say where u dont want to draw).
though with clipplanes u can use polygonoffset but personally it is a bit of a fudge
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.