New PTB, macOS Mojave, DrawText plugin problem?

Hi Mario and friends,
I’m using macOS 10.14.6 Mojave.
MATLAB 9.6 (R2019a) Update 8
MacBook Pro (15-inch, 2017)
I just upgraded to Psychtoolbox 3.0.17. Was that a mistake?
(I did read the release notes, which require Catalina. But if we absolutely need Catalina, shouldn’t UpdatePsychtoolbox at least issue a warning about the OS version? The error messages I got are not at all suggestive of having the wrong OS version.)
Error below.
I’d be grateful for help or advice.
Denis Pelli

UpdatePsychtoolbox issues a warning:

UpdatePsychtoolbox
UpdatePsychtoolbox(‘/Users/denispelli/Dropbox/MATLAB/Psychtoolbox’)

Updating via Matlabs integrated SVNKit: This can take multiple minutes.
There may be no output to this window to indicate progress until the update is complete.
Please be patient …
Update to SVN revision 11608 succeeded!

Your MATLAB/OCTAVE path has been updated. Now trying to save the new MATLAB/OCTAVE path…

Running post-install routine…

PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #1 (Revision 1) established.
PTB-INFO: Disconnecting from kernel driver instance #1 for detected Intel GPU for safety reasons. setenv(‘PSYCH_ALLOW_DANGEROUS’, ‘1’) to override.
Trying to trigger an update of the fontconfig cache if that should prove neccessary.
This may take a couple of seconds, or sometimes even minutes. Please be patient…
INTERNAL PSYCHTOOLBOX ERROR
** error: Psycherror_OpenGL**
** general description: OpenGL call returned an error**
** specific description: GL_INVALID_FRAMEBUFFER_OPERATION_EXT**
** module name: Screen**
** subfunction call: OpenWindow**
** file name: /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/PsychTextureSupport.c**
** function name: PsychCreateTexture**
** line number: 166**
Something went wrong with text renderer setup. Read ‘help DrawTextPlugin’ for troubleshooting.

Based on help DrawTextPlugin, I searched for and deleted one instance of libfreetype.6.dylib in X11. That made no difference. Running UpdatePsychtoolbox again produced the same error.

Running DrawFormattedTextDemo produced a fatal error.
>> DrawFormattedTextDemo
PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.
INTERNAL PSYCHTOOLBOX ERROR
** error: PsychError_InvalidWindowRecord**
** general description: An Invalid window record was referenced.**
** module name: Screen**
** subfunction call: OpenWindow**
** file name: /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/WindowHelpers.c**
** function name: PsychCheckIfWindowRecordIsValid**
** line number: 61**
INTERNAL PSYCHTOOLBOX ERROR
** error: PsychError_InvalidWindowRecord**
** general description: An Invalid window record was referenced.**
** module name: Screen**
** subfunction call: WindowKind**
** file name: /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/WindowHelpers.c**
** function name: PsychCheckIfWindowRecordIsValid**
** line number: 61**
Error using Screen
See error message printed above.

Error in sca (line 30)
** if Screen(‘WindowKind’, win) == 1**

Error in DrawFormattedTextDemo (line 178)
** sca;**

Hi Denis,

while only Catalina is tested going forward, and officially supported in case of trouble, the expectation is that all versions since 10.11 El Capitan should continue to work. I just spent 2 hours going through our code and there has not been any change in the relevant code that could cause this error. The only thing that changed is that the build system is now Catalina 10.15.7 instead of High Sierra 10.13.6, and the SDK is now the Catalina SDK instead of the Mojave SDK. This is certainly yet another Apple macOS bug, maybe this time in the Apple XCode SDK’s.

So let’s see what the iToys company screwed up this time.

Restart Matlab, or “clear all”.

% Let’s skip error detection and see how far we get:
Screen(‘Preference’,‘ConserveVRAM’, 512);
% Run some demo, e.g.:
InitializeMatlabOpenGL(, 1, 1);
PerceptualVBLSyncTest or LinesDemo or DrawSomeTextDemo.

Do they work?

