Functions to adjust the coordinate frame
mglVisualAngleCoordinates: Visual angle coordinates
purpose: Sets view transformation to correspond to visual angles (in degrees) given size and distance of display. Display must be open and have valid width and height (defined in MGL variable)
usage: mglVisualAngleCoordinates(physicalDistance,physicalSize);
argument | value |
---|---|
physicalDistance | [distance] in cm |
physicalSize | [width height] in cm |
mglOpen mglVisualAngleCoordinates(57,[16 12]);
mglScreenCoordinates: Pixel coordinate frame
purpose: Set coordinate frame so that it is in pixels with 0,0 in the top left hand corrner
usage: mglScreenCoordinates()
mglTransform: Low-level function to adjust transforms
purpose: applies view transformations
usage: mglTransform(whichMatrix, whichTransform, [whichParameters])
argument | value |
---|---|
whichMatrix | 'GL_MODELVIEW', 'GL_PROJECTION', or 'GL_TEXTURE' |
whichTransform | 'glRotate', 'glTranslate', 'glScale','glMultMatrix', 'glFrustum', 'glOrtho','glLoadMatrix', 'glLoadIdentity', 'glPushMatrix','glPopMatrix', 'glDepthRange', or 'glViewport' |
whichParameters | function-specific; see OpenGL documentation |
You can also specifiy one of GL_MODELVIEW, GL_PROJECTION, or GL_TEXTURE and a return variable current matrix values. If two outputs are specified, the result of the computation will be returned.
This function is usually not called directly, but called by mglVisualAngleCoordinates or mglScreenCoordinates to set the transforms
mglHFlip: Horizontally flip coordinates
purpose: flips coordinate frame horizontally, useful for when the display is viewed through a mirror
usage: mglHFlip()
mglOpen mglVisualAngleCoordinates(57,[16 12]); mglHFlip mglTextSet('Helvetica',32,1,0,0,0,0,0,0,0); mglTextDraw('Mirror reversed',[0 0]); mglFlush;
mglVFlip: Vertically flip coordinates
purpose: flips coordinate frame vertically
usage: mglVFlip
mglOpen mglVisualAngleCoordinates(57,[16 12]); mglVFlip mglTextSet('Helvetica',32,[1 1 1],0,0,0,0,0,0,0); mglTextDraw('Vertically flipped',[0 0]); mglFlush;