# Is there a way to draw rectangles in WebGL mode without it being affected by the camera?

**URL:** <https://discourse.processing.org/t/is-there-a-way-to-draw-rectangles-in-webgl-mode-without-it-being-affected-by-the-camera/28814>\
**Category:** Coding Questions\
**Created:** [March 24, 2021, 11:44pm UTC](https://discourse.processing.org/t/is-there-a-way-to-draw-rectangles-in-webgl-mode-without-it-being-affected-by-the-camera/28814 "2021-03-24T23:44:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rbrauer](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@rbrauer](https://discourse.processing.org/u/rbrauer)\
**Post date:** [March 25, 2021, 2:52pm UTC](https://discourse.processing.org/t/is-there-a-way-to-draw-rectangles-in-webgl-mode-without-it-being-affected-by-the-camera/28814/2 "2021-03-25T14:52:42Z")

</div>

You can use `camera()` with no arguments to reset the camera matrix. See the thread linked below for how to turn off depth testing so that the UI is drawn on top of the 3D scene.

```javascript
let gl;

function setup() {
  createCanvas(400, 400, WEBGL);
  gl = document.getElementById('defaultCanvas0').getContext('webgl');
}

function draw() {
  background(220);
  
  camera(
    cos(frameCount * 0.01) * 200, 0, 
    sin(frameCount * 0.01) * 200, 
    0, 0, 0, 
    0, 1, 0
  );
  box(50);

  camera();
  gl.disable(gl.DEPTH_TEST);
  rect(0, 0, 200, 200);
  gl.enable(gl.DEPTH_TEST);
}

```

> [@hint(DISABLE\_DEPTH\_TEST) in P5](https://discourse.processing.org/t/hint-disable-depth-test-in-p5/5595/):
>
> Hey everybody, do you know how to get the same functionality of the hint function in P5? Cannot seem to find it anywhere. Thank you!

---

_[View the full topic](https://discourse.processing.org/t/is-there-a-way-to-draw-rectangles-in-webgl-mode-without-it-being-affected-by-the-camera/28814)._
