800 Rectangles

Andreas,

There is no real problem here, and for this you do not even need to invoke the use of textures.
In the OpenGL toolbox, nothing appears on screen until you issue a screen flip command

So your bit of code could look like:

Screen('FillRect', window, gray);
[h,v]=WindowSize(window); % to make this somewhat resolution independent
% create a screen with 800 items on it
for j = 1:800
posx = round(rand * h);
posy = round(rand * v);
...
...
Screen('FillRect', window, colorTarget ,[ posx posy posx+sizeX posy+sizeY]);
end

Screen('Flip', window); % show rectangles on screen

So, in fact it is simpler.
Of course, the above assumes there is enough time to do this (i.e. you don't need to
do a new screen every frame at very high refresh).

You could also take a look at dotdemo.m in the PsychDemo folder, which shows a way of drawing many dots (of different sizes) using one Screen Drawdots command.


Gr.
Frans





btw: about the whole think in textures problem. I really need to
create my displays before the experiment. my display contains of maybe
up to 800 rects so I rather compute everything before the experiment:

BigScreens(i) = Screen(window,'OpenOffscreenWindow');
Screen(BigScreens(i),'FillRect', gray);

% create a screen with 800 items on it
for j = 1:800

posx = rand * 1024;
posy = rand * 786;
...
...
Screen(BigScreens(i),'FillRect', colorTarget ,[ posx posy
posx+sizeX posy+sizeY]);
end

how would you translate this into textures?

cheers,
andreas

-----------------------------------------------------------------------------------------------------------------
Laboratory of Experimental Ophthalmology & BCN NeuroImaging Centre, School of Behavioural and Cognitive Neurosciences, University Medical Centre Groningen,
PO Box 30.001, Groningen 9700 RB, The Netherlands,
Email: f.w.cornelissen@..., Tel: +31 (0) 50-3614173