@Override protected final ProxySurface createMutableSurfaceImpl( AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; if (createNewDevice || !(deviceReq instanceof X11GraphicsDevice)) { device = new X11GraphicsDevice( X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); } else { device = (X11GraphicsDevice) deviceReq; } final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen()); final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED); if (null == config) { throw new GLException( "Choosing GraphicsConfiguration failed w/ " + capsChosen + " on " + screen); } return new WrappedSurface(config, 0, upstreamHook, createNewDevice); }
@Override protected ProxySurface createMutableSurfaceImpl( AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; if (createNewDevice || !(deviceReq instanceof EGLGraphicsDevice)) { final long nativeDisplayID = (deviceReq instanceof EGLGraphicsDevice) ? ((EGLGraphicsDevice) deviceReq).getNativeDisplayID() : deviceReq.getHandle(); device = EGLDisplayUtil.eglCreateEGLGraphicsDevice( nativeDisplayID, deviceReq.getConnection(), deviceReq.getUnitID()); ownDevice = true; } else { device = (EGLGraphicsDevice) deviceReq; ownDevice = false; } final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final EGLGraphicsConfiguration config = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); if (null == config) { throw new GLException( "Choosing GraphicsConfiguration failed w/ " + capsChosen + " on " + screen); } return new WrappedSurface(config, 0, upstreamHook, ownDevice); }
@Override protected ProxySurface createProxySurfaceImpl( AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq; final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice( eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID()); final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsRequested, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); return new WrappedSurface(cfg, windowHandle, upstream, true); }
@Override protected final ProxySurface createProxySurfaceImpl( AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { final X11GraphicsDevice device = new X11GraphicsDevice( X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx); final int xvisualID = X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle); if (VisualIDHolder.VID_UNDEFINED == xvisualID) { throw new GLException( "Undefined VisualID of window 0x" + Long.toHexString(windowHandle) + ", window probably invalid"); } if (DEBUG) { System.err.println( "X11GLXDrawableFactory.createProxySurfaceImpl 0x" + Long.toHexString(windowHandle) + ": visualID 0x" + Integer.toHexString(xvisualID)); } final X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capsRequested, capsRequested, chooser, screen, xvisualID); if (DEBUG) { System.err.println( "X11GLXDrawableFactory.createProxySurfaceImpl 0x" + Long.toHexString(windowHandle) + ": " + cfg); } return new WrappedSurface(cfg, windowHandle, upstream, true); }