OpenOffscreenWindow fails with screenNumber=-1

PsychtoolboxVersion = ‘3.0.14’
OS = Win10

I have found that the following code segment produces the error message below:

window = Screen(‘OpenOffscreenWindow’, -1);

Error in function OpenOffscreenWindow: Usage error
Could not find any open onscreen window to act as parent for this offscreen window. Open an onscreen window first!

However I’m not asking for it to be associated with an onscreen window, my understanding is that screenNumber=-1 is provided for this purpose. Is this not the case?

To provide some background, I am trying to modify some existing code, to write the screen to a movie clip, ultimately with ‘CreateMovie’. I unable to provide a physical screen that Psychtoolbox will work with (it complains at length about both the OS and graphics driver) as the code is running on a machine in a remote cluster which I have no admin rights to. I’m not looking for or expecting real-time performance, I just want to use the rendering so that I can write the output to a movie. Is there a way I can proceed?

Any help gratefully received!

It always needs at least one onscreen window open on some screen. The help text there could be more clear about it. I’ll change that.

Add a Screen(‘Preference’,‘SkipSyncTests’, 2); call to the top of your script to disable startup timing checks. Then cross your fingers. I don’t think this type of rendering has been tested so far, but if your cluster machine (a VM?) gives you some kind of OpenGL renderer, you may be good.

Many thanks for your quick response Mario!

I tried Screen(‘Preference’,‘SkipSyncTests’, 2) but Psychtoolbox aborted when detecting the MS software renderer. I next tried adding Screen(‘Preference’, ‘ConserveVRAM’, 64); to prevent the abort, however after displaying the Psychtoolbox splash screen it errored out on the first texture, output below. It’s not a challenging render, so any suggestions would be gratefully received!

PTB-WARNING: Created onscreen window on screenid 0 will probably not be able to use GPU pageflipping for
PTB-WARNING: Screen(‘Flip’)! May cause tearing artifacts and unreliable or wrong visual stimulus onset timestamping!
PTB-WARNING: Could not bind wglChoosePixelFormat - Extension. Some features will be unavailable, e.g., Anti-Aliasing and high precision framebuffers.
PTB-WARNING: Created onscreen window on screenid 0 will probably not be able to use GPU pageflipping for
PTB-WARNING: Screen(‘Flip’)! May cause tearing artifacts and unreliable or wrong visual stimulus onset timestamping!
PTB-WARNING: Your graphics driver doesn’t allow me to control if bufferswaps should be synchronized to the vertical retrace!
PTB-WARNING: This can cause massive stimulus timing problems, failure of the sync tests and calibrations and severe visual tearing artifacts!
PTB-WARNING: Please update your display graphics driver as soon as possible to fix this and make sure this functionality is not disabled in
PTB-WARNING: the display settings control panel of your graphics card.
PTB-WARNING: If everything else fails, you can usually manually enable synchronization to vertical retrace somewhere in the display settings
PTB-WARNING: control panel of your machine.

PTB-WARNING: Seems that Microsofts OpenGL software renderer is active! This will likely cause miserable
PTB-WARNING: performance, lack of functionality and severe timing and synchronization problems.
PTB-WARNING: Most likely you do not have native OpenGL vendor supplied drivers (ICD’s) for your graphics hardware
PTB-WARNING: installed on your system.Many Windows machines (and especially Windows Vista) come without these preinstalled.
PTB-WARNING: Go to the webpage of your computer vendor or directly to the webpage of NVidia/AMD/ATI/3DLabs/Intel
PTB-WARNING: and make sure that you’ve download and install their latest driver for your graphics card.
PTB-WARNING: Other causes, after you’ve ruled out the above:
PTB-WARNING: Maybe you run at a too high display resolution, or the system is running out of ressources for some other reason.
PTB-WARNING: Another reason could be that you disabled hardware acceleration in the display settings panel: Make sure that
PTB-WARNING: in Display settings panel -> Settings -> Advanced -> Troubleshoot -> The hardware acceleration slider is
PTB-WARNING: set to ‘Full’ (rightmost position).

PTB-INFO: OpenGL-Renderer is Microsoft Corporation :: GDI Generic :: 1.1.0
PTB-INFO: VBL startline = 800 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback.
PTB-INFO: Timestamps returned by Screen(‘Flip’) will be therefore less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=0.000000 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.

