other way for ENABLE_DEPTH_SORT
in
Core Library Questions
•
11 months ago
On the image the grid is a png image with transparency.
The 2 lines have the same length, only if i draw it before the image the whole line will be shown.
If i draw it after the image only the part in front of the image is show.
If i use hint(ENABLE_DEPTH_SORT) then the problem is fixed for this sketch.
Only in the sketch where i need it it drops the framerate from 30 to around 5 and makes stuff dissapear on certain frames and give other strange result.
I could split the methods i have up in 2 methos, one to draw before the image and one after the image to get around this problem.
But i was wondering, are there any other ways to get around this method?
- import processing.opengl.*;
- PImage img;
- void setup() {
- size(400, 400, OPENGL);
- // hint(ENABLE_DEPTH_SORT);
- img = loadImage("grid_2048.png");
- }
- void draw() {
- background(color(map(mouseX, 0, width, 0, 255), 200, 200));
- translate(width/2, height/2);
- rotateX(map(mouseY, 0, height, -TWO_PI, TWO_PI));
- rotateY(map(mouseX, 0, width, -TWO_PI, TWO_PI));
- imageMode(CENTER);
- line(50, 0, -100, 50, 0, 100);
- image(img, 0, 0);
- stroke(255, 0, 0);
- line(0, 0, -100, 0, 0, 100);
- }
here below is the gird image (which is white...)
1