Skip to content

Commit 04bb49c

Browse files
committed
Issue #199 Virtual framebuffer to reduce missed FillRect
1 parent 98887dd commit 04bb49c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

+hw/+ptb/Window.m

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
% When true test synchronization to retrace upon open. Defaults to
5050
% global preference (usually true). See 'Screen SkipSyncTests?'
5151
PtbSyncTests
52+
% When on, the PsychImaging pipeline is activated and a virtual
53+
% framebuffer is used
54+
VirtualFramebuffer matlab.lang.OnOffSwitchState = 'off'
5255
end
5356

5457
properties (SetAccess = protected)
@@ -283,8 +286,15 @@ function open(obj)
283286
% Perhaps this shouldn't be set after setting 'Verbosity'?
284287

285288
% setup screen window
286-
obj.PtbHandle = Screen('OpenWindow', obj.ScreenNum, obj.BackgroundColour,...
287-
obj.OpenBounds, obj.PxDepth);
289+
if obj.VirtualFramebuffer == "on"
290+
PsychImaging('PrepareConfiguration');
291+
PsychImaging('AddTask', 'General', 'UseVirtualFramebuffer');
292+
obj.PtbHandle = PsychImaging('OpenWindow', ...
293+
obj.ScreenNum, obj.BackgroundColour, obj.OpenBounds, obj.PxDepth);
294+
else
295+
obj.PtbHandle = Screen('OpenWindow', ...
296+
obj.ScreenNum, obj.BackgroundColour, obj.OpenBounds, obj.PxDepth);
297+
end
288298
obj.PxDepth = Screen('PixelSize', obj.PtbHandle);
289299
obj.Bounds = Screen('Rect', obj.PtbHandle);
290300

0 commit comments

Comments
 (0)