# New PTB, macOS Mojave, DrawText plugin problem?

**URL:** <https://psychtoolbox.discourse.group/t/new-ptb-macos-mojave-drawtext-plugin-problem/3562>\
**Category:** Bugs & Features\
**Tags:** macos\
**Created:** [December 6, 2020, 4:37am UTC](https://psychtoolbox.discourse.group/t/new-ptb-macos-mojave-drawtext-plugin-problem/3562 "2020-12-06T04:37:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [December 7, 2020, 12:11pm UTC](https://psychtoolbox.discourse.group/t/new-ptb-macos-mojave-drawtext-plugin-problem/3562/4 "2020-12-07T12:11:44Z")

</div>

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](https://psychtoolbox.discourse.group/t/screen-failure/3499) for macOS Sierra 10.12  
but also possibly and some remote similarity to [MAC OS PsychError\_InvalidWindowRecord](https://psychtoolbox.discourse.group/t/mac-os-psycherror-invalidwindowrecord/3557) 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 :

> <https://github.com/kleinerm/Psychtoolbox-3/blob/bbd6ca0f2c5e3547eadb8c012146c38cc717a837/Psychtoolbox/PsychtoolboxPostInstallRoutine.m#L661>

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.

> **[Technical Note TN2178: Real world profiling with the OpenGL Profiler](https://developer.apple.com/library/archive/technotes/tn2178/_index.html#//apple_ref/doc/uid/DTS40007990-CH1-SECTION1)**

---

_[View the full topic](https://psychtoolbox.discourse.group/t/new-ptb-macos-mojave-drawtext-plugin-problem/3562)._
