1
void draw(){
//3Dmap
  scale = 1+scaleFactor;
  background(100);

  pushMatrix();
  translate(width/2+transX, height/2.5+transY, 0);
  rotateX(rotX);
  rotateY(-rotY);
  scale(scale);
  imageMode(CENTER);
  image(nyc_map, 0, 0, mapSize, mapSize);
  image(compass,0,0,100,100);

  popMatrix();

  //UI

  box.display();
  resetMap.update();
  resetMap.render();

  playButton.update();
  playButton.render();
}

//rotation part
void mouseDragged() {
  rotY  -= (mouseX-pmouseX) * 0.01;
  rotX -= (mouseY-pmouseY) * 0.01;
}

void mouseWheel(MouseEvent event) {
  float e = event.getCount();
  scaleFactor += e * 0.001;
}

when I rotating my main map it's keep overlapped my interactive part. How can I set it to always in the back layer?

this is when program started

when I'm rotate it in z dimension it's overlap my ui obj.

Thian
  • 11
  • 1
  • You can use the z-buffer to control the order in which objects are drawn. To do this, you first need to enable depth testing with the glEnable(GL_DEPTH_TEST) function. Then, you can use the glDepthFunc(GL_LEQUAL) function to specify that objects should only be drawn if they are less than or equal to the depth of the pixel they are being drawn to. This will ensure that objects are drawn in the correct order, with the closest objects being drawn first. – Mohamed Elgazar Oct 16 '22 at 12:10

0 Answers0