Resolved issues

Check here for issues that have been resolved. Some issues may also be resolved in issues on github.

Recompiling MGL

We (Apple developers) run the latest Mac OS (10.10.2 as of 3/27/2015) with the latest version of Matlab (8.5) or (Linux developers) Ubuntu 64-bit (Gutsy) and 32-bit (Feisty) with Matlab 7.4 and the binaries are created to run on these systems. As noted above, some older versions (notably Matlab 14.1) are not able to use these mex files and crash when you try to run mglOpen. If this happens, then all you need to do is recompile MGL using mglMake(1). You may also have to make sure that you link to the correct version of the Mac OS X system frameworks.

License manager timing glitch

The Matlab license manager checks every 30 seconds for the license. This can cause there to be an apparent frame glitch in your stimulus code, especially if you are using a network license (on our machines it can take ~200 ms to check for the license). The only known workaround to this is to run on a machine that has a local copy of the license. You can check this for yourself by seeing how long it takes to do screen refreshes:

 mglOpen;
 global MGL;
 checkTime = 30*MGL.frameRate;
 timeTaken = zeros(1,checkTime);
 mglFlush;
 for i = 1:checkTime
   flushStart = mglGetSecs;
   mglFlush;
   timeTaken(i) = mglGetSecs(flushStart);
 end 
 mglClose;
 plot((1:checkTime)/MGL.frameRate,timeTaken);
 zoom on;xlabel('seconds');ylabel('Frame refresh time (seconds)');

If you have the same problem, you should see one large spike in the time course like this:

This one shows it taking about 65 ms. Note that you may see small deviations in which one frame takes longer and then the following frame takes shorter than the mean. These are normal flucations persumably due to multi-tasking and other events that are intermittently taking up time. As long as these are shorter than a frame refresh interval minus the time it takes you to process the stimuli for your display, you will not drop any frames. Note that in the above code, if you change mglFlush to any other command, such as WaitSecs(1/frameRate);, you will still see the big spike for the license manager check–confirming that this has nothing to do with drawing to the screen.

Problems compiling

If you are trying to compile on Mac OS X and are running into problems, you may not be linking against the proper systems libraries. We typically (as of 3/27/2015) are compiling against Mac OS X 10.10.2 SDK, but you may need an earlier or later version of the Mac OS X SDK's. We have updated mglMake so that it does some basic checks and uses different mexopts.sh files for different operating systems (i.e. can either compile with 10.10.2 SDK or 10.8 SDK, etc), but if this fails for your system you may want to try to go in by hand and change the mexopts.sh file yourself to link against the appropriate SDK. To do so, for example, for 10.5:

  1. Make sure that you have Xcode properly installed.
  2. Next, check that you have the proper Mac OS X SDK installed. You generally want the SDK that matches your os (assuming your operating system is up-to-date though more recent versions of the SDK (10.7 - 10.10) should work as well. If you need to compile for an older systems like 10.5, check that it is installed properly (this should be installed when you install Xcode)
      /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/
  3. You may no have to go into the “mexopts.sh” file in the mgl/mgllib directory to link to 10.5 instead of 10.6. Change the following lines appropriately to link to 10.5:
      SDKROOT='/Developer/SDKs/MacOSX10.5.sdk'
      MACOSX_DEPLOYMENT_TARGET='10.5'

In later SDKs, (e.g. SDK=10.13), you can also compile MGL using clang rather than the default c compiler, by:

  1. setting the optf in mglMake (e.g. line 209, as of 7/20/20):
     optf = sprintf('-f %s',fullfile(fileparts(which('mglOpen')),'clang_maci64.xml'));
  2. and changing the clang_maci64.xml file to find the 10.13 sdk (e.g. line 120 and 136):
    <dirExists name="$$/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" /> 
    <cmdReturns name="find $$ -name MacOSX10.13.sdk" />

SVN problems

If you have problems updating with SVN because you have changed files, you might be running into file or tree conflicts. See here for more info.

I have run into some unresolvable conflicts with the following error:

svn: GET of '/svn/mgl/!svn/bc/946/trunk/mgllib/mglEyelink/mglPrivateEyelinkReadEDF.c': Could not read response body: connection was closed by server (http://gru.brain.riken.jp)

You may try to svn checkout the whole repository again (remember to make a copy of your current repository and then copy back the files you have changed). It seems that this can be caused by Apache timing out for long updates, but that doesn't seem to be the reason why we are getting that (we have set out timeout very long and this happens for single files and always at the same place in certain revisions). I suspect that it is some problem with the Mac Apache svn/PHP module, but have not been able to figure it out. A workaround is to use svn+ssh for accessing the repository, but this is only for developers who have an account on our server gru.brain.riken.jp (email to justin if you think you need this). Also, if someone knows what the problem is and can provide a fix, let us know.

Function not supported on Linux

Note that only version 1.5 supports linux, version 2.0 and beyond do not have linux support at the moment (actually could be supported with a little bit of work, if someone is interested in putting in the effort).

The list of funcitons not supported yet on linux for version 1.5 are:

  • mglText
  • mglTextDraw
  • mglPlaySound
  • mglInstallSound
  • mglDescribeDisplays
  • mglSwitchDisplay
  • mglListener

If you want to use text under the linux operating system, you can use mglStrokeText.

Here is a more recent update from Jonas about the Linux version:

I am in the process of upgrading the Linux version of MGL to run under Ubuntu (64-bit and 32-bit) with NVIDIA and ATI graphics cards. Although the upgrade is still incomplete, most functions work equally well under Linux at this stage. Some differences that will remain between the platforms are listed below.

  • no support for font-based text - this needs to be upgraded, I started looking into using FreeType for this which is widely available and would be easy to implement in the same texture-based way that the Mac code relies on. Care must be taken to ensure that the code is maximally portable across platforms, so it may be that some Mac-specific idiosyncracies need to be modified
  • note that the stroke text works perfectly under Linux, so unless you are very enamoured with a specific font this is a perfectly usable workaround (though some symbols, eg %, are missing currently)
  • some differences in the way you specify special keys, but this is generally to Linux' advantage - eg you can use ESC, BACKSPACE etc as names (relies on the XKeySymDef.h or sth like that)
  • timing is in general more accurate on Linux, since the clock rate is much higher on modern systems (100-500Hz vs 60Hz on the Mac)
  • no parallel port interface yet so you can't use Justin's code for calibration
  • no sound - need to decide on a standard to use that is most widely available
  • the syncing with OpenGL is idiosyncratic and depends on the graphics card. I have implemented this to use both the SGI video sync extension and the environment variable (both NVIDIA and ATI provide this option). The former is not supported by all OpenGL cards (though most modern ones) and can interact with the environment variable option, so I will make the latter the default, with an option to use the SGI extension when compiling only.

For the time being, only NVIDIA and ATI cards will be supported (because I only have access to those two machines).

  • setting screen size and resolution requires the XRandR extension, which is supported on recent X distributions (Xorg 7.0 and later). Older X servers (eg Apple's X11) won't work.
  • you need to reuse the X display or you run into memory problems, and the code for doing this needs to be checked for consistency. This is similar to the Mac window situation and relates to the uneasy relationship between Matlab and X. When you open a window, the MGL global variable will contain a window and display pointer that is used on subsequent calls; care must be taken not to clear the MGL variable between calls (once you do so, running MGL is likely to crash Matlab, even if you run clear all, which correctly closes the display).