# Problem with MakeTexture

**URL:** <https://psychtoolbox.discourse.group/t/problem-with-maketexture/700>\
**Category:** Uncategorized\
**Created:** [August 29, 2010, 9:13am UTC](https://psychtoolbox.discourse.group/t/problem-with-maketexture/700 "2010-08-29T09:13:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tattooed.tentacle](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@tattooed.tentacle](https://psychtoolbox.discourse.group/u/tattooed.tentacle)\
**Post date:** [August 29, 2010, 9:13am UTC](https://psychtoolbox.discourse.group/t/problem-with-maketexture/700/1 "2010-08-29T09:13:10Z")

</div>

Hi, this is on a MBP (NVidia 9600M) running 10.6.4 (+graphics update) and Matlab 2010a. If I use ColorRange to let me use 0-1 as a color range, MakeTexture fails to use this range, so if I make a simple texture:  
  
[window winrect]=Screen('OpenWindow', 0, 128);  
Screen('ColorRange', window, 1.0)  
white=WhiteIndex(window); %this returns 1 as expected  
black=BlackIndex(window); %this returns 0 as expected  
gray=GrayIndex(window); %this returns 0.5 as expected  
tex=ones(100,5,3)\*white; %a 100x5px bar filled white  
ti=Screen('MakeTexture',window,tex);  
for i=1:240  
 Screen('DrawTexture', window, ti,[],[],45)  
 Screen('Flip',window);  
end  
  
I see a black bar. If I fill the texture with 255 it becomes white, so it appears to be ignoring the ColorRange command. Indeed If I add in a precedural grating into the same code:  
  
tb=CreateProceduralSineGrating(window, 128,128,[gray gray gray 1]);  
...  
Screen('DrawTexture', window, tb, [],[], 45, [], [], [], [],[], [0,0.02,0.25,1]);  
...  
  
Then this works as expected (mid-level grating). Not sure if I'm missing something (sunday morning coding not always a good idea!), or this is genuinely a bug. I've tried setting up the window using PsychImaging and 'NormalizedHighresColorRange' etc. and see the same thing.  
  
Ian
