# P3D hint() with 2D depth sort not working

**URL:** <https://discourse.processing.org/t/p3d-hint-with-2d-depth-sort-not-working/15080>\
**Category:** Coding Questions\
**Created:** [October 31, 2019, 6:19pm UTC](https://discourse.processing.org/t/p3d-hint-with-2d-depth-sort-not-working/15080 "2019-10-31T18:19:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeorgeJava](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/georgejava/32/7646_2.png) [@GeorgeJava](https://discourse.processing.org/u/GeorgeJava)\
**Post date:** [October 31, 2019, 6:19pm UTC](https://discourse.processing.org/t/p3d-hint-with-2d-depth-sort-not-working/15080/1 "2019-10-31T18:19:30Z")

</div>

Hello i want to create layer system and i cant ENABLE\_DEPTH\_SORT in a hint…  
Its resizing… yeah one of two objects gets before and after when i moving mouse, but i want to make it without sizing… 😕 can you help me ?

```auto
void setup() {
  size(500, 500, P3D);

  ((PGraphicsOpenGL)g).textureSampling(3);
  hint(ENABLE_DEPTH_SORT);
}

void draw() {
  background(0);

  pushMatrix();
  translate(0, 0, 100);
  fill(255, 0, 0);
  rect(100, 100, 200, 300);
  popMatrix();

  pushMatrix();
  translate(0, 0, mouseX);
  fill(0, 255, 0);
  rect(200, 100, 200, 300);
  popMatrix();
}

```

---

<div class="post-metadata">

**Author:** ![GeorgeJava](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/georgejava/32/7646_2.png) [@GeorgeJava](https://discourse.processing.org/u/GeorgeJava)\
**Post date:** [November 1, 2019, 8:19pm UTC](https://discourse.processing.org/t/p3d-hint-with-2d-depth-sort-not-working/15080/2 "2019-11-01T20:19:40Z")

</div>

Just want to set ortho 😃 🙂

Standart basic ortho:

> ortho(-width/2, width/2, -height/2, height/2);

here is the one line change, wich working as i want 😃

```auto
void setup() {
  size(500, 500, P3D);

  ((PGraphicsOpenGL)g).textureSampling(3);
  hint(ENABLE_DEPTH_SORT);
  ortho(-width/2, width/2, -height/2, height/2);
}

void draw() {
  background(0);

  pushMatrix();
  translate(0, 0, 100);
  fill(255, 0, 0);
  rect(100, 100, 200, 300);
  popMatrix();

  pushMatrix();
  translate(0, 0, mouseX);
  fill(0, 255, 0);
  rect(200, 100, 200, 300);
  popMatrix();
}

```