Then you can do this in the command window or a script:
PsychDebugWindowConfiguration;
w = Screen(‘Openwindow’, 0);
glClear(GL.COLOR_BUFFER_BIT);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL.COLOR_BUFFER_BIT);
v = glReadPixels(0, 0, 1, 1, GL.RED, GL.UNSIGNED_BYTE)
glPixelStorei(GL.UNPACK_ALIGNMENT, 1);
glClearColor(1,1,1,1);
glGetString(GL.VENDOR)
glGetString(GL.RENDERER)
glGetString(GL.VERSION)
glGetString(GL.EXTENSIONS)
sca;

And let me know on which one it aborts with an OpenGL error. These are the
only calls that could in theory trigger an OpenGL error in this scenario, but in practice none of them can, except if Apple screwed up badly - which is of course their thing.

[Work time spent so far to diagnose Apples screwup: 3 hours]
-mario

dear mario
many thanks. I restarted MATLAB. All the suggested tests run fine, with no error. Here’s the print out.
Just in case, I reran UpdatePsychtoolbox, and got the same error, below.
Any more tests I can run?
best
denis
p.s.
TYPO: “Trying to trigger an update of the fontconfig cache if that should prove neccessary.”
should be “necessary”.

>> Screen(‘Preference’,‘ConserveVRAM’, 512);
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #1 (Revision 1) established.
PTB-INFO: Disconnecting from kernel driver instance #1 for detected Intel GPU for safety reasons. setenv(‘PSYCH_ALLOW_DANGEROUS’, ‘1’) to override.
>> InitializeMatlabOpenGL([], 1, 1);
>> PerceptualVBLSyncTest
PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.

PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Dec 2 2020).
PTB-INFO: OS support status: OSX version 10.14 is not - or no longer - officially supported or tested at all for this release.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: AMD Radeon Pro 560 OpenGL Engine :: 2.1 ATI-2.11.22
PTB-INFO: Renderer has 4096 MB of VRAM and a maximum 3840 MB of texture memory.
PTB-INFO: VBL startline = 1800 , VBL Endline = 1850
PTB-INFO: Measured monitor refresh interval from beamposition = 16.666460 ms [60.000743 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.665882 ms [60.002825 Hz]. (50 valid samples taken, stddev=0.081338 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 33793 …
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Enabling panel fitter. Providing virtual framebuffer of 1280 x 800 pixels size.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).

INFO: PTB’s Screen(‘Flip’, 10) command seems to have missed the requested stimulus presentation deadline
INFO: a total of 2 times out of a total of 576 flips during this session.

INFO: This number is fairly accurate (and indicative of real timing problems in your own code or your system)
INFO: if you provided requested stimulus onset times with the ‘when’ argument of Screen(‘Flip’, window [, when]);
INFO: If you called Screen(‘Flip’, window); without the ‘when’ argument, this count is more of a ‘‘mild’’ indicator
INFO: of timing behaviour than a hard reliable measurement. Large numbers may indicate problems and should at least
INFO: deserve your closer attention. Cfe. ‘help SyncTrouble’, the FAQ section at www.psychtoolbox.org and the
INFO: examples in the PDF presentation in PsychDocumentation/Psychtoolbox3-Slides.pdf for more info and timing tips.

>> LinesDemo
PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.

PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Dec 2 2020).
PTB-INFO: OS support status: OSX version 10.14 is not - or no longer - officially supported or tested at all for this release.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: AMD Radeon Pro 560 OpenGL Engine :: 2.1 ATI-2.11.22
PTB-INFO: Renderer has 4096 MB of VRAM and a maximum 3840 MB of texture memory.
PTB-INFO: VBL startline = 1800 , VBL Endline = 1850
PTB-INFO: Measured monitor refresh interval from beamposition = 16.666257 ms [60.001475 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.665689 ms [60.003520 Hz]. (50 valid samples taken, stddev=0.080244 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 33793 …
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Enabling panel fitter. Providing virtual framebuffer of 1280 x 800 pixels size.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).

minsmooth =

1

maxsmooth =

64

>> DrawSomeTextDemo
PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.

PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Dec 2 2020).
PTB-INFO: OS support status: OSX version 10.14 is not - or no longer - officially supported or tested at all for this release.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: AMD Radeon Pro 560 OpenGL Engine :: 2.1 ATI-2.11.22
PTB-INFO: Renderer has 4096 MB of VRAM and a maximum 3840 MB of texture memory.
PTB-INFO: VBL startline = 1800 , VBL Endline = 1850
PTB-INFO: Measured monitor refresh interval from beamposition = 16.666665 ms [60.000005 Hz].
PTB-INFO: Will use beamposition query for accurate Flip time stamping.
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.665097 ms [60.005652 Hz]. (50 valid samples taken, stddev=0.109848 ms.)
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 33793 …
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Enabling panel fitter. Providing virtual framebuffer of 1280 x 800 pixels size.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
Requested font: Courier New, got: Courier New
Requested font: Times, got: Times
>> PsychDebugWindowConfiguration;

