/** * Creates a SurfaceData object representing the back buffer of a * double-buffered on-screen Window. */ public static GLXOffScreenSurfaceData createData(X11ComponentPeer peer, Image image, int type) { GLXGraphicsConfig gc = getGC(peer); Rectangle r = peer.getBounds(); if (type == FLIP_BACKBUFFER) { return new GLXOffScreenSurfaceData(peer, gc, r.width, r.height, image, peer.getColorModel(), FLIP_BACKBUFFER); } else { return new GLXVSyncOffScreenSurfaceData(peer, gc, r.width, r.height, image, peer.getColorModel(), type); } }
/** * Attempts to create a GLX-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * value of 1 is returned. */ @Override public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) { throw new AWTException("FlipContents.PRIOR is not supported"); } // non-zero return value means backbuffer creation was successful // (checked in X11ComponentPeer.flip(), etc.) return 1; }
/** * Attempts to create an XDBE-based backbuffer for the given peer. If * the requested configuration is not natively supported, an AWTException * is thrown. Otherwise, if the backbuffer creation is successful, a * handle to the native backbuffer is returned. */ public long createBackBuffer(X11ComponentPeer peer, int numBuffers, BufferCapabilities caps) throws AWTException { if (!X11GraphicsDevice.isDBESupported()) { throw new AWTException("Page flipping is not supported"); } if (numBuffers > 2) { throw new AWTException( "Only double or single buffering is supported"); } BufferCapabilities configCaps = getBufferCapabilities(); if (!configCaps.isPageFlipping()) { throw new AWTException("Page flipping is not supported"); } long window = peer.getContentWindow(); int swapAction = getSwapAction(caps.getFlipContents()); return createBackBuffer(window, swapAction); }
protected GLXSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc, ColorModel cm, int type) { super(gc, cm, type); this.peer = peer; this.graphicsConfig = gc; initOps(peer, graphicsConfig.getAData()); }
public static GLXGraphicsConfig getGC(X11ComponentPeer peer) { if (peer != null) { return (GLXGraphicsConfig)peer.getGraphicsConfiguration(); } else { // REMIND: this should rarely (never?) happen, but what if // default config is not GLX? GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = env.getDefaultScreenDevice(); return (GLXGraphicsConfig)gd.getDefaultConfiguration(); } }
public GLXVSyncOffScreenSurfaceData(X11ComponentPeer peer, GLXGraphicsConfig gc, int width, int height, Image image, ColorModel cm, int type) { super(peer, gc, width, height, image, cm, type); flipSurface = GLXSurfaceData.createData(peer, image, FLIP_BACKBUFFER); }