PTB-3 による刺激作成。OpenGLにまだ慣れない。
>>moviedemo
L.72
How do we draw ovals during an animation if we can not store them
within offscren or textures? Unlike QuickDraw, OpenGL is fast enought
to render all drawing commands directly to the display during an
animation loop. Except for MATLAB matrices stored in textures, there
should be no need to prerender and buffer what is displayed during
animation.
要は単に「描け」ということか。
% PTB-3:
%
% %generate textures here...
% for i=1:numberOfMovieFrames
% Screen('DrawTexture', texture(i), window);
% Screen(window, 'Flip');
% end
%
Screen 命令の基本
>> Screen
Usage:
% Activate compatibility mode: Try to behave like the old MacOS-9 Psychtoolbox:
oldEnableFlag=Screen('Preference', 'EmulateOldPTB', [enableFlag]);
% Open or close a window or texture:
[windowPtr,rect]=Screen('OpenWindow',windowPtrOrScreenNumber [,color] [,rect] [,pixelSize] [,numberOfBuffers] [,stereomode] [,multisample][,imagingmode]);
[windowPtr,rect]=Screen('OpenOffscreenWindow',windowPtrOrScreenNumber [,color] [,rect] [,pixelSize]);
textureIndex=Screen('MakeTexture', WindowIndex, imageMatrix [, optimizeForDrawAngle=0] [, specialFlags=0] [, floatprecision=0] [, textureOrientation=0] [, textureShader=0]);
Screen('Close', windowOrTextureIndex);
Screen('CloseAll');
% Draw lines and solids like QuickDraw and DirectX (OS 9 and Windows):
Screen('SelectStereoDrawBuffer', windowPtr, bufferid);
Screen('DrawLine', windowPtr [,color], fromH, fromV, toH, toV [,penWidth]);
Screen('DrawArc',windowPtr,[color],[rect],startAngle,arcAngle)
Screen('FrameArc',windowPtr,[color],[rect],startAngle,arcAngle[,penWidth] [,penHeight] [,penMode])
Screen('FillArc',windowPtr,[color],[rect],startAngle,arcAngle)
Screen('FillRect', windowPtr [,color] [,rect] );
Screen('FrameRect', windowPtr [,color] [,rect] [,penWidth]);
Screen('FillOval', windowPtr [,color] [,rect]);
Screen('FrameOval', windowPtr [,color] [,rect] [,penWidth] [,penHeight] [,penMode]);
Screen('FillPoly', windowPtr [,color], pointList);
ひとまずこのぐらいで十分。