Psychopy: visual.Window() initialised with stereo=True fails with exception “pyglet.window.NoSuchConfigException”

I am new to psychopy and I have written a small piece of code to display
fixation point. Everything works fine, if I do not set the option
"stereo=True". But the moment I set “stereo=True”, it fails with exception “pyglet.window.NoSuchConfigException”.

There is no issue if I set “stereo = False” or I do not pass this parameter at all.
I had posted this question on stackoverflow and I got a suggestion to use winType = ‘pygame’ rather than 'pyglet’
What is the issue with using pyglet and is there something else that needs to be done before passing this parameter?
I have no preference for pygame or pyglet but curious to know why is does not work on pyglet.
I need to use this to supports quad buffers and any help is appreciated!!

Here is the exception:

Traceback (most recent call last): File “fixiation.py”, line 3, in
win = visual.Window([1920, 1080], screen=1, units=‘pix’, fullscr=True, stereo=True)#monitor=‘DVI-I-1’, units=‘pix’,
fullscr=True) File
"/usr/lib/python2.7/dist-packages/psychopy/visual/window.py", line
325, in init
self._setupGL() File “/usr/lib/python2.7/dist-packages/psychopy/visual/window.py”, line
1425, in _setupGL
self._setupPyglet() File “/usr/lib/python2.7/dist-packages/psychopy/visual/window.py”, line
1286, in _setupPyglet
style=style) File “/usr/lib/pymodules/python2.7/pyglet/window/xlib/init.py”, line
474, in init
super(XlibWindow, self).init(*args, kwargs)
File “/usr/lib/pymodules/python2.7/pyglet/window/init.py”, line
645, in
init
config = screen.get_best_config(config) File
"/usr/lib/pymodules/python2.7/pyglet/window/init.py", line 291, in
get_best_config
raise NoSuchConfigException()
**pyglet.window.NoSuchConfigException Exception AttributeError:
"‘Window’ object has no attribute ‘useNativeGamma’" in > ignored

Here is the sample code

from psychopy import visual, event

win = visual.Window([1920, 1080], screen=1, units=‘pix’, fullscr=True, stereo=True)
fixation = visual.GratingStim(win=win, size=10, pos=[0,0], sf=0, units=‘pix’)

while True:
fixation.draw()
win.update()
if len(event.getKeys()) >0:
break
event.clearEvents()

win.close()

Essentially this is a pyglet error message and I’m not sure what we can do about it but could you run the Coder demo called sysInfo.py and let us know what it spits out so we can get some info on what your graphics card supports?

Using pygame won’t help though I don’t think - that probably doesn’t support try to support quad buffers at all.

Thanks Jon for the reply.
Here are the details you requested:
I tried it on 2 systems and I see the same error using “pyglet”. Have provided both the configuration.
Depending on your reply I could post this on pyglet forums for explanation if there is something wrong.

As I was going through the system info I did see
"False GL_STEREO" is this something to do with this error?

System 1:

Paths to files on the system:
userPrefsFile: ~/.psychopy2/userPrefs.cfg
appDataFile: ~/.psychopy2/appData.cfg
demos: /usr/lib/python2.7/dist-packages/psychopy/demos
appFile: /usr/lib/python2.7/dist-packages/psychopy/app/PsychoPy.py

System info:
Linux-4.4.0-34-generic-x86_64-with-Ubuntu-14.04-trusty

Python info
/usr/bin/python
2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
numpy 1.8.2
scipy 0.13.3
matplotlib 1.3.1
pyglet 1.1.4
pyo version 0.6.8 (uses single precision)
pyo 0.6.8

PsychoPy 1.83.04
have shaders: True

OpenGL info:
vendor: Intel Open Source Technology Center
rendering engine: Mesa DRI Intel® HD Graphics 520 (Skylake GT2)
OpenGL version: 3.0 Mesa 11.2.0
(Selected) Extensions:
True GL_ARB_multitexture
True GL_EXT_framebuffer_object
True GL_ARB_fragment_program
True GL_ARB_shader_objects
True GL_ARB_vertex_shader
True GL_ARB_texture_non_power_of_two
True GL_ARB_texture_float
False GL_STEREO
max vertices in vertex array: 3000
0.5592 WARNING Monitor specification not found. Creating a temporary one…
AL lib: ReleaseALC: 1 device not closed

System 2

userPrefsFile: ~/.psychopy2/userPrefs.cfg
appDataFile: ~/.psychopy2/appData.cfg
demos: /usr/lib/python2.7/dist-packages/psychopy/demos
appFile: /usr/lib/python2.7/dist-packages/psychopy/app/PsychoPy.py

System info:
Linux-4.2.0-42-generic-x86_64-with-Ubuntu-14.04-trusty

Python info
/usr/bin/python
2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
numpy 1.8.2
scipy 0.13.3
matplotlib 1.3.1
pyglet 1.1.4
pyo version 0.6.8 (uses single precision)
pyo 0.6.8

PsychoPy 1.83.04
have shaders: True

