subroutines perpec and lookat

SCHREIBER, O. A. ccsupos%prism at GATECH.EDU
Tue Jul 25 13:31:01 AEST 1989


	
	I cannot guess why your program does not work, I can only help clarify
	what perspective and lookat do.  Perspective loads a matrix onto the
	matrix stack, destroying what was previously on top of the stack.
	Lookat multiplies a "lookat" matrix by the top of the stack and replaces
	the top of the stack with the result.  Check the GL User's Guide to see
	the exact matrices that perspective and lookat generate.
	
	In general, you probably want to use perspective and lookat together,
	doing a perspective without a lookat or a lookat without a perspective
	is probably a bug.  However, it is quite normal to load a perspective
	matrix, push it, and then apply a lookat.  To apply a new lookat,
	do a popmatrix (gets back to the perspetive) do a pushmatrix (copies it
	on the stack) and then do another lookat.
	
	Hope this clears things up.  To aid in debugging, write a routine to print
	a matrix out to the terminal, then call getmatrix and print the matrix out
	when things go awry.
	
In reference to the above help message, I have straightened out
my handling of the transformation matrices. However, the twist
given to the projection does not always correspond to the one that
is input. Has anyone ever had this problem?
Thanks in advance.
Olivier Schreiber



More information about the Comp.sys.sgi mailing list