diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx')
13 files changed, 242 insertions, 242 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 12e3db3bd..e32177b3d 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -46,7 +46,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; public class GLXUtil { public static final boolean DEBUG = Debug.debug("GLXUtil"); - public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) { + public static synchronized boolean isGLXAvailableOnServer(final X11GraphicsDevice x11Device) { if(null == x11Device) { throw new IllegalArgumentException("null X11GraphicsDevice"); } @@ -57,14 +57,14 @@ public class GLXUtil { x11Device.lock(); try { glXAvailable = GLX.glXQueryExtension(x11Device.getHandle(), null, null); - } catch (Throwable t) { /* n/a */ + } catch (final Throwable t) { /* n/a */ } finally { x11Device.unlock(); } return glXAvailable; } - public static String getGLXClientString(X11GraphicsDevice x11Device, int name) { + public static String getGLXClientString(final X11GraphicsDevice x11Device, final int name) { x11Device.lock(); try { return GLX.glXGetClientString(x11Device.getHandle(), name); @@ -72,7 +72,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) { + public static String queryGLXServerString(final X11GraphicsDevice x11Device, final int screen_idx, final int name) { x11Device.lock(); try { return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name); @@ -80,7 +80,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) { + public static String queryGLXExtensionsString(final X11GraphicsDevice x11Device, final int screen_idx) { x11Device.lock(); try { return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx); @@ -89,7 +89,7 @@ public class GLXUtil { } } - public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) { + public static VersionNumber getGLXServerVersionNumber(final X11GraphicsDevice x11Device) { final IntBuffer major = Buffers.newDirectIntBuffer(1); final IntBuffer minor = Buffers.newDirectIntBuffer(1); @@ -102,12 +102,12 @@ public class GLXUtil { // Work around bugs in ATI's Linux drivers where they report they // only implement GLX version 1.2 on the server side if (major.get(0) == 1 && minor.get(0) == 2) { - String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); + final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major.put(0, Integer.valueOf(str.substring(0, 1)).intValue()); minor.put(0, Integer.valueOf(str.substring(2, 3)).intValue()); - } catch (Exception e) { + } catch (final Exception e) { major.put(0, 1); minor.put(0, 2); } @@ -118,18 +118,18 @@ public class GLXUtil { return new VersionNumber(major.get(0), minor.get(0), 0); } - public static boolean isMultisampleAvailable(String extensions) { + public static boolean isMultisampleAvailable(final String extensions) { if (extensions != null) { return (extensions.indexOf("GLX_ARB_multisample") >= 0); } return false; } - public static boolean isVendorNVIDIA(String vendor) { + public static boolean isVendorNVIDIA(final String vendor) { return vendor != null && vendor.startsWith("NVIDIA") ; } - public static boolean isVendorATI(String vendor) { + public static boolean isVendorATI(final String vendor) { return vendor != null && vendor.startsWith("ATI") ; } @@ -143,7 +143,7 @@ public class GLXUtil { return clientVersionNumber; } - public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) { + public static synchronized void initGLXClientDataSingleton(final X11GraphicsDevice x11Device) { if(null != clientVendorName) { return; // already initialized } @@ -156,14 +156,14 @@ public class GLXUtil { clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS)); clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR); - int[] major = new int[1]; - int[] minor = new int[1]; + final int[] major = new int[1]; + final int[] minor = new int[1]; final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major[0] = Integer.valueOf(str.substring(0, 1)).intValue(); minor[0] = Integer.valueOf(str.substring(2, 3)).intValue(); - } catch (Exception e) { + } catch (final Exception e) { major[0] = 1; minor[0] = 2; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 45c666230..7040621be 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -58,7 +58,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXContext extends X11GLXContext { - private X11ExternalGLXContext(Drawable drawable, long ctx) { + private X11ExternalGLXContext(final Drawable drawable, final long ctx) { super(drawable, null); this.contextHandle = ctx; GLContextShareSet.contextCreated(this); @@ -68,20 +68,20 @@ public class X11ExternalGLXContext extends X11GLXContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static X11ExternalGLXContext create(GLDrawableFactory factory, GLProfile glp) { - long ctx = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXContext create(final GLDrawableFactory factory, final GLProfile glp) { + final long ctx = GLX.glXGetCurrentContext(); if (ctx == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable/context current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -90,7 +90,7 @@ public class X11ExternalGLXContext extends X11GLXContext { h=val.get(0); GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val); X11GLXGraphicsConfiguration cfg = null; @@ -99,7 +99,7 @@ public class X11ExternalGLXContext extends X11GLXContext { // create and use a default config (this has been observed when running on CentOS 5.5 inside // of VMWare Server 2.0 with the Mesa 6.5.1 drivers) if( VisualIDHolder.VID_UNDEFINED == val.get(0) || !X11GLXGraphicsConfiguration.GLXFBConfigIDValid(display, x11Screen.getIndex(), val.get(0)) ) { - GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen, VisualIDHolder.VID_UNDEFINED); if(DEBUG) { System.err.println("X11ExternalGLXContext invalid FBCONFIG_ID "+val.get(0)+", using default cfg: " + cfg); @@ -131,12 +131,12 @@ public class X11ExternalGLXContext extends X11GLXContext { // Need to provide the display connection to extension querying APIs static class Drawable extends X11GLXDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -150,7 +150,7 @@ public class X11ExternalGLXContext extends X11GLXContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index 650fd31d3..2076ce454 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -55,30 +55,30 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXDrawable extends X11GLXDrawable { - private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeSurface surface) { + private X11ExternalGLXDrawable(final GLDrawableFactory factory, final NativeSurface surface) { super(factory, surface, true); } - protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) { - long context = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXDrawable create(final GLDrawableFactory factory, final GLProfile glp) { + final long context = GLX.glXGetCurrentContext(); if (context == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, context, GLX.GLX_FBCONFIG_ID, val); - X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); + final X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -96,16 +96,16 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new Context(this, shareWith); } - public void setSize(int newWidth, int newHeight) { + public void setSize(final int newWidth, final int newHeight) { throw new GLException("Should not call this"); } class Context extends X11GLXContext { - Context(X11GLXDrawable drawable, GLContext shareWith) { + Context(final X11GLXDrawable drawable, final GLContext shareWith) { super(drawable, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index e0b69ffd4..36e791641 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -41,14 +41,14 @@ public class X11GLCapabilities extends GLCapabilities { final private long fbcfg; final private int fbcfgid; - public X11GLCapabilities(XVisualInfo xVisualInfo, long fbcfg, int fbcfgid, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final long fbcfg, final int fbcfgid, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = fbcfg; this.fbcfgid = fbcfgid; } - public X11GLCapabilities(XVisualInfo xVisualInfo, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = 0; @@ -64,7 +64,7 @@ public class X11GLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -78,7 +78,7 @@ public class X11GLCapabilities extends GLCapabilities { final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid!=VisualIDHolder.VID_UNDEFINED; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 57d39d533..d4c3abc49 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -94,13 +94,13 @@ public class X11GLXContext extends GLContextImpl { extensionNameMap.put(GLExtensions.ARB_pixel_format, X11GLXDrawableFactory.GLX_SGIX_pbuffer); // good enough } - X11GLXContext(GLDrawableImpl drawable, - GLContext shareWith) { + X11GLXContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _glXExt=null; glXExtProcAddressTable = null; hasSwapInterval = 0; @@ -159,7 +159,7 @@ public class X11GLXContext extends GLContextImpl { return isGLXVersionGreaterEqualOneThree(); } - private final boolean glXMakeContextCurrent(long dpy, long writeDrawable, long readDrawable, long ctx) { + private final boolean glXMakeContextCurrent(final long dpy, final long writeDrawable, final long readDrawable, final long ctx) { boolean res = false; try { @@ -173,7 +173,7 @@ public class X11GLXContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if( DEBUG_TRACE_SWITCH ) { System.err.println(getThreadName()+": Warning: X11GLXContext.glXMakeContextCurrent failed: "+re+", with "+ "dpy "+toHexString(dpy)+ @@ -187,7 +187,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void destroyContextARBImpl(long ctx) { + protected void destroyContextARBImpl(final long ctx) { final long display = drawable.getNativeSurface().getDisplayHandle(); glXMakeContextCurrent(display, 0, 0, 0); @@ -207,22 +207,22 @@ public class X11GLXContext extends GLContextImpl { }; @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { updateGLXProcAddressTable(); - GLXExt _glXExt = getGLXExt(); + final GLXExt _glXExt = getGLXExt(); if(DEBUG) { System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct+ ", glXCreateContextAttribsARB: "+toHexString(glXExtProcAddressTable._addressof_glXCreateContextAttribsARB)); } - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; long ctx=0; - IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); + final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); attribs.put(ctx_arb_attribs_idx_major + 1, major); attribs.put(ctx_arb_attribs_idx_minor + 1, minor); @@ -246,8 +246,8 @@ public class X11GLXContext extends GLContextImpl { attribs.put(ctx_arb_attribs_idx_flags + 1, flags); } - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); final long display = device.getHandle(); try { @@ -256,9 +256,9 @@ public class X11GLXContext extends GLContextImpl { X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set X11Lib.XSync(display, false); ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if(DEBUG) { - Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); + final Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); t.printStackTrace(); } } @@ -291,7 +291,7 @@ public class X11GLXContext extends GLContextImpl { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); final X11GLXContext sharedContext = (X11GLXContext) factory.getOrCreateSharedContext(device); - long display = device.getHandle(); + final long display = device.getHandle(); if ( 0 != shareWithHandle ) { direct = GLX.glXIsDirect(display, shareWithHandle); @@ -410,7 +410,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - long dpy = drawable.getNativeSurface().getDisplayHandle(); + final long dpy = drawable.getNativeSurface().getDisplayHandle(); if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { @@ -426,7 +426,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { - long display = drawable.getNativeSurface().getDisplayHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (!glXMakeContextCurrent(display, 0, 0, 0)) { throw new GLException(getThreadName()+": Error freeing OpenGL context"); } @@ -438,10 +438,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void copyImpl(GLContext source, int mask) throws GLException { - long dst = getHandle(); - long src = source.getHandle(); - long display = drawable.getNativeSurface().getDisplayHandle(); + protected void copyImpl(final GLContext source, final int mask) throws GLException { + final long dst = getHandle(); + final long src = source.getHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (0 == display) { throw new GLException(getThreadName()+": Connection to X display not yet set up"); } @@ -482,7 +482,7 @@ public class X11GLXContext extends GLContextImpl { protected final StringBuilder getPlatformExtensionsStringImpl() { final NativeSurface ns = drawable.getNativeSurface(); final X11GraphicsDevice x11Device = (X11GraphicsDevice) ns.getGraphicsConfiguration().getScreen().getDevice(); - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); x11Device.lock(); try{ if (DEBUG) { @@ -519,7 +519,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; } final GLXExt glXExt = getGLXExt(); @@ -536,7 +536,7 @@ public class X11GLXContext extends GLContextImpl { } else { hasSwapInterval = -1; } - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } /* try { switch( hasSwapInterval ) { @@ -549,16 +549,16 @@ public class X11GLXContext extends GLContextImpl { if (2 == hasSwapInterval) { try { return 0 == glXExt.glXSwapIntervalSGI(interval); - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } return false; } - private final int initSwapGroupImpl(GLXExt glXExt) { + private final int initSwapGroupImpl(final GLXExt glXExt) { if(0==hasSwapGroupNV) { try { hasSwapGroupNV = glXExt.isExtensionAvailable(GLXExtensions.GLX_NV_swap_group)?1:-1; - } catch (Throwable t) { hasSwapGroupNV=1; } + } catch (final Throwable t) { hasSwapGroupNV=1; } if(DEBUG) { System.err.println("initSwapGroupImpl: "+GLXExtensions.GLX_NV_swap_group+": "+hasSwapGroupNV); } @@ -567,10 +567,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + protected final boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { final NativeSurface ns = drawable.getNativeSurface(); try { @@ -583,53 +583,53 @@ public class X11GLXContext extends GLContextImpl { maxBarriersNIO.get(maxGroups, maxGroups_offset, maxBarriersNIO.remaining()); res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean joinSwapGroupImpl(int group) { + protected final boolean joinSwapGroupImpl(final int group) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXJoinSwapGroupNV(drawable.getNativeSurface().getDisplayHandle(), drawable.getHandle(), group) ) { currentSwapGroup = group; res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean bindSwapBarrierImpl(int group, int barrier) { + protected final boolean bindSwapBarrierImpl(final int group, final int barrier) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXBindSwapBarrierNV(drawable.getNativeSurface().getDisplayHandle(), group, barrier) ) { res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { getGLXExt().glXFreeMemoryNV(pointer); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java index 155c00c4c..c29bc3bc3 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java @@ -47,7 +47,7 @@ import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { - protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); } @@ -59,7 +59,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { @Override protected void setRealizedImpl() { if(realized) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); config.updateGraphicsConfiguration(); if (DEBUG) { @@ -69,7 +69,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle()); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index f7938f463..fbab32963 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -103,7 +103,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { if(null!=tmp && tmp.isLibComplete()) { GLX.getGLXProcAddressTable().reset(tmp); } - } catch (Exception ex) { + } catch (final Exception ex) { tmp = null; if(DEBUG) { ex.printStackTrace(); @@ -159,7 +159,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return x11GLXDynamicLookupHelper; } @@ -180,9 +180,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { GLDrawableImpl drawable; GLContextImpl context; - SharedResource(X11GraphicsDevice dev, X11GraphicsScreen scrn, - GLDrawableImpl draw, GLContextImpl ctx, - VersionNumber glXServerVer, String glXServerVendor, boolean glXServerMultisampleAvail) { + SharedResource(final X11GraphicsDevice dev, final X11GraphicsScreen scrn, + final GLDrawableImpl draw, final GLContextImpl ctx, + final VersionNumber glXServerVer, final String glXServerVendor, final boolean glXServerMultisampleAvail) { device = dev; screen = scrn; drawable = draw; @@ -227,11 +227,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { + public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { return sharedMap.put(connection, resource); } @Override - public SharedResourceRunner.Resource mapGet(String connection) { + public SharedResourceRunner.Resource mapGet(final String connection) { return sharedMap.get(connection); } @Override @@ -240,7 +240,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(String connection) { + public boolean isDeviceSupported(final String connection) { final boolean res; final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); x11Device.lock(); @@ -257,7 +257,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public SharedResourceRunner.Resource createSharedResource(String connection) { + public SharedResourceRunner.Resource createSharedResource(final String connection) { final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); sharedDevice.lock(); try { @@ -312,7 +312,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, glXServerVersion, glXServerVendorName, glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable()); - } catch (Throwable t) { + } catch (final Throwable t) { throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t); } finally { sharedDevice.unlock(); @@ -320,8 +320,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public void releaseSharedResource(SharedResourceRunner.Resource shared) { - SharedResource sr = (SharedResource) shared; + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; if (DEBUG) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); @@ -361,7 +361,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null != x11GLXDynamicLookupHelper && device instanceof X11GraphicsDevice) { return true; } @@ -374,11 +374,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice device) { return (SharedResource) sharedResourceRunner.getOrCreateShared(device); } - protected final long getOrCreateSharedDpy(AbstractGraphicsDevice device) { + protected final long getOrCreateSharedDpy(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getDevice().getHandle(); @@ -387,12 +387,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } @Override - protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -400,19 +400,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { return new X11PixmapGLXDrawable(this, target); } // PBuffer GLDrawable Creation GLDrawableImpl pbufferDrawable; - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); /** * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277, @@ -420,7 +420,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { * The dummy context shall also use the same Display, * since switching Display in this regard is another ATI bug. */ - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if( null!=sr && sr.isGLXVendorATI() && null == GLContext.getCurrent() ) { sr.getContext().makeCurrent(); try { @@ -434,9 +434,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return pbufferDrawable; } - public final boolean isGLXMultisampleAvailable(AbstractGraphicsDevice device) { + public final boolean isGLXMultisampleAvailable(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXMultisampleAvailable(); } @@ -444,9 +444,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final VersionNumber getGLXVersionNumber(AbstractGraphicsDevice device) { + public final VersionNumber getGLXVersionNumber(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.getGLXVersion(); } @@ -457,9 +457,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return null; } - public final boolean isGLXVersionGreaterEqualOneOne(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneOne(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneOne(); } @@ -471,9 +471,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final boolean isGLXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneThree(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneThree(); } @@ -486,9 +486,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, final GLProfile glp) { if(null == device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); + final SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); if(null!=sr) { device = sr.getDevice(); } @@ -497,10 +497,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); @@ -516,14 +516,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); } @Override - protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final 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); @@ -546,7 +546,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public final boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return canCreateGLPbuffer(device, null /* GLProfile not used for query on X11 */); } @@ -567,13 +567,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return gammaRampLength; } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return 0; } - int[] size = new int[1]; - boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, + final int[] size = new int[1]; + final boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, X11Lib.DefaultScreen(display), size, 0); if (!res) { @@ -585,19 +585,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final boolean setGammaRamp(float[] ramp) { - long display = getOrCreateSharedDpy(defaultDevice); + protected final boolean setGammaRamp(final float[] ramp) { + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return false; } - int len = ramp.length; - short[] rampData = new short[len]; + final int len = ramp.length; + final short[] rampData = new short[len]; for (int i = 0; i < len; i++) { rampData[i] = (short) (ramp[i] * 65535); } - boolean res = X11Lib.XF86VidModeSetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), rampData.length, rampData, 0, @@ -608,24 +608,24 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @Override protected final Buffer getGammaRamp() { - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return null; } - int size = getGammaRampLength(); - ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); + final int size = getGammaRampLength(); + final ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); - boolean res = X11Lib.XF86VidModeGetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeGetGammaRamp(display, X11Lib.DefaultScreen(display), size, redRampData, @@ -638,30 +638,30 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final void resetGammaRamp(Buffer originalGammaRamp) { + protected final void resetGammaRamp(final Buffer originalGammaRamp) { if (originalGammaRamp == null) { return; // getGammaRamp failed originally } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return; } - ShortBuffer rampData = (ShortBuffer) originalGammaRamp; - int capacity = rampData.capacity(); + final ShortBuffer rampData = (ShortBuffer) originalGammaRamp; + final int capacity = rampData.capacity(); if ((capacity % 3) != 0) { throw new IllegalArgumentException("Must not be the original gamma ramp"); } - int size = capacity / 3; + final int size = capacity / 3; rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java index 951174f71..0e91a6a65 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java @@ -62,14 +62,14 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("glXGetProcAddressARB"); res.add("glXGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return GLX.glXGetProcAddress(toolGetProcAddressHandle, funcName); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index c0a3b46df..5f6a6b344 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -65,8 +65,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem public static final int MAX_ATTRIBS = 128; private final GLCapabilitiesChooser chooser; - X11GLXGraphicsConfiguration(X11GraphicsScreen screen, - X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + X11GLXGraphicsConfiguration(final X11GraphicsScreen screen, + final X11GLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo()); this.chooser=chooser; } @@ -109,7 +109,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static X11GLXGraphicsConfiguration create(GLProfile glp, X11GraphicsScreen x11Screen, int fbcfgID) { + static X11GLXGraphicsConfiguration create(GLProfile glp, final X11GraphicsScreen x11Screen, final int fbcfgID) { final X11GraphicsDevice device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = device.getHandle(); if(0==display) { @@ -131,11 +131,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps, - boolean forFBAttr, boolean isMultisampleAvailable, - long display, int screen) + static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + final boolean forFBAttr, final boolean isMultisampleAvailable, + final long display, final int screen) { - int colorDepth = (caps.getRedBits() + + final int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); if (colorDepth < 15) { @@ -237,12 +237,12 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // FBConfig - static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { - long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); + static boolean GLXFBConfigIDValid(final long display, final int screen, final int fbcfgid) { + final long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ; } - static boolean GLXFBConfigValid(long display, long fbcfg) { + static boolean GLXFBConfigValid(final long display, final long fbcfg) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) { return false; @@ -275,14 +275,14 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return val; } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual) { - XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual) { + final XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); if(null == renderPictFmt) { return null; } return renderPictFmt.getDirect(); } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual, XRenderPictFormat dest) { + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual, final XRenderPictFormat dest) { if( !X11Lib.XRenderFindVisualFormat(dpy, visual, dest) ) { return null; } else { @@ -298,7 +298,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } static List<GLCapabilitiesImmutable> GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL, - final int winattrmask, final boolean isMultisampleAvailable, boolean onlyFirstValid) { + final int winattrmask, final boolean isMultisampleAvailable, final boolean onlyFirstValid) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create(); final List<GLCapabilitiesImmutable> result = new ArrayList<GLCapabilitiesImmutable>(); @@ -424,7 +424,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - private static String glXGetFBConfigErrorCode(int err) { + private static String glXGetFBConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; @@ -432,7 +432,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static boolean glXGetFBConfig(long display, long cfg, int attrib, IntBuffer tmp) { + static boolean glXGetFBConfig(final long display, final long cfg, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } @@ -445,7 +445,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static int glXFBConfig2FBConfigID(long display, long cfg) { + static int glXFBConfig2FBConfigID(final long display, final long cfg) { final IntBuffer tmpID = Buffers.newDirectIntBuffer(1); if( glXGetFBConfig(display, cfg, GLX.GLX_FBCONFIG_ID, tmpID) ) { return tmpID.get(0); @@ -454,11 +454,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static long glXFBConfigID2FBConfig(long display, int screen, int id) { + static long glXFBConfigID2FBConfig(final long display, final int screen, final int id) { final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 }); final IntBuffer count = Buffers.newDirectIntBuffer(1); count.put(0, -1); - PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); + final PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); if (fbcfgsL == null || fbcfgsL.limit()<1) { return 0; } @@ -467,15 +467,15 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // Visual Info - static XVisualInfo XVisualID2XVisualInfo(long display, long visualID) { - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + static XVisualInfo XVisualID2XVisualInfo(final long display, final long visualID) { + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setVisualid(visualID); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); if (infos == null || infos.length == 0) { return null; } - XVisualInfo res = XVisualInfo.create(infos[0]); + final XVisualInfo res = XVisualInfo.create(infos[0]); if (DEBUG) { System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID)); System.err.println("Resulting XVisualInfo: visualid = " + toHexString(res.getVisualid())); @@ -483,8 +483,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info, - final int winattrmask, boolean isMultisampleEnabled) { + static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final XVisualInfo info, + final int winattrmask, final boolean isMultisampleEnabled) { final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT | GLGraphicsConfigurationUtil.FBO_BIT ; @@ -512,7 +512,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return null; } - GLCapabilities res = new X11GLCapabilities(info, glp); + final GLCapabilities res = new X11GLCapabilities(info, glp); res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp) != 0); res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp) != 0); @@ -551,7 +551,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } - private static String glXGetConfigErrorCode(int err) { + private static String glXGetConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN"; @@ -561,11 +561,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static int glXGetConfig(long display, XVisualInfo info, int attrib, IntBuffer tmp) { + static int glXGetConfig(final long display, final XVisualInfo info, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } - int res = GLX.glXGetConfig(display, info, attrib, tmp); + final int res = GLX.glXGetConfig(display, info, attrib, tmp); if (res != 0) { throw new GLException("glXGetConfig("+toHexString(attrib)+") failed: error code " + glXGetConfigErrorCode(res)); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 75771f884..44479acc0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -94,7 +94,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } @@ -124,8 +124,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID); } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { - X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final X11GLXDrawableFactory factory, final AbstractGraphicsDevice device) { + final X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -153,7 +153,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesFBConfig(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { PointerBuffer fbcfgsL = null; // Utilizing FBConfig @@ -184,20 +184,20 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesXVisual(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); final long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final int screen = x11Screen.getIndex(); - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } - ArrayList<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); + final ArrayList<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); for (int i = 0; i < infos.length; i++) { final GLCapabilitiesImmutable caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(absDevice, glProfile, infos[i], GLGraphicsConfigurationUtil.ALL_BITS, isMultisampleAvailable); if(null != caps) { @@ -211,17 +211,17 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { if (x11Screen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } if (capsChosen == null) { capsChosen = new GLCapabilities(null); } - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device); final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer(); @@ -250,7 +250,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return res; } - static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(X11GraphicsScreen x11Screen, int fbID, GLProfile glp) { + static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(final X11GraphicsScreen x11Screen, final int fbID, final GLProfile glp) { final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = x11Device.getHandle(); final int screen = x11Screen.getIndex(); @@ -274,19 +274,19 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { int recommendedIndex = -1; PointerBuffer fbcfgsL = null; - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); // Utilizing FBConfig // - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - long display = x11Device.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = x11Device.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device); @@ -379,27 +379,27 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final X11GraphicsScreen x11Screen, final int xvisualID) { if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen.isOnscreen(), capsChosen.isFBO(), false /* pbuffer */, capsChosen.isBitmap()); - List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); + final List<GLCapabilitiesImmutable> availableCaps = new ArrayList<GLCapabilitiesImmutable>(); int recommendedIndex = -1; - X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); - long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = absDevice.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice); @@ -421,10 +421,10 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } // 2nd choice: get all GLCapabilities available, preferred recommendedIndex might be available if 1st choice was successful - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } @@ -451,7 +451,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { for(int i=0; i<availableCaps.size(); ) { - VisualIDHolder vidh = availableCaps.get(i); + final VisualIDHolder vidh = availableCaps.get(i); if(vidh.getVisualID(VIDType.X11_XVISUAL) != xvisualID ) { availableCaps.remove(i); } else { @@ -468,7 +468,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } } - int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); + final int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); if ( 0 > chosenIndex ) { if (DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: failed, return null"); @@ -476,7 +476,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java index 9da189290..866662950 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java @@ -51,7 +51,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { long glXWindow; // GLXWindow, a GLXDrawable representation boolean useGLXWindow; - protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeSurface component, boolean realized) { + protected X11OnscreenGLXDrawable(final GLDrawableFactory factory, final NativeSurface component, final boolean realized) { super(factory, component, realized); glXWindow=0; useGLXWindow=false; @@ -84,10 +84,10 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { @Override protected final void createHandle() { if(USE_GLXWINDOW) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); if(config.getFBConfig()>=0) { useGLXWindow=true; - long dpy = getNativeSurface().getDisplayHandle(); + final long dpy = getNativeSurface().getDisplayHandle(); if(0!=glXWindow) { GLX.glXDestroyWindow(dpy, glXWindow); } @@ -103,7 +103,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index ae2982269..21ad06020 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -53,7 +53,7 @@ import javax.media.opengl.GLException; import com.jogamp.common.nio.Buffers; public class X11PbufferGLXDrawable extends X11GLXDrawable { - protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PbufferGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { /* GLCapabilities caps, GLCapabilitiesChooser chooser, int width, int height */ @@ -70,12 +70,12 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } protected void destroyPbuffer() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { GLX.glXDestroyPbuffer(ns.getDisplayHandle(), ns.getSurfaceHandle()); } @@ -102,7 +102,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { // Create the p-buffer. int niattribs = 0; - IntBuffer iattributes = Buffers.newDirectIntBuffer(7); + final IntBuffer iattributes = Buffers.newDirectIntBuffer(7); iattributes.put(niattribs++, GLX.GLX_PBUFFER_WIDTH); iattributes.put(niattribs++, ms.getSurfaceWidth()); @@ -112,7 +112,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { iattributes.put(niattribs++, 0); iattributes.put(niattribs++, 0); - long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); + final long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); if (pbuffer == 0) { // FIXME: query X error code for detail error message throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index 42d76097c..e217e1c2a 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -54,7 +54,7 @@ import jogamp.nativewindow.x11.XVisualInfo; public class X11PixmapGLXDrawable extends X11GLXDrawable { private long pixmap; - protected X11PixmapGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PixmapGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -68,26 +68,26 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } private void createPixmap() { - NativeSurface ns = getNativeSurface(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); - XVisualInfo vis = config.getXVisualInfo(); - int bitsPerPixel = vis.getDepth(); - AbstractGraphicsScreen aScreen = config.getScreen(); - AbstractGraphicsDevice aDevice = aScreen.getDevice(); - long dpy = aDevice.getHandle(); - int screen = aScreen.getIndex(); + final NativeSurface ns = getNativeSurface(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); + final XVisualInfo vis = config.getXVisualInfo(); + final int bitsPerPixel = vis.getDepth(); + final AbstractGraphicsScreen aScreen = config.getScreen(); + final AbstractGraphicsDevice aDevice = aScreen.getDevice(); + final long dpy = aDevice.getHandle(); + final int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), surface.getSurfaceWidth(), surface.getSurfaceHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } - long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); + final long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); if (drawable == 0) { X11Lib.XFreePixmap(dpy, pixmap); pixmap = 0; @@ -104,7 +104,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { protected void destroyPixmap() { if (pixmap == 0) return; - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); long display = ns.getDisplayHandle(); long drawable = ns.getSurfaceHandle(); @@ -117,7 +117,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { // Must destroy pixmap and GLXPixmap if (DEBUG) { - long cur = GLX.glXGetCurrentContext(); + final long cur = GLX.glXGetCurrentContext(); if (cur != 0) { System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction"); } |