# Draw Texture Destination Rect Overlap

**URL:** <https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766>\
**Category:** Programming Help\
**Created:** [January 6, 2023, 3:08am UTC](https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766 "2023-01-06T03:08:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jTneurd90](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@jTneurd90](https://psychtoolbox.discourse.group/u/jTneurd90)\
**Post date:** [January 6, 2023, 3:08am UTC](https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766/1 "2023-01-06T03:08:55Z")

</div>

I have a texture which is positioned to the left of some text however they both need to be in the center. Is there a way that I can make the destination rect layer invisible instead of having the white background, or move the text forward to the top layer  
 ![Screen Shot 2023-01-05 at 10.06.25 PM](https://global.discourse-cdn.com/free1/uploads/psychtoolbox/original/1X/1eee4347eca03edc4beb1d3880cbcc92acb635e8.png)  
?

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [January 6, 2023, 11:45am UTC](https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766/2 "2023-01-06T11:45:42Z")

</div>

You move the text to above the image by drawing the text after, not before, the image

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [January 7, 2023, 12:42am UTC](https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766/3 "2023-01-07T00:42:24Z")

</div>

And if you want to make the background of the texture transparent, you can use the alpha channel to “remove” the parts you don’t want: [RGBA] – the 4th value is alpha. When alpha is 0 or close to 0 that pixel is effectively transparent. See also my last answer for your previous question.

For bonus points and a more advanced use-case, PTB allows you to process a texture at drawing time to dynamically mask out a particular colour by adding a shader to the texture. See the `BackgroundMaskOut` option of the `CreateSinglePassImageProcessingShader` function.

But the easiest solution is @dcnieho’s answer, just change the order of drawing!

---

<div class="post-metadata">

**Author:** ![jTneurd90](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@jTneurd90](https://psychtoolbox.discourse.group/u/jTneurd90)\
**Post date:** [January 9, 2023, 10:31pm UTC](https://psychtoolbox.discourse.group/t/draw-texture-destination-rect-overlap/4766/4 "2023-01-09T22:31:16Z")

</div>

Thanks! much appreciated