OpenGL info:
vendor: NVIDIA Corporation
rendering engine: GeForce GTX 970/PCIe/SSE2
OpenGL version: 4.5.0 NVIDIA 352.63
(Selected) Extensions:
True GL_ARB_multitexture
True GL_EXT_framebuffer_object
True GL_ARB_fragment_program
True GL_ARB_shader_objects
True GL_ARB_vertex_shader
True GL_ARB_texture_non_power_of_two
True GL_ARB_texture_float
False GL_STEREO
max vertices in vertex array: 1048576
3.8898 WARNING Monitor specification not found. Creating a temporary one…
AL lib: ReleaseALC: 1 device not closed

Yes, I think so. If the driver reports GL_STEREO extension is not present then you won’t be able to use it. I’m afraid I don’t know enough to tell you which cards/drivers support quad buffering under ubuntu

Not sure that I have a solution, but I thought I’d let you know that a) I had received this error before, and b) it is now working. This is with quad-buffer stereo on Linux with a Nvidia Quadro K1200.

From memory, the problem was on the X windows side of things. I had to edit ‘xorg.conf’ to have a section like:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "4"
    Option         "metamodes" "DP-1: 1920x1200_60 +0+0, DP-0: 1920x1200_60 +0+2"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I think the ‘stereo’ setting was key - setting it to ‘4’ gives “multi-display clone mode stereo” (see ‘man nvidia-xconfig’).

Note that psychopy still prints a warning “A stereo window was requested but the graphics card does not seem to support GL_STEREO” - but the stereo functionality works fine.

1 Like

Hello Noel,

From my experience (I almost exclusively research stereo vision), only OpenGL workstation graphics cards such as the Quadro series support the GL_STEREO extension on Linux. GeForce cards require the NVIDIA 3D vision kit + driver that is exclusive to Windows.

1 Like

Hello Djmannion,

I tried setting "Option “Stereo” “4"” in ‘xorg.conf’ and I still don’t see it working.
I am still not sure what is the problem with pyglet. Pyglet forums as well have no answer for the same
And Jon mentioned this might not work with pygame and it seems true.

So please let me know if you can remember if there is anything else that I need to enable this

From what @mdc says, the issue might be one of driver support for GeForce cards on Linux. If so, the problem wouldn’t be with pyglet per se, as no software would be able to access the stereo features at all.

So the natural question is, do you have any software on this computer (when running Linux) that can utilise the stereo capabilities?

Have a look in your X log file. For me, this is located at /var/log/Xorg.0.log. I have something like:

[    13.837] (**) NVIDIA(0): One-eye-per-display passive stereo requested

Presumably yours will show an error or warning message. As others have mentioned, the stereo functionality is only likely to work with a Quadro series card (on linux, at least).

@Michael, Yes this works well with Matlab. Where we use the stereoscopic flag to display the stereoscopic image. And now we want to translate the code into python for using python instead of matlab.

Hello Noel,

Psychtoolbox (via MATLAB) does some clever things to get stereo to work on platforms that don’t have a hardware pipeline for it (with shaders and framebuffers). As of now, Psychopy requires a graphics device that has driver/hardware support for the GL_STEREO extension (Quadro/FireGL cards) to use passive and temporally interleaved active stereo. This solution is solid but represents a portability problem.

To implement PTB’s range of stereo modes in PsychoPy is not trivial. Since I typically use dual-head passive stereo for experiments on supported hardware, I haven’t explored implementing the PTB range of stereomodes myself. It might be a valuable effort to do so considering the recent research interest in VR and AR technology.

@djmannion, I do not see any error or warning under /var/log/Xorg.0.log when I run my program with stereo=True.

@mdc : So are you suggesting that I could do something similar to PTB on psychopy?

Hello Noel,

So are you suggesting that I could do something similar to PTB on psychopy?

Not at this time, or at least, not easily without supported hardware. It is possible to match PTB on this front, but would require you to work through the OpenGL interface to get right.

Getting PsychoPy’s stereo support up to the level of PTB is going to take lots of work and testing.

@noel - the Xorg log will report details about setting the video card’s stereo mode in xorg.conf, rather than psychopy’s use of stereo=True. This will be written to the log when X starts.

Perhaps if you tell us a bit more about your physical setup (e.g. details of the monitors, delivery method to separate eyes, etc.) we can think of other options to get it working.

1 Like

For doing this without the driver support for quad buffers I imagine PTB does something like creating additional framebuffer objects (the basis of what PTB calls offscreen windows) to create “left” and “right” buffers and then we’d need options for how those should be rendered according to the output (e.g. interleaved frames, interleaved lines, anaglyph glasses etc).

None of that should be technically difficult I think - we already have a single framebuffer object (FBO) in the Window - but without having any stereo goggles myself it would be hard for me to test/debug

1 Like

Hello Jon,

One can hide the fact from the user and default to that method when hardware stereo support is not available but stereo=True. Testing on a monocular display is pretty easy, you just need to alternate the left/right eye images every frame. Older VGA shutter systems can pick up the signal and sync automatically (for systems that don’t have a VESA stereo port).

I have all sorts of stereo hardware around that utilize all the stereo-modes listed in your post. I can code and test where ever I can if we can coordinate on this.

EDIT: Reading into it more, we can use a single, multi-layered texture in an FBO and a shader to handle this stuff. It’s actually not too difficult.