Drawing in textures is flipped vs. off screen windows.

Hi,

I am converting some PTB2 to PTB3 code and have come across a problem
such that drawing into textures is flipped compared to drawing in off
screen windows.

The following code should illustrate the problem

function test_texture

bgd = [127 127 127]; %background colour
p = 2; %interval duration

% Open window
screencount=size(screen('screens'),2);
if screencount>1
screenRect=screen(1,'rect');
else
screenRect=screen(0,'rect');
end

window = Screen(0, 'OpenWindow', bgd, screenRect, 32,2);
Screen('TextFont', window, 'Arial');
Screen('TextSize', window, 20);
Screen('DrawText', window, 'Please wait...', screenRect(3)/2-100,
screenRect(4)/2, 0);
Screen('Flip', window);
Screen('Flip',window,getsecs+2,1);

%Using off screen window
Screen('DrawText', window, 'OffScreen window ', screenRect(3)/2-100,
screenRect(4)/2, 0);
Screen('Flip', window);
Screen('Flip',window,getsecs+2,1);
offscrwin = Screen(window, 'OpenOffscreenWindow', bgd);
Rect=CenterRect([0 0 300 300],screenRect);
Screen('drawline',offscrwin,[255 0 0],Rect(1),Rect(2),Rect(3),Rect(4),1);

Screen('drawtexture',window, offscrwin);%, window);
Screen('Flip', window);
Screen('Flip',window,getsecs+2,1);

%Using draw texture
Screen('DrawText', window, 'Draw Texture', screenRect(3)/2-100,
screenRect(4)/2, 0);
Screen('Flip', window);
Screen('Flip',window,getsecs+2,1);
Rect=CenterRect([0 0 300 300],screenRect);
bgd_texture=repmat(127,300,300);
bgd=SCREEN('MakeTexture',window,bgd_texture);
Screen('drawline',bgd,[255 0 0],0,0,300,300,1);
Screen('DrawTexture', window,bgd);
Screen('Flip', window);
Screen('Flip',window,getsecs+2,1);

sca;

Here I draw a diagonal line into both an off screen window and a
texture - I would expect the same result when drawing on-screen
however drawing into the texture results in a flip around the vertical
axis.

I realise that drawing into textures is not the most efficient process
and reading http://psychtoolbox.org/wikka.php?wakka=FaqTextureWindow
implies that the texture is indeed flipped to "OpenGL row-major image
format". However it implies also that "After creation, they are
(nearly) synonymous."

This clearly is not the case at least on my hardware - XP SP2 with
Gforce 7600 (also verified on Gforce 6600).

So unless I am missing something here is this a bug or by design and
if so I think the Wiki should be updated to explicitly state this
fundamental difference to avoid future confusion.

Thanks,

Matthew.