# Processing rectMode()

**URL:** <https://discourse.processing.org/t/processing-rectmode/3332>\
**Category:** Processing\
**Created:** [September 6, 2018, 9:39pm UTC](https://discourse.processing.org/t/processing-rectmode/3332 "2018-09-06T21:39:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![creepercrack](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Post date:** [September 6, 2018, 9:39pm UTC](https://discourse.processing.org/t/processing-rectmode/3332/1 "2018-09-06T21:39:49Z")

</div>

I think there is a bug with rectMode() in processing 3.4

rectMode() is affecting the way text gets drawn on the screen.

```auto
background(0);

text("Text 1", 0, 0, 100, 100);
rectMode(CENTER);
text("Text 2", 0, 30, 100, 100);
rectMode(CORNER);
text("Text 3", 0, 60, 100, 100);

```

![Sin%20t%C3%ADtulo](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4836ade8bb540017f58b7ae14e580649e92717ac.png)

In this example all 3 texts should get drawn inside the screen, but when changing the rectMode(), the text gets drawn outside of the screen.  
If you comment out or delete the rectMode() lines, all 3 texts gets drawn inside the screen as they should.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [September 7, 2018, 12:32am UTC](https://discourse.processing.org/t/processing-rectmode/3332/2 "2018-09-07T00:32:06Z")

</div>

pls see [text](https://processing.org/reference/text_.html)

The **x2** and **y2** parameters define a rectangular area to display within and may only be used with string data. When these parameters are specified, they are interpreted based on the current **rectMode()** setting. Text that does not fit completely within the rectangle specified will not be drawn to the screen.

and try:

```auto
background(0);

text("Text 1", 0, 0, 100, 100);
rectMode(CENTER);
text("Text 2", 0, 30);
//text("Text 2", 0, 30, 100, 100);
rectMode(CORNER);
text("Text 3", 0, 60, 100, 100);

```

and

```auto
//text("Text 2", 0, 30);
//text("Text 2", 0, 30, 100, 100);
text("Text 2", 50, 80, 100, 100);

```

---

<div class="post-metadata">

**Author:** ![creepercrack](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Post date:** [September 7, 2018, 5:41pm UTC](https://discourse.processing.org/t/processing-rectmode/3332/3 "2018-09-07T17:41:34Z")

</div>

Ok, I’ll better read the documentation next time
