# How draw rect() with texture with alpha channel?

**URL:** https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755
**Category:** Coding Questions
**Created:** [June 1, 2019, 8:50am UTC](https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755 "2019-06-01T08:50:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![erkosone](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@erkosone](https://discourse.processing.org/u/erkosone)
#### Post date: [June 1, 2019, 8:50am UTC](https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755/1 "2019-06-01T08:50:51Z")

</div>

i have this problem… in 2d the problem not exists… but in 3d when i draw boxes… apears background color in sprites…

sprites are drawed with a simple shape with rect()

 ![Captura](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f6f4f0955d44aa3b317f1a0d6c0fba130c12f9a2.png)

---

<div class="post-metadata">

### Author: ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)
#### Post date: [June 1, 2019, 9:00am UTC](https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755/2 "2019-06-01T09:00:49Z")

</div>

Maybe try using `image()` instead? It works for me:

```auto
PImage img_mnk;

void setup(){
  size(400,400,P3D);
  img_mnk = loadImage("http://www.tfguy44.com/games/data/monkey.png");
}

void draw(){
  background(128);
  translate(200,200);
  rotateY(map(mouseX,0,width,-PI,PI));
  image(img_mnk,-40,-40);
}

```

---

<div class="post-metadata">

### Author: ![erkosone](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@erkosone](https://discourse.processing.org/u/erkosone)
#### Post date: [June 1, 2019, 9:53am UTC](https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755/3 "2019-06-01T09:53:02Z")

</div>

Sorry… i draw shapes on PGraphics object,

---

<div class="post-metadata">

### Author: ![erkosone](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@erkosone](https://discourse.processing.org/u/erkosone)
#### Post date: [June 1, 2019, 11:11am UTC](https://discourse.processing.org/t/how-draw-rect-with-texture-with-alpha-channel/11755/4 "2019-06-01T11:11:51Z")

</div>

i prepare an example to test it.
