title: How to magnify/stretch a texture with Matlab Psychtoolbox (OpenGL)?
body: <p>Update: This only seems to be a problem at some computers. The normal, intuitive code seems to work fine one my home computer, but the computer at work has trouble.</p>
  
  <p>Home computer: (no problems)</p>
  
  <ul>
  <li>Windows XP Professional SP3</li>
  <li>AMD Athlon 64 X2 3800+ Dual Core 2.0 GHz</li>
  <li>NVIDIA GeForce 7800 GT</li>
  <li>2 GB RAM</li>
  </ul>
  
  <p>Work computer: (this question applies to this computer)</p>
  
  <ul>
  <li>Windows XP Professional SP3</li>
  <li>Intel Pentium 4 2.8 Ghz (dual core, I think)</li>
  <li>Intel 82945G Express Chipset Family</li>
  <li>1 GB RAM</li>
  </ul>
  
  <h2>Original post:</h2>
  
  <p>I'm trying to apply a very simple texture to a part of the screen using Psychtoolbox in Matlab with the following code:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Now I would expect to see this (four equally sized squares):</p>
  
  <p><a href="https://i.stack.imgur.com/prDb5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/prDb5.png" alt="Expected result"></a>
  </p>
  
  <p>But instead I get this (right and bottom sides are cut off and top left square is too large):</p>
  
  <p><a href="https://i.stack.imgur.com/ztuqH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ztuqH.png" alt="Actual result"></a>
  </p>
  
  <p>Obviously the destination rectangle is a lot bigger than the source rectangle, so the texture needs to be magnified. I would expect this to happen symmetrically like in the first picture and this is also what I need. Why is this not happening and what can I do about it?</p>
  
  <p>I have also tried using [128 0 1152 1024] as a destination rectangle (as it's the square in the center of my screen). In this case, all sides are 1024, which makes each involved rectangle a power of 2. This does not help.
  Increasing the size of the checkerboard results in a similar situation where the right- and bottommost sides are not showed correctly.</p>
  
  <p>Like I said, I use Psychtoolbox, but I know that it uses OpenGL under the hood. I don't know much about OpenGL either, but maybe someone who does can help without knowing Matlab. I don't know.</p>
  
  <p>Thanks for your time!</p>