javax.media.opengl.GLAutoDrawable Java Examples
The following examples show how to use
javax.media.opengl.GLAutoDrawable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BloomOpenGL.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void display(GLAutoDrawable glAutoDrawable) { GL gl = glAutoDrawable.getGL(); gl.glLoadIdentity(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); viewOrtho(gl, image.getWidth(), image.getHeight()); gl.glEnable(GL.GL_TEXTURE_2D); int width = image.getWidth(); int height = image.getHeight(); // Source Image/bright pass on FBO1 renderBrightPass(gl, width, height); // Source image on FBO2 renderImage(gl, width, height); // On screen renderTextureOnScreen(gl, width, height); //render5x5(gl, width, height); render11x11(gl, width, height); render21x21(gl, width, height); render41x41(gl, width, height); gl.glDisable(GL.GL_TEXTURE_2D); gl.glFlush(); }
Example #2
Source File: JoglPanel.java From jbox2d with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { GL2 gl2 = arg0.getGL().getGL2(); gl2.glMatrixMode(GL2.GL_PROJECTION); gl2.glLoadIdentity(); // coordinate system origin at lower left with width and height same as the window GLU glu = new GLU(); glu.gluOrtho2D(0.0f, getWidth(), 0.0f, getHeight()); gl2.glMatrixMode(GL2.GL_MODELVIEW); gl2.glLoadIdentity(); gl2.glViewport(0, 0, getWidth(), getHeight()); controller.updateExtents(arg3 / 2, arg4 / 2); }
Example #3
Source File: JoglCanvas.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); logger.info("Canvas destroyed."); super.internalDestroy(); return; } if (width != canvas.getWidth() || height != canvas.getHeight()){ width = canvas.getWidth(); height = canvas.getHeight(); if (listener != null) listener.reshape(width, height); } boolean flush = autoFlush.get(); if (flush && !wasAnimating){ animator.start(); wasAnimating = true; }else if (!flush && wasAnimating){ animator.stop(); wasAnimating = false; } listener.update(); renderer.onFrame(); }
Example #4
Source File: JoglDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void init(GLAutoDrawable drawable) { // prevent initializing twice on restart if (!wasInited) { canvas.requestFocus(); super.internalCreate(); logger.info("Display created."); renderer.initialize(); listener.initialize(); wasInited = true; } }
Example #5
Source File: JoglCanvas.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); logger.info("Canvas destroyed."); super.internalDestroy(); return; } if (width != canvas.getWidth() || height != canvas.getHeight()){ width = canvas.getWidth(); height = canvas.getHeight(); if (listener != null) listener.reshape(width, height); } boolean flush = autoFlush.get(); if (flush && !wasAnimating){ animator.start(); wasAnimating = true; }else if (!flush && wasAnimating){ animator.stop(); wasAnimating = false; } listener.update(); renderer.onFrame(); }
Example #6
Source File: JoglCanvas.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void init(GLAutoDrawable drawable) { canvas.requestFocus(); super.internalCreate(); logger.info("Display created."); renderer.initialize(); listener.initialize(); }
Example #7
Source File: JoglDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void init(GLAutoDrawable drawable){ // prevent initializing twice on restart if (!wasInited){ canvas.requestFocus(); super.internalCreate(); logger.info("Display created."); renderer.initialize(); listener.initialize(); wasInited = true; } }
Example #8
Source File: BloomOpenGL.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void init(GLAutoDrawable glAutoDrawable) { GL gl = glAutoDrawable.getGL(); if (texture == null) { texture = TextureIO.newTexture(image, false); } // create the blur shader blurShader = createFragmentProgram(gl, new String[] { blurShaderSource }); gl.glUseProgramObjectARB(blurShader); int loc = gl.glGetUniformLocationARB(blurShader, "baseImage"); gl.glUniform1iARB(loc, 0); gl.glUseProgramObjectARB(0); // create the bright-pass shader brightPassShader = createFragmentProgram(gl, new String[] { brightPassShaderSource }); gl.glUseProgramObjectARB(brightPassShader); loc = gl.glGetUniformLocationARB(brightPassShader, "baseImage"); gl.glUniform1iARB(loc, 0); gl.glUseProgramObjectARB(0); // create the FBOs if (gl.isExtensionAvailable("GL_EXT_framebuffer_object")) { int[] fboId = new int[1]; int[] texId = new int[1]; createFrameBufferObject(gl, fboId, texId, image.getWidth(), image.getHeight()); frameBufferObject1 = fboId[0]; frameBufferTexture1 = texId[0]; createFrameBufferObject(gl, fboId, texId, image.getWidth(), image.getHeight()); frameBufferObject2 = fboId[0]; frameBufferTexture2 = texId[0]; } }
Example #9
Source File: JoglCanvas.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void init(GLAutoDrawable drawable) { canvas.requestFocus(); super.internalCreate(); logger.info("Display created."); renderer.initialize(); listener.initialize(); }
Example #10
Source File: BloomOpenGL.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void reshape(GLAutoDrawable glAutoDrawable, int x, int y, int width, int height) { GL gl = glAutoDrawable.getGL(); gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(50, (float) width / height, 5, 2000); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); }
Example #11
Source File: JoglAbstractDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
/** * Callback. */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { listener.reshape(width, height); }
Example #12
Source File: JoglPanel.java From jbox2d with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void init(GLAutoDrawable arg0) { getGL().getGL2().glLineWidth(1f); getGL().getGL2().glEnable(GL2.GL_BLEND); getGL().getGL2().glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA); }
Example #13
Source File: JoglPanel.java From jbox2d with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void dispose(GLAutoDrawable arg0) {}
Example #14
Source File: JoglDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
/** * Callback. */ public void display(GLAutoDrawable drawable) { if (needClose.get()) { listener.destroy(); animator.stop(); if (settings.isFullscreen()) { device.setFullScreenWindow(null); } frame.dispose(); logger.info("Display destroyed."); super.internalDestroy(); return; } if (windowCloseRequest.get()){ listener.requestClose(false); windowCloseRequest.set(false); } if (needRestart.getAndSet(false)){ // for restarting contexts if (frame.isVisible()){ animator.stop(); frame.dispose(); createGLFrame(); startGLCanvas(); } } // boolean flush = autoFlush.get(); // if (animator.isAnimating() != flush){ // if (flush) // animator.stop(); // else // animator.start(); // } if (wasActive != active.get()){ if (!wasActive){ listener.gainFocus(); wasActive = true; }else{ listener.loseFocus(); wasActive = false; } } listener.update(); renderer.onFrame(); }
Example #15
Source File: JoglAbstractDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
/** * Callback. */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { listener.reshape(width, height); }
Example #16
Source File: JoglPanel.java From jbox2d with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void display(GLAutoDrawable arg0) { getGL().getGL2().glClear(GL2.GL_COLOR_BUFFER_BIT); controller.updateTest(); getGL().glFlush(); }
Example #17
Source File: BloomOpenGL.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void displayChanged(GLAutoDrawable glAutoDrawable, boolean modeChanged, boolean deviceChanged) { }
Example #18
Source File: JoglCanvas.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void dispose(GLAutoDrawable arg0) { }
Example #19
Source File: JoglDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
/** * Callback. */ public void display(GLAutoDrawable drawable) { if (needClose.get()) { listener.destroy(); animator.stop(); if (settings.isFullscreen()) { device.setFullScreenWindow(null); } frame.dispose(); logger.info("Display destroyed."); super.internalDestroy(); return; } if (windowCloseRequest.get()) { listener.requestClose(false); windowCloseRequest.set(false); } if (needRestart.getAndSet(false)) { // for restarting contexts if (frame.isVisible()) { animator.stop(); frame.dispose(); createGLFrame(); startGLCanvas(); } } // boolean flush = autoFlush.get(); // if (animator.isAnimating() != flush){ // if (flush) // animator.stop(); // else // animator.start(); // } if (wasActive != active.get()) { if (!wasActive) { listener.gainFocus(); wasActive = true; } else { listener.loseFocus(); wasActive = false; } } listener.update(); renderer.onFrame(); }
Example #20
Source File: JoglAbstractDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 2 votes |
/** * Callback. */ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { }
Example #21
Source File: JoglAbstractDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 2 votes |
/** * Callback. */ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { }
Example #22
Source File: JoglAbstractDisplay.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 2 votes |
/** * Callback */ public void dispose(GLAutoDrawable drawable) { }