private AWTGLReadBufferUtil makeScreenshot(GL gl) { AWTGLReadBufferUtil screenshot = new AWTGLReadBufferUtil(gl.getGLProfile(), true); screenshot.readPixels(gl, true); image = screenshot.getTextureData(); return screenshot; }
/** * Uses a dedicated {@link AWTGLReadBufferUtil} to read a buffered image. * @see {@link getLastScreenshotImage()} to retrieve the image */ @Override public void display(GLAutoDrawable canvas) { GL gl = canvas.getGL(); if (view != null) { view.clear(gl); view.render(gl, glu); if (doScreenshotAtNextDisplay) { AWTGLReadBufferUtil screenshot = new AWTGLReadBufferUtil(GLProfile.getGL2GL3(), true); screenshot.readPixels(gl, true); image = screenshot.getTextureData(); bufferedImage = screenshot.readPixelsToBufferedImage(gl, true); doScreenshotAtNextDisplay = false; } } }