更新:这似乎只是某些计算机的问题。正常、直观的代码在我的家用电脑上似乎可以正常工作,但工作中的电脑有问题。
家用电脑:(没问题)
- Windows XP 专业版 SP3
- AMD 速龙 64 X2 3800+ 双核 2.0 GHz
- 英伟达 GeForce 7800 GT
- 2 GB 内存
工作电脑:(这个问题适用于这台电脑)
- Windows XP 专业版 SP3
- Intel Pentium 4 2.8 Ghz(我认为是双核)
- 英特尔 82945G Express 芯片组系列
- 1 GB 内存
原帖:
我正在尝试使用 Matlab 中的 Psychtoolbox 将一个非常简单的纹理应用于屏幕的一部分,代码如下:
win = Screen('OpenWindow', 0, 127); % open window and obtain window pointer
tex = Screen('MakeTexture', win, [255 0;0 255]); % get texture pointer
% draw texture. Args: command, window pointer, texture pointer, source
% (i.e. the entire 2x2 matrix), destination (a 100x100 square), rotation
% (none) and filtering (nearest neighbour)
Screen('DrawTexture', win, tex, [0 0 2 2], [100 100 200 200], 0, 0);
Screen('Flip', win); % flip the buffer so the texture is drawn
KbWait; % wait for keystroke
Screen('Close', win); % close screen
现在我希望看到这个(四个大小相同的正方形):
但相反,我得到了这个(右侧和底部被切断,左上角太大):
显然目标矩形比源矩形大很多,所以需要放大纹理。我希望这会像第一张图片一样对称地发生,这也是我需要的。为什么这没有发生,我能做些什么呢?
我也尝试使用 [128 0 1152 1024] 作为目标矩形(因为它是我屏幕中心的正方形)。在这种情况下,所有边都是 1024,这使得每个涉及的矩形都是 2 的幂。这没有帮助。增加棋盘的大小会导致类似的情况,即无法正确显示右侧和最底部。
就像我说的,我使用 Psychtoolbox,但我知道它在后台使用 OpenGL。我对 OpenGL 也不太了解,但也许有人可以在不了解 Matlab 的情况下提供帮助。我不知道。
谢谢你的时间!