diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/macosx | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx')
11 files changed, 143 insertions, 142 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index dadad1e15..a6ab635e4 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -59,6 +59,7 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.opengl.GLContextImpl; @@ -107,9 +108,9 @@ public class MacOSXCGLContext extends GLContextImpl isMavericksOrLater = osvn.compareTo(Platform.OSXVersion.Mavericks) >= 0; } - static boolean isGLProfileSupported(int ctp, int major, int minor) { - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; + static boolean isGLProfileSupported(final int ctp, final int major, final int minor) { + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; // We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2 if( 3 < major || 3 == major && 1 <= minor ) { @@ -135,7 +136,7 @@ public class MacOSXCGLContext extends GLContextImpl } return false; // 3.0 && > 3.2 } - static int GLProfile2CGLOGLProfileValue(AbstractGraphicsDevice device, int ctp, int major, int minor) { + static int GLProfile2CGLOGLProfileValue(final AbstractGraphicsDevice device, final int ctp, final int major, final int minor) { if(!MacOSXCGLContext.isGLProfileSupported(ctp, major, minor)) { throw new GLException("OpenGL profile not supported: "+getGLVersion(major, minor, ctp, "@GLProfile2CGLOGLProfileVersion")); } @@ -158,7 +159,7 @@ public class MacOSXCGLContext extends GLContextImpl private static final String shaderBasename = "texture01_xxx"; - private static ShaderProgram createCALayerShader(GL3ES3 gl) { + private static ShaderProgram createCALayerShader(final GL3ES3 gl) { // Create & Link the shader program final ShaderProgram sp = new ShaderProgram(); final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, @@ -176,9 +177,9 @@ public class MacOSXCGLContext extends GLContextImpl // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv pmvMatrixUniform.setLocation(gl, sp.program()); @@ -203,14 +204,14 @@ public class MacOSXCGLContext extends GLContextImpl private long updateHandle = 0; private int lastWidth, lastHeight; - protected MacOSXCGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + protected MacOSXCGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); initOpenGLImpl(getOpenGLMode()); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _cglExt = null; cglExtProcAddressTable = null; super.resetStates(isInit); @@ -248,7 +249,7 @@ public class MacOSXCGLContext extends GLContextImpl protected Map<String, String> getExtensionNameMap() { return null; } @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) { if(!isGLProfileSupported(ctp, major, minor)) { if(DEBUG) { System.err.println(getThreadName() + ": createContextARBImpl: Not supported "+getGLVersion(major, minor, ctp, "@creation on OSX "+Platform.getOSVersionNumber())); @@ -276,7 +277,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { impl.release(_context); impl.destroy(_context); } @@ -380,7 +381,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void associateDrawable(boolean bound) { + protected void associateDrawable(final boolean bound) { // context stuff depends on drawable stuff if(bound) { super.associateDrawable(true); // 1) init drawable stuff @@ -399,7 +400,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) { throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this); } @@ -416,18 +417,18 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { return impl.setSwapInterval(interval); } @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) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @@ -467,7 +468,7 @@ public class MacOSXCGLContext extends GLContextImpl } // Support for "mode switching" as described in MacOSXCGLDrawable - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { return; } @@ -485,7 +486,7 @@ public class MacOSXCGLContext extends GLContextImpl } public final GLBackendType getOpenGLMode() { return openGLMode; } - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -500,7 +501,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); @@ -528,7 +529,7 @@ public class MacOSXCGLContext extends GLContextImpl /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */ - private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) { + private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO) { final long nsViewHandle; if(drawable instanceof GLFBODrawableImpl) { nsViewHandle = 0; @@ -562,7 +563,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final NativeSurface surface = drawable.getNativeSurface(); final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration(); @@ -571,8 +572,8 @@ public class MacOSXCGLContext extends GLContextImpl final boolean isPBuffer; final boolean isFBO; { - boolean[] _isPBuffer = { false }; - boolean[] _isFBO = { false }; + final boolean[] _isPBuffer = { false }; + final boolean[] _isFBO = { false }; nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO); isPBuffer = _isPBuffer[0]; isFBO = _isFBO[0]; @@ -654,7 +655,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { if(0!=pixelFormat) { CGL.deletePixelFormat(pixelFormat); pixelFormat = 0; @@ -690,8 +691,8 @@ public class MacOSXCGLContext extends GLContextImpl /** Synchronized by instance's monitor */ boolean valid; - AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, - boolean isOpaque, int texWidth, int texHeight, int winWidth, int winHeight) { + AttachGLLayerCmd(final OffscreenLayerSurface ols, final long ctx, final int shaderProgram, final long pfmt, final long pbuffer, final int texID, + final boolean isOpaque, final int texWidth, final int texHeight, final int winWidth, final int winHeight) { this.ols = ols; this.ctx = ctx; this.shaderProgram = shaderProgram; @@ -745,7 +746,7 @@ public class MacOSXCGLContext extends GLContextImpl surfaceLock.unlock(); } } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } if( !valid ) { @@ -764,7 +765,7 @@ public class MacOSXCGLContext extends GLContextImpl class DetachGLLayerCmd implements Runnable { final AttachGLLayerCmd cmd; - DetachGLLayerCmd(AttachGLLayerCmd cmd) { + DetachGLLayerCmd(final AttachGLLayerCmd cmd) { this.cmd = cmd; } @@ -784,7 +785,7 @@ public class MacOSXCGLContext extends GLContextImpl if( 0 != l ) { ols.detachSurfaceLayer(); } - } catch(Throwable t) { + } catch(final Throwable t) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); } @@ -802,7 +803,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true); if(DEBUG) { @@ -831,7 +832,7 @@ public class MacOSXCGLContext extends GLContextImpl pbufferHandle = 0; fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() { @Override - public void swapBuffers(boolean doubleBuffered) { + public void swapBuffers(final boolean doubleBuffered) { MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers(); } } ) ; } else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { @@ -870,8 +871,8 @@ public class MacOSXCGLContext extends GLContextImpl } else { // -> null == backingLayerHost lastWidth = drawable.getSurfaceWidth(); lastHeight = drawable.getSurfaceHeight(); - boolean[] isPBuffer = { false }; - boolean[] isFBO = { false }; + final boolean[] isPBuffer = { false }; + final boolean[] isFBO = { false }; CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); } } else { // -> !bound @@ -906,7 +907,7 @@ public class MacOSXCGLContext extends GLContextImpl } } - private final void validatePBufferConfig(long ctx) { + private final void validatePBufferConfig(final long ctx) { final long drawableHandle = drawable.getHandle(); if( needsSetContextPBuffer && 0 != drawableHandle && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { // Must associate the pbuffer with our newly-created context @@ -919,7 +920,7 @@ public class MacOSXCGLContext extends GLContextImpl } /** Returns true if size has been updated, otherwise false (same size). */ - private final boolean validateDrawableSizeConfig(long ctx) { + private final boolean validateDrawableSizeConfig(final long ctx) { final int width = drawable.getSurfaceWidth(); final int height = drawable.getSurfaceHeight(); if( lastWidth != width || lastHeight != height ) { @@ -934,13 +935,13 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.copyContext(contextHandle, src, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { final long cglCtx = CGL.getCGLContext(ctx); if(0 == cglCtx) { throw new InternalError("Null CGLContext for: "+this); @@ -956,12 +957,12 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); @@ -987,7 +988,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final AttachGLLayerCmd cmd = attachGLLayerCmd; if(null != cmd) { synchronized(cmd) { @@ -1001,7 +1002,7 @@ public class MacOSXCGLContext extends GLContextImpl return true; } - private void setSwapIntervalImpl(final long l, int interval) { + private void setSwapIntervalImpl(final long l, final int interval) { if( 0 != l ) { CGL.setNSOpenGLLayerSwapInterval(l, interval); if( 0 < interval ) { @@ -1124,7 +1125,7 @@ public class MacOSXCGLContext extends GLContextImpl public boolean isNSContext() { return false; } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -1135,7 +1136,7 @@ public class MacOSXCGLContext extends GLContextImpl } try { // Create new context - PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); + final PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); if (DEBUG) { System.err.println("Share context for CGL-based pbuffer context is " + toHexString(share)); } @@ -1173,22 +1174,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { return CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError; } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.CGLCopyContext(src, contextHandle, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { int err = CGL.CGLLockContext(ctx); if(CGL.kCGLNoError == err) { err = CGL.CGLSetCurrentContext(ctx); @@ -1204,22 +1205,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); } } - int err = CGL.CGLSetCurrentContext(0); + final int err = CGL.CGLSetCurrentContext(0); if(DEBUG && CGL.kCGLNoError != err) { System.err.println("CGL: Could not release current context: err 0x"+Integer.toHexString(err)+": "+this); } - int err2 = CGL.CGLUnlockContext(ctx); + final int err2 = CGL.CGLUnlockContext(ctx); if(DEBUG && CGL.kCGLNoError != err2) { System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err2)+": "+this); } @@ -1237,7 +1238,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final IntBuffer lval = Buffers.newDirectIntBuffer(1); lval.put(0, interval); CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 448e3e221..8ea84a32d 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -91,7 +91,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { public final int id; - GLBackendType(int id){ + GLBackendType(final int id){ this.id = id; } } @@ -100,7 +100,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { private boolean haveSetOpenGLMode = false; private GLBackendType openGLMode = GLBackendType.NSOPENGL; - public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + public MacOSXCGLDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); initOpenGLImpl(getOpenGLMode()); } @@ -110,7 +110,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected void associateContext(GLContext ctx, boolean bound) { + protected void associateContext(final GLContext ctx, final boolean bound) { // NOTE: we need to keep track of the created contexts in order to // implement swapBuffers() because of how Mac OS X implements its // OpenGL window interface @@ -132,7 +132,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { synchronized (createdContexts) { for(int i=0; i<createdContexts.size(); ) { @@ -154,7 +154,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } // Support for "mode switching" as described in MacOSXCGLDrawable - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { return; } @@ -171,6 +171,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } public final GLBackendType getOpenGLMode() { return openGLMode; } - protected void initOpenGLImpl(GLBackendType backend) { /* nop */ } + protected void initOpenGLImpl(final GLBackendType backend) { /* nop */ } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 8931045d1..7c05b8eab 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -89,7 +89,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { DesktopGLDynamicLookupHelper tmp = null; try { tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -113,7 +113,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { try { ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory", "registerFactory", null, null, getClass().getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } sharedMap = new HashMap<String, SharedResource>(); @@ -144,7 +144,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return macOSXCGLDynamicLookupHelper; } @@ -161,9 +161,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures; boolean hasAppleFloatPixels; - SharedResource(MacOSXGraphicsDevice device, boolean valid, - boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels - /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, GLRendererQuirks glRendererQuirks) { + SharedResource(final MacOSXGraphicsDevice device, final boolean valid, + final boolean hasNPOTTextures, final boolean hasRECTTextures, final boolean hasAppletFloatPixels + /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, final GLRendererQuirks glRendererQuirks) { // drawable = draw; // this.context = ctx; this.glRendererQuirks = glRendererQuirks; @@ -207,7 +207,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null!=macOSXCGLDynamicLookupHelper && device instanceof MacOSXGraphicsDevice) { return true; } @@ -216,24 +216,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { private final HashSet<String> devicesTried = new HashSet<String>(); - private boolean getDeviceTried(String connection) { + private boolean getDeviceTried(final String connection) { synchronized (devicesTried) { return devicesTried.contains(connection); } } - private void addDeviceTried(String connection) { + private void addDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.add(connection); } } - private void removeDeviceTried(String connection) { + private void removeDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.remove(connection); } } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { final String connection = adevice.getConnection(); SharedResource sr; synchronized(sharedMap) { @@ -248,7 +248,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures = false; boolean hasAppleFloatPixels = false; { - GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); } @@ -265,13 +265,13 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { sharedContext.makeCurrent(); // could cause exception isValid = sharedContext.isCurrent(); if(isValid) { - GL gl = sharedContext.getGL(); + final GL gl = sharedContext.getGL(); hasNPOTTextures = gl.isNPOTTextureAvailable(); hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle); hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels); glRendererQuirks = sharedContext.getRendererQuirks(); } - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:"); gle.printStackTrace(); @@ -279,7 +279,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } finally { try { sharedContext.destroy(); - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:"); gle.printStackTrace(); @@ -308,12 +308,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device); } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -321,7 +321,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { final MutableGraphicsConfiguration config = (MutableGraphicsConfiguration) target.getGraphicsConfiguration(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { @@ -336,7 +336,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { if( glp.isGL2() ) { // OSX only supports pbuffer w/ compatible, non-core, context. return true; @@ -346,9 +346,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final MacOSXGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) { device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); @@ -364,15 +364,15 @@ public class MacOSXCGLDrawableFactory 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 OSXDummyUpstreamSurfaceHook(width, height)); } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true); @@ -385,7 +385,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } @@ -409,7 +409,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected boolean setGammaRamp(float[] ramp) { + protected boolean setGammaRamp(final float[] ramp) { final FloatBuffer rampNIO = Buffers.newDirectFloatBuffer(ramp); return CGL.setGammaRamp(ramp.length, rampNIO, rampNIO, rampNIO); @@ -421,7 +421,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected void resetGammaRamp(Buffer originalGammaRamp) { + protected void resetGammaRamp(final Buffer originalGammaRamp) { CGL.resetGammaRamp(); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java index cda8307c7..3ec40ffce 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java @@ -56,7 +56,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return 0; /** OSX manual says: NSImage use is discouraged return CGL.getProcAddress(glFuncName); // manual implementation diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index 481c0b94b..cd89ad526 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -53,8 +53,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) { + MacOSXCGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); } @@ -63,8 +63,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return super.clone(); } - protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(MacOSXCGLDrawableFactory factory, AbstractGraphicsDevice device) { - MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List<GLCapabilitiesImmutable> getAvailableCapabilities(final MacOSXCGLDrawableFactory factory, final AbstractGraphicsDevice device) { + final MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -88,7 +88,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration CGL.NSOpenGLPFASampleBuffers, CGL.NSOpenGLPFASamples }); - static IntBuffer GLCapabilities2NSAttribList(AbstractGraphicsDevice device, IntBuffer attrToken, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static IntBuffer GLCapabilities2NSAttribList(final AbstractGraphicsDevice device, final IntBuffer attrToken, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final int len = attrToken.remaining(); final int off = attrToken.position(); final IntBuffer ivalues = Buffers.newDirectIntBuffer(len); @@ -155,7 +155,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return ivalues; } - static long GLCapabilities2NSPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2NSPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); if ( !MacOSXCGLContext.isLionOrLater ) { // no OpenGLProfile @@ -165,11 +165,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues); } - static GLCapabilities NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) { + static GLCapabilities NSPixelFormat2GLCapabilities(final GLProfile glp, final long pixelFormat) { return PixelFormat2GLCapabilities(glp, pixelFormat, true); } - static long GLCapabilities2CGLPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2CGLPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { // Set up pixel format attributes final IntBuffer attrs = Buffers.newDirectIntBuffer(256); int i = 0; @@ -214,20 +214,20 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } // Use attribute array to select pixel format - PointerBuffer fmt = PointerBuffer.allocateDirect(1); - IntBuffer numScreens = Buffers.newDirectIntBuffer(1); - int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); + final PointerBuffer fmt = PointerBuffer.allocateDirect(1); + final IntBuffer numScreens = Buffers.newDirectIntBuffer(1); + final int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); if (res != CGL.kCGLNoError) { throw new GLException("Error code " + res + " while choosing pixel format"); } return fmt.get(0); } - static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { + static GLCapabilities CGLPixelFormat2GLCapabilities(final long pixelFormat) { return PixelFormat2GLCapabilities(null, pixelFormat, false); } - private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) { + private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, final long pixelFormat, final boolean nsUsage) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); final int off; if ( !MacOSXCGLContext.isLionOrLater ) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index db2a1df68..50de70227 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -61,8 +61,8 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati @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 == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); @@ -84,15 +84,15 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati } static MacOSXCGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, boolean usePBuffer) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final boolean usePBuffer) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } final AbstractGraphicsDevice device = absScreen.getDevice(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device); - return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested); + return new MacOSXCGLGraphicsConfiguration(absScreen, capsChosen, capsRequested); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index 150feac55..c17ed7d59 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -56,7 +56,7 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType; public class MacOSXExternalCGLContext extends MacOSXCGLContext { - private MacOSXExternalCGLContext(Drawable drawable, boolean isNSContext, long handle) { + private MacOSXExternalCGLContext(final Drawable drawable, final boolean isNSContext, final long handle) { super(drawable, null); setOpenGLMode(isNSContext ? GLBackendType.NSOPENGL : GLBackendType.CGL ); this.contextHandle = handle; @@ -67,13 +67,13 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static MacOSXExternalCGLContext create(GLDrawableFactory factory) { + protected static MacOSXExternalCGLContext create(final GLDrawableFactory factory) { long pixelFormat = 0; long currentDrawable = 0; long contextHandle = CGL.getCurrentContext(); // Check: MacOSX 10.3 .. - boolean isNSContext = 0 != contextHandle; + final boolean isNSContext = 0 != contextHandle; if( isNSContext ) { - long ctx = CGL.getCGLContext(contextHandle); + final long ctx = CGL.getCGLContext(contextHandle); if (ctx == 0) { throw new GLException("Error: NULL Context (CGL) of Context (NS) 0x" +Long.toHexString(contextHandle)); } @@ -100,19 +100,19 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { if (0 == pixelFormat) { throw new GLException("Error: current pixelformat of current Context 0x"+Long.toHexString(contextHandle)+" is null"); } - GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); + final GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); if(DEBUG) { System.err.println("MacOSXExternalCGLContext Create "+caps); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); - MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); + final AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); + final MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); if(0 == currentDrawable) { // set a fake marker stating a valid drawable currentDrawable = 1; } - WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); + final WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); } @@ -135,12 +135,12 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { // Need to provide the display connection to extension querying APIs static class Drawable extends MacOSXCGLDrawable { - 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"); } @@ -154,7 +154,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { 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/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index 446a834b9..c613efa63 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -46,13 +46,13 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { - public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, - NativeSurface target) { + public MacOSXOffscreenCGLDrawable(final GLDrawableFactory factory, + final NativeSurface target) { super(factory, target); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index c6f0c1383..e9ea2ff61 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -46,12 +46,12 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { - protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) { + protected MacOSXOnscreenCGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index eba97a9ca..b1d560f4a 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -73,7 +73,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { protected int pBufferTexTarget, pBufferTexWidth, pBufferTexHeight; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) { + public MacOSXPbufferCGLDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -87,7 +87,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } @@ -121,7 +121,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { final DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ms.getGraphicsConfiguration(); final GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities(); final GLProfile glProfile = capabilities.getGLProfile(); - MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); + final MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); if (DEBUG) { System.out.println(getThreadName()+": Pbuffer config: " + config); @@ -160,13 +160,13 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { super.setOpenGLMode(mode); createPbuffer(); // recreate } @Override - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -182,12 +182,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // NSOpenGLPixelBuffer implementation class NSOpenGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { return CGL.createPBuffer(renderTarget, internalFormat, width, height); } @Override - public void destroy(long pbuffer) { + public void destroy(final long pbuffer) { CGL.destroyPBuffer(pbuffer); } } @@ -195,9 +195,9 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // CGL implementation class CGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { - PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); - int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { + final PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); + final int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error creating CGL-based pbuffer: error code " + res); } @@ -205,8 +205,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void destroy(long pbuffer) { - int res = CGL.CGLDestroyPBuffer(pbuffer); + public void destroy(final long pbuffer) { + final int res = CGL.CGLDestroyPBuffer(pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error destroying CGL-based pbuffer: error code " + res); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 21923531f..01300b005 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -65,8 +65,8 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -76,7 +76,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur if(null==absScreen) { absScreen = AWTGraphicsScreen.createDefault(); } - AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; + final AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) { @@ -96,14 +96,14 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: got "+absScreen); } - MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); - DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); + final MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + final DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); if(DEBUG) { System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: made "+macScreen); } - GraphicsConfiguration gc = device.getDefaultConfiguration(); - MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) + final GraphicsConfiguration gc = device.getDefaultConfiguration(); + final MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(macDevice, capsChosen).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, macScreen, nativeVisualID); |