why is get upside down with opengl
in
Core Library Questions
•
1 year ago
With processing 1.5.1, what is the logic behind the y position being upside down for getting a color?
- import processing.opengl.*;
- void setup() {
- size(300, 300, OPENGL);
- colorMode(HSB, 360, 100, 100);
- }
- color c;
- void draw() {
- background(c);
- colorPallete(10, 10, width-20, height-20);
- c = get(mouseX, mouseY);
- println(get(mouseX, mouseY));
- }
- void colorPallete(float xPos, float yPos, float width, float height) {
- float h, s, b;
- for (int x = 0; x < width; x++) {
- h = map(x, 0, width, 0, 360);
- for (int y = 0; y < height; y++) {
- s = map(y, 0, height, 0, 100);
- stroke(h, s, 100);
- point(x+xPos, y+yPos);
- }
- }
- }
1