# resetMatrix() has unexpected result in P3D (or, how to display "HUD" text?)

**URL:** <https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131>\
**Category:** Processing.py\
**Created:** [May 17, 2021, 11:56am UTC](https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131 "2021-05-17T11:56:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [May 17, 2021, 11:56am UTC](https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131/1 "2021-05-17T11:56:23Z")

</div>

I was trying to draw some text inside a pushMattrix/popMatrix by using resetMatrix, it works well in 2D but not in P3D, any pointers to what I’m doing wrong?

```python
size(500, 500) # then try size(500, 500, P3D)  
textSize(40)
translate(250, 250)
rotate(QUARTER_PI)
pushMatrix()
resetMatrix() # then use camera() instead!
text("Hello", 250, 250)
popMatrix()
text("Hello", 0, 0)

```

UPDATE: As per the link sent by @Chrisir, using `camera()` instead of `resetMatrix()` worked!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 17, 2021, 12:08pm UTC](https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131/2 "2021-05-17T12:08:05Z")

</div>

check #9

here [25 life-saving tips for Processing | Amnon P5 - Experiments with Processing by Amnon Owed](https://amnonp5.wordpress.com/2012/01/28/25-life-saving-tips-for-processing/)

_keywords: 2D 3D Head-up display HUD_

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [May 17, 2021, 3:48pm UTC](https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131/3 "2021-05-17T15:48:17Z")

</div>

Thanks! I guess adding `camera()` was what I was missing!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 17, 2021, 5:48pm UTC](https://discourse.processing.org/t/resetmatrix-has-unexpected-result-in-p3d-or-how-to-display-hud-text/30131/4 "2021-05-17T17:48:19Z")

</div>

**Additionally**

1

apart from that: in 3D it’s always nice to us `lights();` - use `noLights();` for the HUD

2

and avoid clipping

```auto
void avoidClipping() {
  // avoid clipping (at camera): 
  // https : // 
  // forum.processing.org/two/discussion/4128/quick-q-how-close-is-too-close-why-when-do-3d-objects-disappear
  perspective(PI/3.0, (float) width/height, 1, 1000000);
}//func 
//

```
