private void gcChanged() { GCWrapper wrap = (GCWrapper) gcSelection.getSelectedItem(); // assert wrap != null; GraphicsConfiguration gc = wrap.getGC(); // assert gc != null; // Image Caps ImageCapabilities imageCaps = gc.getImageCapabilities(); imageAccelerated.setSelected(imageCaps.isAccelerated()); imageTrueVolatile.setSelected(imageCaps.isTrueVolatile()); // Buffer Caps BufferCapabilities bufferCaps = gc.getBufferCapabilities(); flipping.setSelected(bufferCaps.isPageFlipping()); flippingMethod.setText(getFlipText(bufferCaps.getFlipContents())); fullScreen.setSelected(bufferCaps.isFullScreenRequired()); multiBuffer.setSelected(bufferCaps.isMultiBufferAvailable()); // Front buffer caps imageCaps = bufferCaps.getFrontBufferCapabilities(); fbAccelerated.setSelected(imageCaps.isAccelerated()); fbTrueVolatile.setSelected(imageCaps.isTrueVolatile()); imageCaps = bufferCaps.getFrontBufferCapabilities(); // Back buffer caps imageCaps = bufferCaps.getBackBufferCapabilities(); bbAccelerated.setSelected(imageCaps.isAccelerated()); bbTrueVolatile.setSelected(imageCaps.isTrueVolatile()); }
public FrameRenderer(final JFrame target, boolean isFullscreen, RenderFitMode renderFitMode) { m_renderTarget = target; m_renderFitMode = renderFitMode; m_renderTarget.setSize(target.getSize()); m_canvasRenderWidth = target.getWidth(); m_canvasRenderHeight = target.getHeight(); target.setIgnoreRepaint(true); target.createBufferStrategy(2); m_bufferStrategy = target.getBufferStrategy(); BufferCapabilities cap = m_bufferStrategy.getCapabilities(); if (!cap.getBackBufferCapabilities().isAccelerated()) m_logger.warn("Backbuffer is not accelerated, may result in poorer render performance."); if (!cap.isPageFlipping()) m_logger.warn( "Page flipping is not supported by this device. This may result in increased image flicker or tearing."); if (!cap.isMultiBufferAvailable()) m_logger.warn( "Multiple buffering for page flipping is not supported by this device. This may result in poorer performance."); if (cap.isFullScreenRequired() && !isFullscreen) m_logger.warn( "Full screen required for hardware acceleration - not running in fullscreen may cause performance issues."); if (isFullscreen) { enterFullscreen(); target.addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) {} @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { GraphicsDevice device = target.getGraphicsConfiguration().getDevice(); Window fullscreen = device.getFullScreenWindow(); if (fullscreen != target) fullscreen = null; if (fullscreen == null) enterFullscreen(); else exitFullscreen(); } } }); } }
public String toString() { BufferCapabilities b = device.getFullScreenWindow().getBufferStrategy().getCapabilities(); String cadena = ""; cadena += "\nInformacion de video:\n" + "PageFlipping: " + b.isPageFlipping() + "\nEs necesario que sea fullscreen para ello: " + b.isFullScreenRequired() + "\nMultiBuffer: " + ((Boolean) (b.isMultiBufferAvailable())).toString() + "\n Memoria de video disponible: " + device.getAvailableAcceleratedMemory(); return cadena; }