>> w = Screen(‘Openwindow’, 0);
PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.

PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.17 - Build date: Dec 2 2020).
PTB-INFO: OS support status: OSX version 10.14 is not - or no longer - officially supported or tested at all for this release.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: OpenGL-Renderer is ATI Technologies Inc. :: AMD Radeon Pro 560 OpenGL Engine :: 2.1 ATI-2.11.22
PTB-INFO: Renderer has 4096 MB of VRAM and a maximum 3840 MB of texture memory.
PTB-INFO: VBL startline = 1600 , 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: ==================================================================================================================
PTB-WARNING: DESKTOP COMPOSITOR IS ACTIVE! ALL FLIP STIMULUS ONSET TIMESTAMPS WILL BE VERY LIKELY UNRELIABLE AND LESS ACCURATE!
PTB-WARNING: STIMULUS ONSET TIMING WILL BE UNRELIABLE AS WELL, AND GRAPHICS PERFORMANCE MAY BE REDUCED!
PTB-WARNING: DO NOT USE THIS MODE FOR RUNNING REAL EXPERIMENT SESSIONS WITH ANY REQUIREMENTS FOR ACCURATE TIMING!
PTB-WARNING: ==================================================================================================================
PTB-INFO: All display tests and calibrations disabled. Assuming a refresh interval of 60.000000 Hz. Timing will be inaccurate!
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 33793 …
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Enabling panel fitter. Providing virtual framebuffer of 1280 x 800 pixels size.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
>> glClear(GL.COLOR_BUFFER_BIT);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL.COLOR_BUFFER_BIT);
v = glReadPixels(0, 0, 1, 1, GL.RED, GL.UNSIGNED_BYTE)
glPixelStorei(GL.UNPACK_ALIGNMENT, 1);
glClearColor(1,1,1,1);
glGetString(GL.VENDOR)
glGetString(GL.RENDERER)
glGetString(GL.VERSION)
glGetString(GL.EXTENSIONS)
sca;

v =

uint8

128

ans =

‘ATI Technologies Inc.’

ans =

‘AMD Radeon Pro 560 OpenGL Engine’

ans =

‘2.1 ATI-2.11.22’

ans =

'GL_ARB_color_buffer_float GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra GL_ARB_vertex_blend GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_clip_volume_hint GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_depth_bounds_test GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture_array GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_rectangle GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array_bgra GL_APPLE_aux_depth_stencil GL_APPLE_client_storage GL_APPLE_element_array GL_APPLE_fence GL_APPLE_float_pixels GL_APPLE_flush_buffer_range GL_APPLE_flush_render GL_APPLE_object_purgeable GL_APPLE_packed_pixels GL_APPLE_pixel_buffer GL_APPLE_rgb_422 GL_APPLE_row_bytes GL_APPLE_specular_vector GL_APPLE_texture_range GL_APPLE_transform_hint GL_APPLE_vertex_array_object GL_APPLE_vertex_array_range GL_APPLE_vertex_point_size GL_APPLE_vertex_program_evaluators GL_APPLE_ycbcr_422 GL_ATI_blend_equation_separate GL_ATI_blend_weighted_minmax GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_IBM_rasterpos_clip GL_NV_blend_square GL_NV_conditional_render GL_NV_depth_clamp GL_NV_fog_distance GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_barrier GL_SGI_color_matrix GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod ’

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.

>> UpdatePsychtoolbox
UpdatePsychtoolbox(‘/Users/denispelli/Dropbox/MATLAB/Psychtoolbox’)

