[comp.sys.sgi] Replacing the perspective matrix.

bruceh@brushwud.asd.sgi.com (Bruce R. Holloway) (06/27/90)

In article <62846@sgi.sgi.com>, tarolli@riva.esd.sgi.com (Gary Tarolli) writes:
> In article <696@celia.UUCP>, keith@celia.UUCP (Keith Goldfarb) writes:
> > 
> > What I want to do is to replace the current projection matrix
> > (while in viewing mode) with one of my choosing with a call
> > like loadmatrix().  Does such a call exist?
> 
> The way to do this is to get into MPROJECTION mode, using
> 
> 	mmode(MPROJECTION);
> 
> and then use loadmatrix, and return to the previous mmode.  In MVIEWING
> mode, loadmatrix will load the model-view matrix, so that is why you must
> get into MPROJECTION mode.  This should work, but there may be a bug on
> the GT/GTX machines (I think this was reported and fixed in the just
> released 3.3 version).

Gary is correct, except that the bug was replicated in the original
Personal Iris graphics.  I think this is the 4D/20 model only.

Even though the PI & GT were fixed in 3.3 so that Gary's advice will work,
there are still some limitations on the projection matrix you load.
Basically, there can be no rotation in the projection matrix & any
plane of projection must intersect only the z-axis.  The matrices
created by the GL calls which set the projection matrix all qualify.

If you find it really necessary to load a more general projection matrix,
you may report a bug.  (I can't guarantee to fix it!)  The GT graphics
has been out for over two years & only one customer ever complained.
He was satisfied with the 3.3 version.  To the best of my knowledge,
the new VGX graphics will handle a fully general projection matrix.

Feel free to email me if you have further questions.  There is a five-
page technical report that is about 90% complete, but it was sort of
written for internal consumption.

Regards, bruceh

thant@horus.esd.sgi.com (Thant Tessman) (06/27/90)

In article <696@celia.UUCP>, keith@celia.UUCP (Keith Goldfarb) writes:
> The perspective() call will load a matrix onto the transformation
> stack if in single matrix mode or replace the current projection
> matrix if in viewing mode.  The loadmatrix() call will load a
> matrix onto the transformation stack no matter what the mode.
> 
> What I want to do is to replace the current projection matrix
> (while in viewing mode) with one of my choosing with a call
> like loadmatrix().  Does such a call exist?

I don't think switching between MPROJECTION and MVIEWING changes
the values in the matrices.  (Only going into MSINGLE does that.)
So I think you can just say:

	mmode(MPROJECTION);
	loadmatrix(m);
	mmode(MVIEWING);

Not having actually done this myself, I don't guarantee
the validity of this information, but I think its right.

thant

"Ask not for whom the booth tolls..."