From 14c89ed2ecd32139b4efdfd4bf3a6a48816d0714 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 20 Feb 2015 16:45:29 -0500 Subject: [PATCH] removed glw --- java/libraries/glw/.classpath | 8 - java/libraries/glw/.gitignore | 1 - java/libraries/glw/.project | 17 -- java/libraries/glw/build.xml | 32 --- .../glw/examples/LargeStage/LargeStage.pde | 25 -- .../MultipleWindows/MultipleWindows.pde | 28 -- java/libraries/glw/library/.gitignore | 1 - .../libraries/glw/src/processing/glw/GLW.java | 52 ---- .../glw/src/processing/glw/PGraphics2D.java | 10 - .../glw/src/processing/glw/PGraphics3D.java | 10 - .../glw/src/processing/glw/PGraphicsGLW.java | 85 ------ .../glw/src/processing/glw/PNEWT.java | 267 ------------------ 12 files changed, 536 deletions(-) delete mode 100644 java/libraries/glw/.classpath delete mode 100644 java/libraries/glw/.gitignore delete mode 100644 java/libraries/glw/.project delete mode 100644 java/libraries/glw/build.xml delete mode 100644 java/libraries/glw/examples/LargeStage/LargeStage.pde delete mode 100644 java/libraries/glw/examples/MultipleWindows/MultipleWindows.pde delete mode 100644 java/libraries/glw/library/.gitignore delete mode 100644 java/libraries/glw/src/processing/glw/GLW.java delete mode 100644 java/libraries/glw/src/processing/glw/PGraphics2D.java delete mode 100644 java/libraries/glw/src/processing/glw/PGraphics3D.java delete mode 100644 java/libraries/glw/src/processing/glw/PGraphicsGLW.java delete mode 100644 java/libraries/glw/src/processing/glw/PNEWT.java diff --git a/java/libraries/glw/.classpath b/java/libraries/glw/.classpath deleted file mode 100644 index 614f216d5..000000000 --- a/java/libraries/glw/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/java/libraries/glw/.gitignore b/java/libraries/glw/.gitignore deleted file mode 100644 index 5e56e040e..000000000 --- a/java/libraries/glw/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/bin diff --git a/java/libraries/glw/.project b/java/libraries/glw/.project deleted file mode 100644 index 2a1ccb06f..000000000 --- a/java/libraries/glw/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - processing-glw - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/java/libraries/glw/build.xml b/java/libraries/glw/build.xml deleted file mode 100644 index 1f9ac5e8b..000000000 --- a/java/libraries/glw/build.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/libraries/glw/examples/LargeStage/LargeStage.pde b/java/libraries/glw/examples/LargeStage/LargeStage.pde deleted file mode 100644 index c40f9b0bc..000000000 --- a/java/libraries/glw/examples/LargeStage/LargeStage.pde +++ /dev/null @@ -1,25 +0,0 @@ -import processing.glw.*; - -PGraphics stage; - -void setup() { - // The main window will be hidden, only GLW.RENDERER - // can be used in size() - size(100, 100, GLW.RENDERER); - - stage = createGraphics(2560, 1440, GLW.P2D); - GLW.createWindow(stage); - frameRate(180); -} - -void draw() { - // The draw() method is used to update the offscreen surfaces, - // but not to draw directly to the screen. - stage.beginDraw(); - stage.background(200); - stage.fill(255); - stage.ellipse(mouseX, mouseY, 50, 50); - stage.fill(0); - stage.text(frameRate, 100, 100); - stage.endDraw(); -} \ No newline at end of file diff --git a/java/libraries/glw/examples/MultipleWindows/MultipleWindows.pde b/java/libraries/glw/examples/MultipleWindows/MultipleWindows.pde deleted file mode 100644 index 902fdbcd4..000000000 --- a/java/libraries/glw/examples/MultipleWindows/MultipleWindows.pde +++ /dev/null @@ -1,28 +0,0 @@ -import processing.glw.*; - -PGraphics canvas1; -PGraphics canvas2; - -void setup() { - size(100, 100, GLW.RENDERER); - canvas1 = createGraphics(320, 240, GLW.P2D); - canvas2 = createGraphics(320, 240, GLW.P2D); - GLW.createWindow(canvas1); - GLW.createWindow(canvas2); -} - -void draw() { - canvas1.beginDraw(); - canvas1.background(200); - canvas1.ellipse(mouseX, mouseY, 100, 100); - canvas1.endDraw(); - - canvas2.beginDraw(); - canvas2.background(170); - canvas2.ellipse(mouseX, mouseY, 50, 50); - canvas2.endDraw(); -} - -void keyPressed() { - GLW.getFocusedWindow().setVisible(false); -} \ No newline at end of file diff --git a/java/libraries/glw/library/.gitignore b/java/libraries/glw/library/.gitignore deleted file mode 100644 index f7094d12e..000000000 --- a/java/libraries/glw/library/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/glw.jar diff --git a/java/libraries/glw/src/processing/glw/GLW.java b/java/libraries/glw/src/processing/glw/GLW.java deleted file mode 100644 index 5968461e7..000000000 --- a/java/libraries/glw/src/processing/glw/GLW.java +++ /dev/null @@ -1,52 +0,0 @@ -package processing.glw; - -import processing.core.PGraphics; - -import com.jogamp.newt.opengl.GLWindow; - -import java.util.HashMap; - -public class GLW { - static public final String RENDERER = "processing.glw.PGraphicsGLW"; - static public final String OPENGL = "processing.glw.PGraphicsGLW"; - - static public final String P2D = "processing.glw.PGraphics2D"; - static public final String P3D = "processing.glw.PGraphics3D"; - - static protected HashMap windows = - new HashMap(); - - public GLW() { - } - - static public void createWindow(PGraphics pg) { - if (pg instanceof PGraphics2D || pg instanceof PGraphics3D) { - windows.put(pg, null); - } else { - throw new RuntimeException("Only GLW.P2D or GLW.P3D surfaces can be attached to a window"); - } - } - - static public GLWindow getWindow(PGraphics pg) { - return windows.get(pg); - } - - static public boolean isFocused(PGraphics pg) { - GLWindow win = windows.get(pg); - return win != null && win.hasFocus(); - } - - static public PGraphics getFocusedGraphics() { - for (PGraphics pg: windows.keySet()) { - if (isFocused(pg)) return pg; - } - return null; - } - - static public GLWindow getFocusedWindow() { - for (PGraphics pg: windows.keySet()) { - if (isFocused(pg)) return windows.get(pg); - } - return null; - } -} diff --git a/java/libraries/glw/src/processing/glw/PGraphics2D.java b/java/libraries/glw/src/processing/glw/PGraphics2D.java deleted file mode 100644 index 90b52899c..000000000 --- a/java/libraries/glw/src/processing/glw/PGraphics2D.java +++ /dev/null @@ -1,10 +0,0 @@ -package processing.glw; - -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; - -public class PGraphics2D extends processing.opengl.PGraphics2D { - protected PGL createPGL(PGraphicsOpenGL pg) { - return new PNEWT(pg); - } -} diff --git a/java/libraries/glw/src/processing/glw/PGraphics3D.java b/java/libraries/glw/src/processing/glw/PGraphics3D.java deleted file mode 100644 index c4e011a98..000000000 --- a/java/libraries/glw/src/processing/glw/PGraphics3D.java +++ /dev/null @@ -1,10 +0,0 @@ -package processing.glw; - -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; - -public class PGraphics3D extends processing.opengl.PGraphics3D { - protected PGL createPGL(PGraphicsOpenGL pg) { - return new PNEWT(pg); - } -} diff --git a/java/libraries/glw/src/processing/glw/PGraphicsGLW.java b/java/libraries/glw/src/processing/glw/PGraphicsGLW.java deleted file mode 100644 index 34c334fce..000000000 --- a/java/libraries/glw/src/processing/glw/PGraphicsGLW.java +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - - Copyright (c) 2004-12 Ben Fry and Casey Reas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - */ - -package processing.glw; - -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; - -/** - * GLW renderer. It's only role is to drive the main animation loop by calling - * requestDraw() and so allowing the offscreen canvases to be drawn inside the - * draw() method of the sketch. Currently, it cannot be used to draw into. - * - */ -public class PGraphicsGLW extends PGraphicsOpenGL { - protected PGL createPGL(PGraphicsOpenGL pg) { - return new PNEWT(pg); - } - - public void beginDraw() { - if (primarySurface) { - setCurrentPG(this); - } else { - throw new RuntimeException("GLW renderer cannot be used as an offscreen surface"); - } - - report("top beginDraw()"); - - if (!checkGLThread()) { - return; - } - - if (drawing) { - return; - } - - if (!glParamsRead) { - getGLParameters(); - } - - drawing = true; - - report("bot beginDraw()"); - } - - public void endDraw() { - report("top endDraw()"); - - if (!drawing) { - return; - } - - if (primarySurface) { - setCurrentPG(null); - } else { - throw new RuntimeException("GLW renderer cannot be used as an offscreen surface."); - } - drawing = false; - - report("bot endDraw()"); - } - - protected void vertexImpl(float x, float y, float z, float u, float v) { - throw new RuntimeException("The main GLW renderer cannot be used to draw to."); - } -} diff --git a/java/libraries/glw/src/processing/glw/PNEWT.java b/java/libraries/glw/src/processing/glw/PNEWT.java deleted file mode 100644 index c633bac47..000000000 --- a/java/libraries/glw/src/processing/glw/PNEWT.java +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ - -/* - Part of the Processing project - http://processing.org - - Copyright (c) 2011-12 Ben Fry and Casey Reas - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA -*/ - -package processing.glw; - - -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLDrawableFactory; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; - -import processing.core.PApplet; -import processing.core.PGraphics; -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; -import processing.opengl.PJOGL; -import processing.opengl.Texture; - - -public class PNEWT extends PJOGL { - - static { - WINDOW_TOOLKIT = NEWT; - EVENTS_TOOLKIT = NEWT; - USE_FBOLAYER_BY_DEFAULT = false; - USE_JOGL_FBOLAYER = false; - } - - protected static GLCapabilities sharedCaps; - protected static GLAutoDrawable sharedDrawable; - - - public PNEWT(PGraphicsOpenGL pg) { - super(pg); - } - - - protected void initSurface(int antialias) { - if (!(pg instanceof PGraphicsGLW)) { - throw new RuntimeException("GLW.RENDERER is the only option in size() when using the GLW library."); - } - - if (profile == null) { - if (PROFILE == 2) { - try { - profile = GLProfile.getGL2ES1(); - } catch (GLException ex) { - profile = GLProfile.getMaxFixedFunc(true); - } - } else if (PROFILE == 3) { - try { - profile = GLProfile.getGL2GL3(); - } catch (GLException ex) { - profile = GLProfile.getMaxProgrammable(true); - } - if (!profile.isGL3()) { - PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile); - } - } else if (PROFILE == 4) { - try { - profile = GLProfile.getGL4ES3(); - } catch (GLException ex) { - profile = GLProfile.getMaxProgrammable(true); - } - if (!profile.isGL4()) { - PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile); - } - } else throw new RuntimeException(UNSUPPORTED_GLPROF_ERROR); - - if (2 < PROFILE) { - texVertShaderSource = convertVertexSource(texVertShaderSource, 120, 150); - tex2DFragShaderSource = convertFragmentSource(tex2DFragShaderSource, 120, 150); - texRectFragShaderSource = convertFragmentSource(texRectFragShaderSource, 120, 150); - } - } - - // Setting up the desired capabilities; - sharedCaps = new GLCapabilities(profile); - sharedCaps.setAlphaBits(REQUESTED_ALPHA_BITS); - sharedCaps.setDepthBits(REQUESTED_DEPTH_BITS); - sharedCaps.setStencilBits(REQUESTED_STENCIL_BITS); - - sharedCaps.setPBuffer(false); - sharedCaps.setFBO(false); - sharedCaps.setSampleBuffers(false); - - fboLayerRequested = false; - sharedDrawable = GLDrawableFactory.getFactory(profile).createDummyAutoDrawable(null, true, sharedCaps, null); - sharedDrawable.display(); // triggers GLContext object creation and native realization. - DummyListener listener = new DummyListener(); - sharedDrawable.addGLEventListener(listener); - - pg.parent.frame.setVisible(false); - } - - - protected boolean displayable() { - return false; - } - - - protected void beginDraw(boolean clear0) { - } - - - protected void endDraw(boolean clear0) { - } - - - protected void requestDraw() { - createWindows(); - - // Calling display() so the main draw() method is triggered, where the - // offscreen GLW canvases can be updated. - sharedDrawable.display(); - - displayWindows(); - } - - private void createWindows() { - for (PGraphics pg: GLW.windows.keySet()) { - GLWindow win = GLW.windows.get(pg); - if (win == null) { - win = GLWindow.create(sharedCaps); - win.setSharedAutoDrawable(sharedDrawable); - win.setSize(pg.width, pg.height); - win.setTitle("TEST"); - win.setVisible(true); - GLW.windows.put(pg, win); - - NEWTListener listener = new NEWTListener(pg); - win.addGLEventListener(listener); - - NEWTMouseListener mouseListener = new NEWTMouseListener(); - win.addMouseListener(mouseListener); - NEWTKeyListener keyListener = new NEWTKeyListener(); - win.addKeyListener(keyListener); - NEWTWindowListener winListener = new NEWTWindowListener(); - win.addWindowListener(winListener); - - win.addWindowListener(new WindowAdapter() { - @Override - public void windowDestroyNotify(final WindowEvent e) { - } - }); - } - } - } - - - static private void displayWindows() { - int totalCount = 0; - int realizedCount = 0; - for (GLWindow win: GLW.windows.values()) { - if (win != null) { - totalCount++; - if (win.isRealized()) realizedCount++; - win.display(); - } - } - - if (0 < totalCount && realizedCount == 0) { - // All windows where closed, exit the application - sharedDrawable.destroy(); - System.exit(0); - } - } - - - protected class DummyListener implements GLEventListener { - public DummyListener() { - } - - @Override - public void display(GLAutoDrawable glDrawable) { - getGL(glDrawable); - pg.parent.handleDraw(); - } - - @Override - public void dispose(GLAutoDrawable adrawable) { - } - - @Override - public void init(GLAutoDrawable glDrawable) { - getGL(glDrawable); - - capabilities = glDrawable.getChosenGLCapabilities(); - if (!hasFBOs()) { - throw new RuntimeException(MISSING_FBO_ERROR); - } - if (!hasShaders()) { - throw new RuntimeException(MISSING_GLSL_ERROR); - } - if (USE_JOGL_FBOLAYER && capabilities.isFBO()) { - int maxs = maxSamples(); - numSamples = PApplet.min(capabilities.getNumSamples(), maxs); - } - } - - @Override - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) { - } - } - - - protected class NEWTListener implements GLEventListener { - PGraphicsOpenGL pg; - PNEWT pgl; - - public NEWTListener(PGraphics pg) { - this.pg = (PGraphicsOpenGL)pg; - pgl = (PNEWT)this.pg.pgl; - } - - @Override - public void display(GLAutoDrawable glDrawable) { - pgl.getGL(glDrawable); - Texture tex = pg.getTexture(false); - if (tex != null) { - pgl.disable(PGL.BLEND); - pgl.drawTexture(tex.glTarget, tex.glName, - tex.glWidth, tex.glHeight, - 0, 0, pg.width, pg.height); - pgl.enable(PGL.BLEND); - } - } - - @Override - public void dispose(GLAutoDrawable adrawable) { - } - - @Override - public void init(GLAutoDrawable glDrawable) { - } - - @Override - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) { - } - } -}