1) Is there a way for View Volume Clipping to catch this?
2) If it doesn't, is there an error code such as GL_INVALID_OPERATION which
is set by the perspective divide?
Thank you in advance,
John Knight
--
-----------------------------------------------------------------
kni...@netcom.com
Sunnyvale, CA
-----------------------------------------------------------------
Thus, mostly for performance reasons, OpenGL does not generate an
error when division by zero occurs or would occur. In fact, it must continue
to operate (i.e. it can't core dump) even if division by zero occurs.
So, for instance, if a normal of length zero is specified and normalization
is turned on, the results of that normalization are indeterminate,
but subsequent OpenGL operations continue as they otherwise would.
It turns out that there is nothing in the OpenGL specification that prevents
an implementation from generating an error if a divide by zero occurs
(as long as it otherwise continues to operate). But it is unlikely
that any implementations (at least for now) will choose to do this.
Mark
You are right, any point in the plane of the eye will have w = 0 after
transformation. (Note that for an orthographic projection, the plane of
the eye is the point at infinity.) In general, near clipping will remove
the singularity at the eye. Perspective division should take place after
clipping.
You can derive four pairs of planes from a projection matrix: left & right,
top & bottom, near & far, & eye & projection. Each pair applies to a
column of the matrix. The matrix determines the planes and the planes
determine the matrix. I have proved to myself that if certain conditions
are met, like the near & far planes are on the same side of the eye plane
as the projection plane, then after near clipping you are guaranteed that
all w's will be positive.
There are some famous papers by Blinn & Riesenfeld that discuss tesselation
by rational quadratics as I recall in which eye (or object) space w's are
generated which are negative. The suggestion was to clip twice, passing
all points through mirror image clip tests. I guess our recommendation in
that case would be to flip all generated points and draw twice. We're
motivated by performance, so it makes sense to put the burden of the extra
computation of the sophisticates instead of in the GL.
So if your eye space points all have w > 0, or even if your object space
points do & your viewing matrix isn't unusual enough to generate eye space
w's <= 0, then there will be no problem.
Regards, bruceh
--
John Malcolmson
(malco...@jeol.com)
|> How is the divide by zero ignored? Since it is a hardware exception on a
|> rX000 it will be raised if the process has FPE enabled.
|> Since languages like Ada always have FPE enabled and some programs require
|> FPE to be enabled to work correctly, does OpenGL turn of FPE for any and all
|> offending routines, or just check first to avoid the error?
|>
It's implementation dependent. Either of the possibilities you suggest
would work (although one has to be careful in turning off FPE that its
status can be restored to whatever it was before the OpenGL call). In
cases where the computation is done in a graphics subsystem, the
subsystem takes the error and needn't concern itself with the CPU's or
client program's FPE modes.
Mark