Tags: No Tags
Update: This hack is obsolete as of Processing 0133. Read more here.
I’ve previously mentioned the problem of anti-aliasing not working properly in OpenGL, which is particularly bothersome for MacOS users who can’t use a graphics card control panel to override application settings to force AA. Mike Creighton posted source for a hack on the Processing forums that modifies PGraphicsOpenGL to force AA. I’ve created a simple version of this hack and made a replacement for the opengl.jar that comes with Processing.
This hack should work for Processing 0124 on Mac and PC. Simply download the opengl.jar below and drop it into the “libraries\opengl\library” subfolder of your Processing application directory. Make sure to make a backup of the original opengl.jar first in case this doesn’t work for you. Once replaced, the new PGraphicsOpenGL class should always initialize with 4x supersampling. Please leave comments on this post to let me know if it works for you.
- OpenGL hack for version 0124: opengl-hack-0124.zip.





i love it.
thanks a lot.
Hi, Marius. It has same error like my attempt (the last but one post in the thread). In my sketch I draw a opacity rectangle polygon, with the size of the screen, at the begin of the drawing loop, then I clear the depth buffer and then the rest will be drawn. Normally this would give me trails but in your and mine solution it fails.
Andreas, I haven’t done trails with OpenGL so I have no experience with that. Do you have some code to demonstrate how it would work properly before the hack is applied? The problem has been confirmed by someone else, but I’m not sure what causes it or how it could be fixed.
Hello Marius!
Thank’s for this, like usual it is really great.
But, because there is always a but, unfortunatly it isn’t functionning for me.
When I draw something the draw function will erase it in the next frame so except if I draw each object, each frame I can’t do anything.
Here is a small exemple of code where it’s not functionning:
import processing.opengl.*;
void setup(){
size(400,400,OPENGL);
background(255);
}
void draw(){
}
float x,y;
void mousePressed(){
x = mouseX;
y = mouseY;
}
void mouseReleased(){
leaf(x,y,mouseX,mouseY);
}
void leaf(float x1,float y1,float x2, float y2){
float dx = x1-x2;
float dy = y1-y2;
float d = sqrt(dx*dx+dy*dy);
float a = atan2(dy,dx);
float ar1 = random(-2.7,-3);
float ar2 = random(-.2,-.9);
float l1 = random(.4,.7);
float l2 = l1+random(-.2,.2);
float cx1 = x1+cos(a+ar1)*d*l1;
float cy1 = y1+sin(a+ar1)*d*l1;
float cx2 = x2+cos(a+ar2)*d*.3;
float cy2 = y2+sin(a+ar2)*d*.3;
noStroke();
fill(random(255));
bezier(x1,y1,cx1,cy1,cx2,cy2,x2,y2);
cx1 = x1+cos(a-ar1)*d*l2;
cy1 = y1+sin(a-ar1)*d*l2;
cx2 = x2+cos(a-ar2)*d*.3;
cy2 = y2+sin(a-ar2)*d*.3;
bezier(x1,y1,cx1,cy1,cx2,cy2,x2,y2);
}
Hope it help you. (I’m on an old PC with winXP sp2, an ATIRadean 9600xt, the last java and the last processing).
Best Regards!!!
Simon.
Ahh, thank you! This is amazing!
thanx 1000000000 MARIUS !!!!
creating hacked PGraphicsOpenGL 4
17.746 [50]
40.08 [50]
42.735 [50]
43.011 [50]
42.735 [50]
43.908 [50]
43.243 [50]
43.716 [50]
43.011 [50]
43.86 [50]
43.431 [50]
44.593 [50]
43.716 [50]
38.059 [200]
21.61 [400]
11.884 [1600]
6.96 [3200]
now it work properly…..finally!
u always over the edge….eheh
see ya bro
Patrik
Thanks for this hack. Works beautifully on my macbook pro. It even eliminates the weird seams that used to crop up between the triangles in a TRIANGLE_STRIP.
thanks for that bit of info, David - I was totally wondering about those!?!? That’s some buggy stuff. Can’t wait to try out this bug fix.
andreas