Updating via Matlabs integrated SVNKit: This can take multiple minutes.
There may be no output to this window to indicate progress until the update is complete.
Please be patient …
Update to SVN revision 11608 succeeded!

Your MATLAB/OCTAVE path has been updated. Now trying to save the new MATLAB/OCTAVE path…

Running post-install routine…

PTB-INFO: Connection to Psychtoolbox kernel support driver instance #0 (Revision 1) established.
PTB-INFO: Connection to Psychtoolbox kernel support driver instance #1 (Revision 1) established.
PTB-INFO: Disconnecting from kernel driver instance #1 for detected Intel GPU for safety reasons. setenv(‘PSYCH_ALLOW_DANGEROUS’, ‘1’) to override.
Trying to trigger an update of the fontconfig cache if that should prove neccessary.
This may take a couple of seconds, or sometimes even minutes. Please be patient…
INTERNAL PSYCHTOOLBOX ERROR
error: Psycherror_OpenGL
general description: OpenGL call returned an error
specific description: GL_INVALID_FRAMEBUFFER_OPERATION_EXT
module name: Screen
subfunction call: OpenWindow
file name: /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/PsychTextureSupport.c
function name: PsychCreateTexture
line number: 166
Something went wrong with text renderer setup. Read ‘help DrawTextPlugin’ for troubleshooting.

Done with post-installation. Psychtoolbox is ready for use.

Ok, that’s annoying. So with the error checking during Screen(‘Openwindow’) disabled - that’s what that first Screen(‘Preference’,‘ConserveVRAM’, 512); does - ‘OpenWindow’ completes without apparent malfunctions, showing the nice new welcome logo, passing all other non-OpenGL correctness and timing tests. Demos seem to run without visual artifacts or apparent trouble judging from the output? And the specific sequence of the only OpenGL commands during ‘OpenWindow’ which could in theory trigger an error do not trigger an error when executed manually from the Matlab prompt outside the context of ‘OpenWindow’.

This problem has some similarity to the one reported in:
Screen() Failure for macOS Sierra 10.12
but also possibly and some remote similarity to MAC OS PsychError_InvalidWindowRecord for Catalina although the latter one has too little information and is not quite identical.

Can you check if demos like the ones you ran here, LinesDemo, DrawSomeTextDemo, etc. do work after a restart of Matlab without using the Screen(‘Preference’,‘ConserveVRAM’, 512); ie. with regular error handling enabled? I’d assume they fail as well, because what happens inside UpdatePsychtoolbox is just opening a hidden onscreen window and drawing a little text string - this to trigger a potential update of the fontconfig database if needed.

It executes this sequence :

Assuming this all fails as well, because it is some weird interaction bug between OpenGL calls and other code that has nothing to do with OpenGL and should not cause such an error at all, it is time to get out the big guns. The following Technical note teaches you how to install and use Apples OpenGL Profiler, attach it to the running (freshly started!) Matlab process, set a breakpoint on OpenGL errors and start tracing. Then run a test sequence:

PsychDebugWindowConfiguration;
w = Screen(‘Openwindow’, 0);
sca;

The profiler should halt Matlab execution once the OpenGL error is encountered during ‘Openwindow’ and the trace should hopefully point in the general direction of where the problem happens.

Dear Mario
Thank you. Things have changed (for the better), though I don’t understand why.

Restarting MATLAB and running just the code you pointed me to from UpdatePsychtoolbox produces the same error that I reported from UpdatePsychtoolbox.

INTERNAL PSYCHTOOLBOX ERROR
error: Psycherror_OpenGL
general description: OpenGL call returned an error
specific description: GL_INVALID_FRAMEBUFFER_OPERATION_EXT
module name: Screen
subfunction call: OpenWindow
file name: /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/PsychTextureSupport.c
function name: PsychCreateTexture
line number: 166
Something went wrong with text renderer setup. Read ‘help DrawTextPlugin’ for troubleshooting.

With fresh start of MATLAB.
LinesDemo runs fine.
DrawSomeTextDemo runs fine.
InitializeMatlabOpenGL(, 1, 1); runs fine
PerceptualVBLSyncTest runs fine
This block of code you gave me runs fine.

