# using globalAlpha in DrawTexture to modulate contrast

**URL:** <https://psychtoolbox.discourse.group/t/using-globalalpha-in-drawtexture-to-modulate-contrast/459>\
**Category:** Uncategorized\
**Created:** [January 20, 2012, 6:56pm UTC](https://psychtoolbox.discourse.group/t/using-globalalpha-in-drawtexture-to-modulate-contrast/459 "2012-01-20T18:56:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xrli2002](https://avatars.discourse-cdn.com/v4/letter/x/48db29/32.png) [@xrli2002](https://psychtoolbox.discourse.group/u/xrli2002)\
**Post date:** [January 20, 2012, 6:56pm UTC](https://psychtoolbox.discourse.group/t/using-globalalpha-in-drawtexture-to-modulate-contrast/459/1 "2012-01-20T18:56:02Z")

</div>

Screen('DrawTexture', w, tex, [], [], 0, 1, globalAlpha);  
is an effective way to change contrast on the fly. However, I recently found that it doesn't work on some computers, specifically one Windows XP laptop and one MacBook. The same code works on desktops, even with very low end graphic card.  
  
When it doesn't work, the contrast is always that of the texture. Changing globalAlpha won't affect the contrast at all.  
  
I tried more and found that this problem happens only when PsychImaging is used.  
  
Below is the mini code to test it. It should show very low (5%) contrast, but on the laptops where it fails, it is black-white.  
  
Does anyone have the similar problem? Did I miss anything? Thanks.  
  
-Xiangrui  
  
%==============================  
whichScreen = max(Screen('screens'));  
  
% w = Screen('OpenWindow', whichScreen, 127); % no problem always  
  
PsychImaging('PrepareConfiguration');   
PsychImaging('AddTask', 'General', 'FloatingPoint32Bit');  
w = PsychImaging('OpenWindow', whichScreen, 127);  
  
% 100% contrast texture  
tex = Screen('MakeTexture', w, Expand([0 1], 100, 200), 0, 0 2); Screen('BlendFunction', w, 'GL\_SRC\_ALPHA', 'GL\_ONE\_MINUS\_SRC\_ALPHA');  
Screen('DrawTexture', w, tex, [], [], 0, 1, 0.05); % 5% contrast  
Screen('Flip', w);  
KbWait;  
sca;