PTB-WARNING: Your graphics hardware & driver doesn’t support OpenGL rectangle textures.
PTB-WARNING: This won’t affect the correctness or visual accuracy of image drawing, but it can significantly
PTB-WARNING: degrade performance/speed and increase memory consumption of images by up to a factor of 4!
PTB-WARNING: If you use a lot of image stimuli (DrawTexture, Offscreen windows, Stereo display, movies)
PTB-WARNING: and you are unhappy with the performance, then please upgrade your graphics driver and possibly
PTB-WARNING: your gfx hardware if you need higher performance…
PTB-INFO: ==============================================================================================================================
PTB-INFO: WINDOWS DWM DESKTOP COMPOSITOR IS ACTIVE. On this Windows-10 or later system, Psychtoolbox can no longer reliably detect if
PTB-INFO: this will cause trouble for timing and integrity of visual stimuli or not. You might be just fine, or you could be in trouble.
PTB-INFO: Use external measurement equipment and independent procedures to verify reliability of timing if you care about proper timing.
PTB-INFO: ==============================================================================================================================
PTB-INFO: All display tests and calibrations disabled. Assuming a refresh interval of 60.000000 Hz. Timing will be inaccurate!

PTB-ERROR: Texture creation failed or malfunctioned for a texture of requested size w x h = 128 x 128 texels
PTB-ERROR: and at least 4 bytes VRAM memory consumption per texel.
PTB-ERROR: Currently there are already 1 textures, offscreen windows, movies or proxies open.
PTB-ERROR: All these objects consume system memory and could lead to ressource shortage.
PTB-ERROR: My current (rough and probably way too low) estimate is that at least 0.000000 MB of memory are
PTB-ERROR: consumed for textures, offscreen windows and similar objects.
PTB-ERROR: Another cause of failure could be that your graphics hardware doesn’t have sufficient amounts of
PTB-ERROR: free VRAM memory. Try to reduce the precision and/or size of your texture image to the lowest
PTB-ERROR: acceptable setting for your purpose.
PTB-ERROR: Read the online help for Screen MakeTexture? or Screen OpenOffscreenWindow? for information
PTB-ERROR: about how to reduce the number of color channels and/or precision of the texture.
PTB-ERROR: It may also help to reduce general VRAM memory consumption:
PTB-ERROR: Reduce the display resolution to the smallest acceptable resolution or disable the 2nd
PTB-ERROR: display of a dual-display setup if it isn’t strictly needed for your study.
PTB-ERROR: Other than that you could upgrade to more powerful graphics hardware (more VRAM) or try to split
PTB-ERROR: your oversized image into multiple separate subimages and draw them sequentially to the screen.
PTB-ERROR: That way you’ll be able to draw larger images, albeit at drastically lowered performance and more
PTB-ERROR: coding hazzle.

Error in function MakeTexture: Usage error
Texture creation failed, most likely due to unsupported precision or insufficient free memory.

WARNING: This session of your experiment was run by you with the setting Screen(‘Preference’, ‘SkipSyncTests’, 2).
WARNING: This means that some internal self-tests and calibrations were skipped. Your stimulus presentation timing
WARNING: may have been wrong. This is fine for development and debugging of your experiment, but for running the real
WARNING: study, please make sure to set Screen(‘Preference’, ‘SkipSyncTests’, 0) for maximum accuracy and reliability.
Error using Screen

textureIndex=Screen(‘MakeTexture’, WindowIndex, imageMatrix [, optimizeForDrawAngle=0] [, specialFlags=0] [,
floatprecision=0] [, textureOrientation=0] [, textureShader=0]);

Try a conservevram flag of 64 + 512. This will disable many of the error checks, so in case the reported error is a false alert due to some bugs in Microsofts software renderer, PTB would keep going and maybe produce a reasonable result. Other than that, you’d be out of luck - maybe.

Another thing you could try, which might be better, is to use the “opengl software” command of Matlab to ask Matlab to use its software OpenGL renderer for the given session. This may also then use that renderer for PTB and if Matlab ships a half-way recent version of Mesa’s software renderer, it would probably be way more capable than Microsofts ancient GDI renderer.

64 + 512 has got it, I’m in business :+1:

Thanks again for your help Mario!