PsychDebugWindowConfiguration;
w = Screen(‘Openwindow’, 0);
glClear(GL.COLOR_BUFFER_BIT);
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL.COLOR_BUFFER_BIT);
v = glReadPixels(0, 0, 1, 1, GL.RED, GL.UNSIGNED_BYTE)
glPixelStorei(GL.UNPACK_ALIGNMENT, 1);
glClearColor(1,1,1,1);
glGetString(GL.VENDOR)
glGetString(GL.RENDERER)
glGetString(GL.VERSION)
glGetString(GL.EXTENSIONS)
sca;

I ran
Screen(‘Preference’,‘ConserveVRAM’, 512);
Followed by the code from UpdatePsychtoolbox.
It ran fine.
After restarting MATLAB
DrawFormattedTextDemo
runs fine.
And UpdatePsychtoolbox runs fine!

Thus, the ONLY error I now find is the section of UpdatePsychtoolbox fails when run alone without Screen(‘Preference’,‘ConserveVRAM’, 512);

I don’t understand why the error I originally reported for UpdatePsychtoolbox is gone. It seemed solid when I reported it. Now it’s gone. Now the error appears only when I run the section of UpdatePsychtoolbox code that you pointed me to:

if ~IsLinux
% If this is not Linux, then open an invisible onscreen window and
% draw some dummy text with the plugin text renderer, just to
% trigger a (re-)build of the fontconfig cache if that should prove
% neccessary. Such a rebuild can take many seconds to even minutes
% and looks to the user like a hang, so do it here, with proper
% warning. We skip this on Linux, as the OS will take care of
% proper rebuilds appropriately, so we don’t expect to ever run
% into this problem:
fprintf(‘Trying to trigger an update of the fontconfig cache if that should prove neccessary.\n’);
fprintf(‘This may take a couple of seconds, or sometimes even minutes. Please be patient…\n’);
drawnow;
oldRenderer = Screen(‘Preference’, ‘TextRenderer’, 1);
oldLevel = Screen(‘Preference’, ‘WindowShieldingLevel’, -1);
oldVerbo = Screen(‘Preference’, ‘Verbosity’, 0);
oldTsMode = Screen(‘Preference’, ‘VBLTimestampingmode’, -1);
try
win = Screen(‘OpenWindow’, 0, 0, [0 0 100 100]);
Screen(‘DrawText’, win, ‘Ola!’);
Screen(‘Flip’, win);
Screen(‘CloseAll’);
catch
fprintf(‘Something went wrong with text renderer setup. Read ‘‘help DrawTextPlugin’’ for troubleshooting.\n\n\n’);
end
Screen(‘Preference’, ‘TextRenderer’, oldRenderer);
Screen(‘Preference’, ‘WindowShieldingLevel’, oldLevel);
Screen(‘Preference’, ‘Verbosity’, oldVerbo);
Screen(‘Preference’, ‘VBLTimestampingmode’, oldTsMode);
end

The only explanation I can think of is that you’ve fixed something in the master, and I’ve updated my code here by running UpdatePsychtoolbox.
Best
Denis

There hasn’t been any change wrt. macOS from my side. Does UpdatePsychtoolbox work even after you restart Matlab? There isn’t anything in UpdatePsychtoolbox apart from that snippet that touches OpenGL, so they should behave the same under same starting conditions.

My best guess would be to try the snippet with the ‘WindowShieldingLevel’ calls removed. Those make sure the “onscreen window” is created in an invisible state, as we don’t want to popup a window that serves no real purpose and just distracts or confuses. Maybe the iToys company broke something wrt. rendering into hidden windows if the 10.15 SDK with which the mex file was build it more recent than the <= 10.14 macOS it is running on?

-mario

Ok, fixed in latest beta release. Needless to say it was another screwup by Apple which we work around now. macOS Catalina is a gift that keeps giving…

The last two weeks alone created a loss of 1000 Euros in unpaid work time spent dealing with Apples screwups after accounting for a user paying for priority support. If not many more labs will start contributing soon by buying our new services, and Apple continues to suck as much as they did the last 10 years, supporting macOS really makes no business sense, except as a gigantic charity act. And i’m getting tired of charity acts. So far the uptake is underwhelming. But lets see what next year brings…

1 Like