psychopy.org | Reference | Downloads | Github

Installing and Testing the Experimental GLFW Backend

Hello Everyone,

Included with the next version (1.90) of PsychoPy is an experimental GLFW (https://www.glfw.org/) backend (or window type).

Why use it?

GLFW (Graphics Library Framework) provides cutting-edge cross platform support for graphics and input. For PsychoPy users, this means fewer bugs (GLFW is very actively developed and extensively used) and more features. It would be greatly appreciated that people test out the GLFW backend with their existing experiments and submit issues to the bug tracker. However, it is still experimental and should not be used for running real experiments just yet.

Unlike Pyglet, you need to install additional software on your computer to use it which is not included with PsychoPy, namely the ‘glfw3’ dynamic library.

Installing GLFW on Windows

Download the pre-compiled GLFW binaries from: GLFW download page

Open the archive and copy “glfw3.dll” in directory “glfw-3.2.1.bin.WIN64\lib-vc2015” to “C:\Windows\system32” or “C:\Windows\SysWOW64”. You can place the “glfw3.dll” in another directory if the directory is specified in your system’s PATH variable.

Installing GLFW on Linux

You can install GLFW through your package manager (Ubuntu and OpenSUSE seem to have working packages).

NOTE: Sometimes only the static library is packaged instead of the dynamic one. In that case you might need to compile it from scratch. Download the sources from here: GLFW download page and follow the instructions.

Installing GLFW on MacOS

Check if GLFW is available on MacPorts and install it as usual. I don’t use Mac PCs often so I can’t provide additional details here.

Using the GLFW Backend

When creating a window, specify winType='glfw'. For the most part you should not notice a difference (that’s a good thing), but you should avoid using the GLFW backend for real experiments if any of the following issues can affect the integrity of your experiment.

Issues

  1. Mouse and key events should behave the same, but there may be some edge cases where event processing is buggy. This will be fixed and better tested in a later release.
  2. To disable vertical sync, you must specify both waitBlanking=False and swapInterval=0 when creating a GLFW window. This will also be fixed soon.
  3. You won’t be able to render text stimuli since GLFW does not provide support for it, however effort is being made to provide it.

Keep in mind there might be other unforseen issues, use at your own risk!

3 Likes

To install glfw on OS X, you probably want to use homebrew; brew install glfw will do the trick.

Haven’t tried the backend in psychopy yet.