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
You can also run the function mglSystemCheck which will give you warnings if it detects any problems. If there are no problems it will just return true, so should look like the following:
>> mglSystemCheck ans = 1
You may also wish to try the mglTest programs (e.g. mglTestDots, mglTestTex, etc….).
If these functions don't work you might try checking here for some issues that come up with compatibility (for example r2016a has a fix).
You may need to recompile. This may especially be necessary if you are running an older version of matlab (we run Matlab version >= R2013a 8.1 on Mac OS >= 10.10.2 as of this writing, 3/10/2015). 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 mex 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.
These programs are free to distribute under the GNU General Public License. See the file mgl/COPYING for details.
If you are running into an obvious error like a segmentation fault, then you may want to recompile. The command to recompile is:
If you run into any problems with mglMake, you may want to restart matlab and try again.
The mglMake command simply runs mex on all the .c files in the mgl/mgllib directory – you can do this by hand (e.g. mex mglPrivateOpen.c), if you prefer.
Note that this requires mex to be setup properly on your machine. On a Mac OS X machine, at a minimum you will need to have the apple developer tools installed (XCode) http://developer.apple.com/tools/. On linux, you will need a compatible version of gcc (older versions of gcc can be found here).
See here for more help on compiling.
If you can't do mglClose, you can always press:
this will quit your matlab session as well. You may also have to hit the <ENTER> key a couple of times to actually quit matlab.
Also, some of our test programs will run until you hit the <ESC> key (e.g. testExperiment), so it is worth trying that as well.
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.
You can print out all the wiki help pages at once, by using this link.
We stay reasonably up-to-date with OS and Matlab versions. As of this writing (3/2020) we are using MGL on Mac OS 10.15.3 (Catalina) and Matlab 2015a. If you are using a newer or very much older version of MGL, you may need to recompile.
There is an alpha (proof of principle) version that is compatible with Metal.