/usr/share/psychtoolbox-3/PsychOpenGL/moglStereoProjection.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | function moglStereoProjection(left, top, right, bottom, near, far, zero_plane, dist, eye)
% moglStereoProjection(left, top, right, bottom, near, far, zero_plane, dist, eye)
%
% Set up the stereo projection matrices for binocular stereo projection.
% Taken verbatim from Quoc Vuong's class on Computer Graphics for Vision Research,
% http://www.kyb.mpg.de/bu/people/qvuong/CGV05.html
%
% Requires: glMatrixMode(GL.PROJECTION) being set before call. Backup your
% matrices if you need'em later!
%
%
%
% Perform the perspective projection for one eye's subfield.
%
% The projection is in the direction of the negative z-axis.
%
% [default: -6.0, 6.0, -4.8, 4.8]
% left, right, bottom, top = the coordinate range, in the plane of zero parallax setting,
% which will be displayed on the screen.
%
% The ratio between (right-left) and (top-bottom) should equal the aspect
% ratio of the display.
%
% [default: 6.0, -6.0]
% near, far = the z-coordinate values of the clipping planes.
%
% [default: 0.0]
% zero_plane = the z-coordinate of the plane of zero parallax setting.
%
% [default: 14.5]
% dist = the distance from the center of projection to the plane of zero parallax.
%
% [default: -0.3]
% eye = half the eye separation; positive for the right eye subfield,
% negative for the left eye subfield.
%
dx = right - left;
dy = top - bottom;
xmid = (right + left) / 2.0;
ymid = (top + bottom) / 2.0;
clip_near = dist + zero_plane - near;
clip_far = dist + zero_plane - far;
n_over_d = clip_near / dist;
topw = n_over_d * dy / 2.0;
bottomw = -topw;
rightw = n_over_d * (dx / 2.0 - eye);
leftw = n_over_d *(-dx / 2.0 - eye);
%// Create a fustrum, and shift it off axis
%// glTranslate() applies to PROJECTION matrix
glLoadIdentity();
glFrustum(leftw, rightw, bottomw, topw, clip_near, clip_far);
glTranslatef(-xmid - eye, -ymid, -zero_plane -dist);
return;
|