【发布时间】:2021-02-02 00:34:59
【问题描述】:
我正在尝试创建一个球或点或任何从左下角到右下角然后右上角然后左上角然后在开始左下角的东西。基本上围绕屏幕。总的来说,全屏很重要。对于全屏图形,我使用的是 WindowAPI。
这是我的代码。
try
% Create a figure to operate on: --------------------------------------------
% The OpenGL renderer is confused by the alpha blending, so Painters is used:
FigH = figure('Color', ones(1, 3), 'Renderer', 'Painters');
axes('Visible', 'off', 'Units', 'normalized', 'Position', [0, 0, 1, 1]);
% Set topmost status:
WindowAPI(FigH, 'topmost'); % Command is not case-sensitive
drawnow;
WindowAPI(FigH, 'TopMost', 0);
drawnow;
WindowAPI(FigH, 'front');
drawnow;
% Nicer to have the figure on topmost for the rest of the demo:
WindowAPI(FigH, 'topmost');
% Special maximizing such that the inner figure fill the screen:
WindowAPI(FigH, 'Position', 'full'); % Complete monitor
% START MOVING BALL
X = 2;
Y = 0;
for i=1:1490
X = X + 0.1;
Y = 2
plot(X,Y,'or','MarkerSize',20,'MarkerFaceColor','r')
axis([0 151 0 85])
pause(0)
end
% END MOVING BALL
end
为简单起见,点仅从左下角到右下角。 但是有两个问题。
- 点滞后有时是个问题。
- 有可见的黑线(来自图表)。
而且我不知道如何解决这两个问题。因此,如果您知道如何修复它们或任何更好的方法如何在 Matlab 中为球设置动画,请在此处发布。感谢您的宝贵时间。
【问题讨论】:
-
将
axis off添加到末尾,在pause(0)之前。滞后是不可避免的,MATLAB 不是实时渲染器 -
@AnderBiguri 谢谢。如果我可能会问有没有其他方法可以在没有滞后的情况下在 matlab 中做到这一点?当然,据你所知。
-
购买一台具有更多 RAM 和 GPU 的更好的计算机.... MATLAB 不是实时渲染器,它不是为此而设计的。为什么需要它?
-
谢谢。我可能会尝试团结。
-
当然,MATLAB 和 Unity 之间的常见用例为零。如果 Unity 是一个选项,那么 MATLAB 不应该是....
标签: matlab graph eye-tracking