@Override public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); logger.fine("Canvas destroyed."); super.internalDestroy(); return; } int newWidth = Math.max(canvas.getWidth(), 1); int newHeight = Math.max(canvas.getHeight(), 1); if (width != newWidth || height != newHeight) { width = newWidth; height = newHeight; 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.postFrame(); }
@Override public int getHeight() { return glComponent.getHeight(); }
public int getCanvasHeight() { return c.getHeight(); } public void videoWasUpdated()
public void defaultViewport() { final GLCanvas canvas = this.canvas; getGl().glViewport(0, 0, canvas.getWidth(), canvas.getHeight()); }
@Override public void display(GLAutoDrawable glad) { if (!created.get() && renderer != null){ listener.destroy(); logger.fine("Canvas destroyed."); super.internalDestroy(); return; } int newWidth = Math.max(canvas.getWidth(), 1); int newHeight = Math.max(canvas.getHeight(), 1); if (width != newWidth || height != newHeight) { width = newWidth; height = newHeight; 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.postFrame(); }
void drawString(String text, int x, int y, java.awt.Color color, GL2 gl, com.jogamp.opengl.util.awt.TextRenderer tr) { //System.out.println("drawString "+ text + " x: "+x+" y: "+y); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); //System.out.println("glOrtho(0,"+ c.getWidth() + ","+c.getHeight()+",0,-1.0,1.0)"); gl.glOrtho(0,c.getWidth(),0,c.getHeight(),-1.0,1.0); tr.begin3DRendering(); tr.setColor(color); tr.draw3D(text, x, c.getHeight()-y, 0, 1); tr.end3DRendering(); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPopMatrix(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); }
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl; System.out.println("reshape "+x+","+y+" "+width+","+height); gl = drawable.getGL().getGL2(); newosdwidth=width; newosdheight=height; gl.glViewport(0, 0, newosdwidth, newosdheight); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0,newosdwidth,newosdheight,0,-1.0,1.0); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f); gl.glClear( gl.GL_COLOR_BUFFER_BIT); synchronized(newpbufferlock) { newpbuffer=true; } myConn.postResizeEvent(new java.awt.Dimension(c.getWidth(), c.getHeight())); }
myConn.postRepaintEvent(0, 0, c.getWidth(), c.getHeight());
sunVector.set(.5774f,-.5774f,.5774f); final int width = canvas.getWidth(); final int height = canvas.getHeight(); gpu.defaultProgram(); gpu.defaultTIU();