Differences

This shows you the differences between two versions of the page.

Link to this comparison view

shared:software [2008/10/12 20:51]
shared:software [2008/10/21 18:51]
Line 1: Line 1:
-====== MGL ======+====== MGL Getting Started ​======
  
-Mgl is a suite of mex/m files for displaying psychophysics stimuli in Matlab. 
-Runs on Mac OS X (G4/5 and Intel) and Linux. Version 1.10 
-====== ​ A quick overview ​ ====== 
- 
-mgl is a set of matlab functions for dispalying full screen visual stimuli 
-from matlab. It is based on OpenGL functions, but abstracts these into 
-more simple functions that can be used to code various kinds of visual 
-stimuli. It can be used on both Linux and Mac OS X systems. Stimuli can 
-be displayed full screen or in a window (helpful for debugging on a system 
-that only has one display). With a single command that specifies the 
-distance to and size of a monitor, the coordinate system can be specified 
-in degrees of visual angle, thus obviating the need to explicitly convert 
-from the natural coordinate frame of psychophysics experiments into 
-pixels. The best way to see whether it will be useful to you is to try 
-out the mglTest programs (see 1.2 below) and also the sample experiment 
-testExperiment. A basic "hello world" program can be written in four lines: 
- 
-Open the screen, 0 specifies to draw in a window. 1 would be full screen ​ 
-in the main display, 2 would be full screen in a secondary display, etc... ​ 
- 
-  >> mglOpen(0); 
- 
-Select the coordinate frame for drawing (e.g. for a monitor 57 cm away, 
-which has width and height of 16 and 12 cm).  
- 
-  >> mglVisualAngleCoordinates(57,​[[16|12]]);​ 
- 
-draw the text in the center (i.e. at 0,0) 
-  >> mglTextDraw('​Hello World!',​[[0|0]]);​ 
- 
-The above is drawn on the back-buffer of the double-buffered display so to make it show up you flush the display (this function will wait till the end of the screen refresh) 
-  >> mglFlush; 
- 
-To close an open screen: 
-  >> mglClose; 
- 
-====== ​ Download ​ ====== 
- 
-=====  Internal Users  ===== 
- 
-mgl is available from the following directory. This will always be the latest stable version. 
-  
- /​share/​wotan/​heegerlab/​mgl 
- 
-=====  Internal Users who wish to make changes to the code  ===== 
- 
-You can use CVS to checkout a version that you can modify yourself. ​ 
- 
- > cvs -d ~justin/src checkout mgl 
- 
-If you want to make changes only to the stable version: 
- 
- > cvs -d ~justin/src checkout -r v1_10 mgl 
- 
-Note that changes to the stable version should only be made to fix bugs. If you make a change to the stable version, make sure to make the corresponding change to the development version. 
- 
-You may also access the code repository via the web by adding the following to your .cshrc.mine file 
- 
- -for csh or tcsh shell: 
- ​setenv CVSROOT :​ext:​justin@cns.nyu.edu:/​users/​justin/​src 
- ​setenv CVS_RSH ssh 
- 
- -for bash shell: 
- ​export CVSROOT=:​ext:​justin@cns.nyu.edu:/​users/​justin/​src 
- ​export CVS_RSH=ssh 
- 
-You will need to change justin@cns.nyu.edu to your own login. 
- 
-Also, you will need to have the cvs binary somewhere in your path on your account. You can copy the cvs binary from 
- 
- ​~justin/​bin/​cvs 
- 
-====  Latest MGL version ​ ==== 
- 
-To make sure you have the latest mgl version cd to your local folder of mgl and type: 
- 
- cvs update 
- 
-=====  External Users  ===== 
- 
-Click on the following link to receive a tar/zip file of the current stable version: 
- 
-[[http://​www.cns.nyu.edu/​~justin/​mgl.tar.gz|mgl.tar.gz]] 
- 
-After downloading you can just click on the tar file and it should expand itself or from a command line do: 
- 
- ​gunzip mgl.tar.gz 
- tar xfv mgl.tar 
- 
-to extract the files. 
- 
-====== ​ Initial setup  ====== 
- 
-Simply add the mgl directory to your path, and you are ready to go. 
- 
- >>​ addpath(genpath('​MYPATH/​mgl'​));​ 
- 
-where MYPATH should be replaced by the path to your version of mgl. 
- 
-You can see what functions are available by doing (in matlab): 
- 
- >>​ help mgl 
- 
-There are a bunch of test programs (names start with mglTest) that you can 
-use to test the distribution and see how things are done. 
- 
-If you want to run under linux, then you will need to compile the distribution,​ using mglMake (see below). 
- 
-You may also need to recompile the distribution for your system if you are running an older version of matlab (we run Matlab 7.3 on Mac OS 10.4.8). We have found that mex files created on Matlab 7.3 do not run on matlab 14.1 for instance (if you run -nojvm you will see that it complains that it cannot find a dynamic link library for the mx functions--if you run with the matlab desktop it will just crash the system). If this happens to you simply recompile and you should be good to go. 
- 
-====== ​ What is in the mgl distribution ​ ====== 
- 
-  * mgl/mgllib: The main distribution that has all functions for displaying to the screen. 
-  * mgl/task: A set of higher level routines that set up a structure for running tasks and trials. Relies on functions in mgl/mgllib. You do no need to use any of these functions if you just want to use this library for drawing to the screen. 
-  * mgl/utils: Various utility functions. 
- 
-====== ​ These programs are free to distribute under the GNU General Public License ​ ====== 
- 
-See the file mgl/COPYING for details 
- 
-====== ​ Recompiling mgl  ====== 
- 
-For G4/5 based macs you should not need to recompile the distribution as it comes with precompiled .mexmac files. 
- 
-However, if you want to use the code on linux or if when you first start using the functions they do not work or cause an obvious error like a segmentation fault, then you may want to recompile. This requires mex to be setup properly on your machine. At a minimum you will need to have the apple developer tools installed on your machine (XCode) [[http://​developer.apple.com/​tools/​]]:​ The command to recompile is: 
- 
- >>​ mglMake(1); 
- 
-====== ​ If all else fails, how can I get back control over the display ​ ====== 
- 
-If you can't do mglClose, you can always press: 
- 
- ​option-open apple-esc 
- 
-this will quit your matlab session as well. 
- 
-====== ​ Can I get access to all OpenGL functions? ​ ====== 
-We have only exposed parts of the OpenGL functionality. If you need to dig 
-deeper to code your stimulus, consider writing your own mex file. This will 
-allow you to use the full functionality of the OpenGL library. To do this, 
-you could start by modifying one of our mex functions (e.g. mglClearScreen.c) 
-and add your own GL code to do what you want and compile.