Hi,everyone, in Opengl document, it says that gluPickMatrix creates a
projection matrix that can be used to restrict drawing to a small region
of the viewport. the implementation of gluPickMatrix in the Mesa3D is
the following:
=========
void APIENTRY gluPickMatrix( GLdouble x, GLdouble y,
GLdouble width, GLdouble height,
const GLint viewport[4] )
{
GLfloat m[16];
GLfloat sx, sy;
GLfloat tx, ty;

sx = viewport[2] / width;
sy = viewport[3] / height;
tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;

#define M(row,col) m[col*4+row]
M(0,0) = sx; M(0,1) = 0.0; M(0,2) = 0.0; M(0,3) = tx;
M(1,0) = 0.0; M(1,1) = sy; M(1,2) = 0.0; M(1,3) = ty;
M(2,0) = 0.0; M(2,1) = 0.0; M(2,2) = 1.0; M(2,3) = 0.0;
M(3,0) = 0.0; M(3,1) = 0.0; M(3,2) = 0.0; M(3,3) = 1.0;
#undef M

glMultMatrixf( m );
}
==========
Thought it over for many times, I still can not understand the theory of
this implementation, I can not deduce this result.
Does anyone can explain the theory of pickmatrix function? How it works?
Can anyone give me a deduction in detail.
Thanks!!!

-- Xinlin Cao


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to