Automatically invoke fragment shader in every flip

Ah, that was the wrong parameter. I think what should work better than specifying fbOverrideRect is this:

In ‘OpenWindow’, specify the optional imagingmode parameter as kPsychNeedClientRectNoFitter and the clientRect parameter as [0 0 1920 1080]

Yet another more elegant/high-level way would be to use a custom panelfitter task, as explained in the corresponding PsychImaging help section (cfe. PanelFitterDemo.m for other more common uses):

PsychImaging('AddTask', 'General', 'UsePanelFitter', [1920, 1080], 'Custom', [0 0 1920 1080], [0 0 1920 1080]);

But that does the same as the first low-level proposal, just with more processing overhead for this special case where source and destination region are identical, probably adding up to one millisecond of processing time. Beauty takes its time…

Edit: Note that this additional setup for convenience will make direct use of the shader with MakeTexture + DrawTexture impossible though, as DrawTexture won’t have the full “real” framebuffer to draw to anymore. Otoh., I assume the automatic ‘Flip’ method is what you wanted for all uses anyway, so it may not matter.

In principle all this kind of setup for use cases is what PsychImaging is meant to do, so it would make sense to integrate all this stuff properly into some future PTB release. But for that I’d need your permission to use all your code as a starting point for refinement - that you donate your code under PTB’s standard MIT license for inclusion. Also, more details about the specific projector and setup. I guess integrating only makes much sense if that hardware setup is easy enough to replicate for other labs, so upstream integration would benefit n > 1 labs.

-mario