# Drawing dots in psychtoolbox

**URL:** <https://psychtoolbox.discourse.group/t/drawing-dots-in-psychtoolbox/1429>\
**Category:** Uncategorized\
**Created:** [July 3, 2002, 11:53pm UTC](https://psychtoolbox.discourse.group/t/drawing-dots-in-psychtoolbox/1429 "2002-07-03T23:53:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [July 3, 2002, 11:53pm UTC](https://psychtoolbox.discourse.group/t/drawing-dots-in-psychtoolbox/1429/1 "2002-07-03T23:53:55Z")

</div>

I'm trying to write a coherent motion stimuli where one of the   
variables is dot density on the screen. As I want the upper dot   
densities to be quite high, I am would like to be able to draw   
thousands of dots for each of at least 8 frames, which are   
generated off screen, saved and played as a movie.  
  
While the speed is acceptable for numbers of dots not   
exceeding 500, past this the trial latency is too high. I am   
currently using the SCREEN 'fillOval' function to draw each dot at   
a given coordinate. Making my way through past posts I came   
across someones suggestion of writing a mex file - is this also a   
solution that would speed up my program?  
  
If anyone knows a method to speed up the drawing of a large   
number of dots to an off screen window, please let me know,  
  
Thanks in advance,  
  
Craig Chapman
