# Program to test hint() with transparency

**URL:** <https://discourse.processing.org/t/program-to-test-hint-with-transparency/4361>\
**Category:** Gallery\
**Created:** [October 11, 2018, 2:24pm UTC](https://discourse.processing.org/t/program-to-test-hint-with-transparency/4361 "2018-10-11T14:24:45Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [November 19, 2019, 12:28pm UTC](https://discourse.processing.org/t/program-to-test-hint-with-transparency/4361/5 "2019-11-19T12:28:44Z")

</div>

Ok, thanks to your examples I made version 2 🙂

Main change is subtle but important: show spheres. With spheres performance and sorting issues are much more obvious.

```auto
class Hint {
  private int y;
  private String name;
  private boolean active;
  private int ON_CONST;
  private int OFF_CONST;
  Hint(int y, String name, boolean active, int ON, int OFF) {
    this.y = y;
    this.name = name;
    this.active = active;
    this.ON_CONST = ON;
    this.OFF_CONST = OFF;
    call_hint();
  }
  void toggle() {
    active = !active;
  }
  void call_hint() {
    hint(active ? ON_CONST : OFF_CONST);
  }
  void draw() {
    text(name + " " + active, 20, y);
  }
  void mousePressed() {
    if (mouseY > y - 15 && mouseY < y + 5) {
      toggle();
      call_hint();
    }
  }
}

Hint[] hints;
boolean useSphere;

void setup() {
  size(800, 600, P3D);

  hints = new Hint[] {
    new Hint(40, "DEPTH_TEST", false, ENABLE_DEPTH_TEST, DISABLE_DEPTH_TEST), 
    new Hint(60, "DEPTH_SORT", false, ENABLE_DEPTH_SORT, DISABLE_DEPTH_SORT), 
    new Hint(80, "DEPTH_MASK", false, ENABLE_DEPTH_MASK, DISABLE_DEPTH_MASK), 
    new Hint(100, "OPTIMIZED_STROKE", true, ENABLE_OPTIMIZED_STROKE, DISABLE_OPTIMIZED_STROKE), 
    new Hint(120, "STROKE_PERSPECTIVE", false, ENABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PERSPECTIVE)
  };
}

void draw() {
  background(255);

  fill(0);
  for (Hint h : hints) {
    h.draw();
  }
  text("<- use the mouse to toggle settings", 200, 40);
  text("click here to toggle shape", 300, 580);

  fill(255, 40, 20, 100);  
  translate(width/2, height/2);
  rotateY(frameCount * 0.005);

  for (int x = -200; x<=200; x+=200) {
    for (int y = -200; y<=200; y+=200) {
      pushMatrix();
      translate(x, 0, y);
      if (useSphere) {
        sphere(90);
      } else {
        box(180);
      }
      popMatrix();
    }
  }
}
void mousePressed() {
  if (mouseY > 150) {
    useSphere = !useSphere;
  } else {
    for (Hint h : hints) {
      h.mousePressed();
    }
  }
}

```

---

_[View the full topic](https://discourse.processing.org/t/program-to-test-hint-with-transparency/4361)._
