njetti
YaBB Newbies
Offline
Posts: 24
|
get (pixels) problems in openGL
May 22nd, 2005, 7:29pm
(sorry about all this bug reporting, I hope I am not reporting something that has already been talked about... I could not find it)
The following code works in P3D renderer and the default, but not with OpenGL.
(the little box on top-left of the cursor detects the color underneath and colors the big box at the bottom)
import processing.opengl.*;
Form aform; color pixCol;
void setup() { size(400,400, OPENGL); // TRY P3D or default and it works fine !!! aform = new Form(20, 200); }
void draw() { background(122); fill(204, 102, 0); rect(10, 50, 40, 100); fill(204, 2, 130); rect(210, 200, 40, 120); fill(4, 202, 220); rect(150, 100, 120, 40); fill(44, 202, 220); rect(290, 5, 80, 120); fill(24, 2, 120); rect(350, 100, 450, 140); aform.update(); }
class Form { int x; int y;
Form(int _x, int _y) { x = _x; y = _y; }
void update(){ x = mouseX - 4; y = mouseY - 4; pixCol = get(x, y); noFill(); rect(x-3, y-3, 6, 6); fill(pixCol); rect(0, 300, 400, 100); } }
|