Skip to content

Commit 662eeff

Browse files
committed
fallback from Processing 2.07b to 1.5.1 stable switch openGL
fallback to old processing and more stable openGL impementation. This improoves speed of OpenGL and solves Mountain Lion issues.
1 parent fb16db4 commit 662eeff

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

Stage.pde

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ import processing.opengl.*;
1717
import java.awt.GraphicsDevice;
1818
import java.awt.DisplayMode;
1919
import java.awt.Frame;
20-
import javax.media.opengl.GL2;
20+
import javax.media.opengl.GL;
2121

2222
public class Stage extends PApplet {
23-
24-
23+
2524
MusicBeam ctrl = null;
2625

2726
int width;
@@ -36,12 +35,10 @@ public class Stage extends PApplet {
3635

3736
float minRadius;
3837

39-
PGraphicsOpenGL pgl;
40-
41-
GL2 gl;
42-
4338
DisplayMode dm;
4439

40+
PGraphicsOpenGL pgl;
41+
4542

4643
Stage (MusicBeam main, int gd)
4744
{
@@ -69,10 +66,7 @@ public class Stage extends PApplet {
6966

7067
void setup() {
7168
frameRate(getRefreshRate());
72-
7369
pgl = (PGraphicsOpenGL) g;
74-
gl = pgl.beginPGL().gl.getGL2();
75-
7670
noStroke();
7771
colorMode(HSB, 360, 100, 100);
7872
}
@@ -86,19 +80,27 @@ public class Stage extends PApplet {
8680
textSize(30);
8781
text(frameRate, 100, 100);
8882
}
89-
90-
pgl.beginPGL();
91-
gl.glDisable(GL2.GL_DEPTH_TEST);
92-
gl.glEnable(GL2.GL_BLEND);
93-
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE);
94-
pgl.endPGL();
83+
84+
enableGLBlending();
9585

9686
translate(width/2, height/2);
9787
for (int i = 0; i < effectArray.length; i++)
9888
if (effectArray[i].isActive())
9989
effectArray[i].refresh();
10090
}
10191

92+
/**
93+
* Enables GLBlending and sets a function to blend overlaying colors.
94+
*
95+
*/
96+
private void enableGLBlending() {
97+
GL gl = pgl.beginGL();
98+
gl.glDisable(GL.GL_DEPTH_TEST);
99+
gl.glEnable(GL.GL_BLEND);
100+
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);
101+
pgl.endGL();
102+
}
103+
102104
public int sketchWidth() {
103105
return dm.getWidth();
104106
}

0 commit comments

Comments
 (0)