有没有办法让特定的文本/形状/图像停留在屏幕上其他对象的前面,而不会与屏幕上和屏幕外的其他对象翻转?例如,我想让固定十字准线始终停留在屏幕上,而不会随着它后面的图像而改变。
换句话说," screen (' flip ',window)“只能翻转某些形状,而不能翻转屏幕上的所有形状吗?
谢谢!
发布于 2019-10-17 02:50:01
您可以通过将to‘t clear Flag设置为1来指示翻转后不应清除帧:
Screen('Flip', wPtr, [], 1);然而,这样你就可以在框架上覆盖新的对象,但是如果你想移除它们中的任何一个,你必须将它们全部移除-下一次调用clip而不将don't clear标志设置为1将清除所有内容:
try
screenNum= max(Screen('Screens'));
Screen('Preference', 'SkipSyncTests', 1);
[wPtr, wRect]=Screen('OpenWindow', screenNum, 0);
% draw fixation, indicate that the frame buffer should not be cleared
DrawFormattedText(wPtr, '+', 'center', 'center', 255);
Screen('Flip', wPtr, [], 1);
WaitSecs(1);
% overlay a purple oval, in addition to the fixation
Screen('FillOval', wPtr, [128 0 128], [0 0 100 100])
Screen('Flip', wPtr, []);
WaitSecs(1);
% display an orange oval, this will be presented without the fixation
% unless the previous purple oval is also retained
Screen('FillOval', wPtr, [128 128 0], [100 100 200 200])
Screen('Flip', wPtr, []);
WaitSecs(1);
sca;
catch e
sca;
rethrow(e)
end如果需要在添加和移除其他对象的情况下频繁绘制固定十字,另一种选择是将固定存储为纹理,这样可以更轻松地在每一帧上重新绘制。
https://stackoverflow.com/questions/58415643
复制相似问题