diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
181 files changed, 3591 insertions, 3591 deletions
diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java index b88a09b71..74892d894 100644 --- a/src/jogl/classes/jogamp/opengl/Debug.java +++ b/src/jogl/classes/jogamp/opengl/Debug.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -51,14 +51,14 @@ public class Debug extends PropertyAccess { // Some common properties private static final boolean verbose; private static final boolean debugAll; - + static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { PropertyAccess.addTrustedPrefix("jogl."); return null; } } ); - + verbose = isPropertyDefined("jogl.verbose", true); debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { @@ -68,7 +68,7 @@ public class Debug extends PropertyAccess { System.err.println("JOGL implementation vendor " + p.getImplementationVendor()); } } - + /** Ensures static init block has been issues, i.e. if calling through to {@link PropertyAccess#isPropertyDefined(String, boolean)}. */ public static final void initSingleton() {} diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java index ef9477a31..578f416b7 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import java.util.List; @@ -47,11 +47,11 @@ public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibrary public final List<String> getGlueLibNames() { return glueLibNames; } - + @Override public final boolean useToolGetProcAdressFirst(String funcName) { return true; } - + } diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java index 8eb3468ed..a1023acd2 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import com.jogamp.common.os.NativeLibrary; diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java index 94acf93b0..b8bcd2e78 100644 --- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -59,7 +59,7 @@ final class ExtensionAvailabilityCache { } /** - * Flush the cache. + * Flush the cache. */ final void flush() { @@ -87,7 +87,7 @@ final class ExtensionAvailabilityCache { validateInitialization(); return availableExtensionCache.size(); } - + final boolean isExtensionAvailable(String glExtensionName) { validateInitialization(); return availableExtensionCache.contains(glExtensionName); @@ -97,7 +97,7 @@ final class ExtensionAvailabilityCache { validateInitialization(); return glXExtensionCount; } - + final String getPlatformExtensionsString() { validateInitialization(); return glXExtensions; @@ -107,7 +107,7 @@ final class ExtensionAvailabilityCache { validateInitialization(); return glExtensionCount; } - + final String getGLExtensionsString() { validateInitialization(); if(DEBUG) { @@ -151,7 +151,7 @@ final class ExtensionAvailabilityCache { ", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) ); } - HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile + HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile if(useGetStringi) { GL2GL3 gl2gl3 = gl.getGL2GL3(); final int count; @@ -163,7 +163,7 @@ final class ExtensionAvailabilityCache { StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { if(i > 0) { - sb.append(" "); + sb.append(" "); } final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i); glExtensionSet.add(ext); @@ -185,7 +185,7 @@ final class ExtensionAvailabilityCache { } } } - glExtensionCount = glExtensionSet.size(); + glExtensionCount = glExtensionSet.size(); if (DEBUG) { System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL_EXTENSIONS: "+glExtensionCount+ ", used "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) ); @@ -193,17 +193,17 @@ final class ExtensionAvailabilityCache { // Platform Extensions HashSet<String> glXExtensionSet = new HashSet<String>(50); - { - // unify platform extension .. might have duplicates + { + // unify platform extension .. might have duplicates StringTokenizer tok = new StringTokenizer(context.getPlatformExtensionsStringImpl().toString()); while (tok.hasMoreTokens()) { - glXExtensionSet.add(tok.nextToken().trim()); + glXExtensionSet.add(tok.nextToken().trim()); } final StringBuilder sb = new StringBuilder(); for(Iterator<String> iter = glXExtensionSet.iterator(); iter.hasNext(); ) { sb.append(iter.next()); if(iter.hasNext()) { - sb.append(" "); + sb.append(" "); } } glXExtensions = sb.toString(); @@ -222,7 +222,7 @@ final class ExtensionAvailabilityCache { final int ctxOptions = context.getCtxOptions(); final VersionNumber version = context.getGLVersionNumber(); int major[] = new int[] { version.getMajor() }; - int minor[] = new int[] { version.getMinor() }; + int minor[] = new int[] { version.getMinor() }; while (GLContext.isValidGLVersion(ctxOptions, major[0], minor[0])) { final String GL_XX_VERSION = ( context.isGLES() ? "GL_ES_VERSION_" : "GL_VERSION_" ) + major[0] + "_" + minor[0]; availableExtensionCache.add(GL_XX_VERSION); diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java index b74ac9f41..c96f7db32 100644 --- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java +++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java @@ -41,39 +41,39 @@ public class FPSCounterImpl implements FPSCounter { private long fpsStartTime, fpsLastUpdateTime, fpsLastPeriod, fpsTotalDuration; private int fpsTotalFrames; private float fpsLast, fpsTotal; - + /** Creates a disabled instance */ public FPSCounterImpl() { setUpdateFPSFrames(0, null); } - + /** * Increases total frame count and updates values if feature is enabled and * update interval is reached.<br> - * + * * Shall be called by actual FPSCounter implementing renderer, after display a new frame. - * + * */ public final synchronized void tickFPS() { fpsTotalFrames++; if(fpsUpdateFramesInterval>0 && fpsTotalFrames%fpsUpdateFramesInterval == 0) { final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); fpsLastPeriod = now - fpsLastUpdateTime; - fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0 - fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ; - + fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0 + fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ; + fpsTotalDuration = now - fpsStartTime; fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0 fpsTotal= ( (float)fpsTotalFrames * 1000f ) / ( (float) fpsTotalDuration ) ; - + if(null != fpsOutputStream) { fpsOutputStream.println(toString()); } - + fpsLastUpdateTime = now; } } - + public StringBuilder toString(StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); @@ -81,22 +81,22 @@ public class FPSCounterImpl implements FPSCounter { String fpsLastS = String.valueOf(fpsLast); fpsLastS = fpsLastS.substring(0, fpsLastS.indexOf('.') + 2); String fpsTotalS = String.valueOf(fpsTotal); - fpsTotalS = fpsTotalS.substring(0, fpsTotalS.indexOf('.') + 2); + fpsTotalS = fpsTotalS.substring(0, fpsTotalS.indexOf('.') + 2); sb.append(fpsTotalDuration/1000 +" s: "+ fpsUpdateFramesInterval+" f / "+ fpsLastPeriod+" ms, " + fpsLastS+" fps, "+ fpsLastPeriod/fpsUpdateFramesInterval+" ms/f; "+ "total: "+ fpsTotalFrames+" f, "+ fpsTotalS+ " fps, "+ fpsTotalDuration/fpsTotalFrames+" ms/f"); return sb; } - + public String toString() { return toString(null).toString(); } - + public final synchronized void setUpdateFPSFrames(int frames, PrintStream out) { fpsUpdateFramesInterval = frames; fpsOutputStream = out; resetFPSCounter(); } - + public final synchronized void resetFPSCounter() { fpsStartTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); // overwrite startTime to real init one fpsLastUpdateTime = fpsStartTime; @@ -109,9 +109,9 @@ public class FPSCounterImpl implements FPSCounter { public final synchronized int getUpdateFPSFrames() { return fpsUpdateFramesInterval; } - - public final synchronized long getFPSStartTime() { - return fpsStartTime; + + public final synchronized long getFPSStartTime() { + return fpsStartTime; } public final synchronized long getLastFPSUpdateTime() { @@ -121,20 +121,20 @@ public class FPSCounterImpl implements FPSCounter { public final synchronized long getLastFPSPeriod() { return fpsLastPeriod; } - + public final synchronized float getLastFPS() { return fpsLast; } - - public final synchronized int getTotalFPSFrames() { - return fpsTotalFrames; + + public final synchronized int getTotalFPSFrames() { + return fpsTotalFrames; } - public final synchronized long getTotalFPSDuration() { - return fpsTotalDuration; + public final synchronized long getTotalFPSDuration() { + return fpsTotalDuration; } - + public final synchronized float getTotalFPS() { return fpsTotal; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index f8b453555..bb2983399 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import java.io.PrintStream; @@ -56,7 +56,7 @@ import com.jogamp.opengl.GLStateKeeper; /** * Abstract common code for GLAutoDrawable implementations. - * + * * @see GLAutoDrawable * @see GLAutoDrawableDelegate * @see GLPBufferImpl @@ -64,10 +64,10 @@ import com.jogamp.opengl.GLStateKeeper; */ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeeper, FPSCounter { public static final boolean DEBUG = GLDrawableImpl.DEBUG; - + protected final GLDrawableHelper helper = new GLDrawableHelper(); protected final FPSCounterImpl fpsCounter = new FPSCounterImpl(); - + protected volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access protected GLContextImpl context; protected boolean preserveGLELSAtDestroy; @@ -79,9 +79,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe protected volatile boolean sendDestroy = false; // volatile: maybe written by WindowManager thread w/o locking /** - * @param drawable upstream {@link GLDrawableImpl} instance, + * @param drawable upstream {@link GLDrawableImpl} instance, * may be <code>null</code> for lazy initialization - * @param context upstream {@link GLContextImpl} instance, + * @param context upstream {@link GLContextImpl} instance, * may not have been made current (created) yet, * may not be associated w/ <code>drawable<code> yet, * may be <code>null</code> for lazy initialization @@ -100,19 +100,19 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe if(null != context && null != drawable) { context.setGLDrawable(drawable, false); } - resetFPSCounter(); + resetFPSCounter(); } - - /** Returns the recursive lock object of the upstream implementation, which synchronizes multithreaded access on top of {@link NativeSurface#lockSurface()}. */ + + /** Returns the recursive lock object of the upstream implementation, which synchronizes multithreaded access on top of {@link NativeSurface#lockSurface()}. */ protected abstract RecursiveLock getLock(); @Override public final GLStateKeeper.Listener setGLStateKeeperListener(Listener l) { final GLStateKeeper.Listener pre = glStateKeeperListener; glStateKeeperListener = l; - return pre; + return pre; } - + @Override public final boolean preserveGLStateAtDestroy(boolean value) { final boolean res = isGLStatePreservationSupported() ? true : false; @@ -125,10 +125,10 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } return res; } - + @Override public boolean isGLStatePreservationSupported() { return false; } - + @Override public final GLEventListenerState getPreservedGLState() { return glels; @@ -140,20 +140,20 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe glels = null; return r; } - + /** * Pulls the {@link GLEventListenerState} from this {@link GLAutoDrawable}. - * + * * @return <code>true</code> if the {@link GLEventListenerState} is pulled successfully from this {@link GLAutoDrawable}, * otherwise <code>false</code>. - * + * * @throws IllegalStateException if the {@link GLEventListenerState} is already pulled - * + * * @see #pushGLEventListenerState() */ protected final boolean pullGLEventListenerState() throws IllegalStateException { if( null != glels ) { - throw new IllegalStateException("GLEventListenerState already pulled"); + throw new IllegalStateException("GLEventListenerState already pulled"); } if( null != context && context.isCreated() ) { if( null!= glStateKeeperListener) { @@ -164,14 +164,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } return false; } - + /** * Pushes a previously {@link #pullGLEventListenerState() pulled} {@link GLEventListenerState} to this {@link GLAutoDrawable}. - * - * @return <code>true</code> if the {@link GLEventListenerState} was previously {@link #pullGLEventListenerState() pulled} + * + * @return <code>true</code> if the {@link GLEventListenerState} was previously {@link #pullGLEventListenerState() pulled} * and is pushed successfully to this {@link GLAutoDrawable}, * otherwise <code>false</code>. - * + * * @see #pullGLEventListenerState() */ protected final boolean pushGLEventListenerState() { @@ -180,12 +180,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe glels = null; if( null!= glStateKeeperListener) { glStateKeeperListener.glStateRestored(this); - } + } return true; } - return false; + return false; } - + /** Default implementation to handle repaint events from the windowing system */ protected final void defaultWindowRepaintOp() { final GLDrawable _drawable = drawable; @@ -195,7 +195,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } } } - + /** Default implementation to handle resize events from the windowing system. All required locks are being claimed. */ protected final void defaultWindowResizedOp(int newWidth, int newHeight) throws NativeWindowException, GLException { GLDrawableImpl _drawable = drawable; @@ -210,7 +210,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe try { final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, newWidth, newHeight); if(_drawable != _drawableNew) { - // write back + // write back _drawable = _drawableNew; drawable = _drawableNew; } @@ -226,15 +226,15 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } } } - - /** + + /** * Default implementation to handle destroy notifications from the windowing system. - * + * * <p> - * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol} + * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol} * or {@link WindowClosingMode#DISPOSE_ON_CLOSE} is enabled (default), * a thread safe destruction is being induced. - * </p> + * </p> */ protected final void defaultWindowDestroyNotifyOp() { final NativeSurface ns = getNativeSurface(); @@ -243,22 +243,22 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe shallClose = WindowClosingMode.DISPOSE_ON_CLOSE == ((WindowClosingProtocol)ns).getDefaultCloseOperation(); } else { shallClose = true; - } + } if( shallClose ) { destroyAvoidAwareOfLocking(); - } + } } /** - * Calls {@link #destroy()} + * Calls {@link #destroy()} * directly if the following requirements are met: * <ul> - * <li>An {@link GLAnimatorControl} is bound (see {@link #getAnimator()}) and running on another thread. + * <li>An {@link GLAnimatorControl} is bound (see {@link #getAnimator()}) and running on another thread. * Here we pause the animation while issuing the destruction.</li> * <li>Surface is not locked by another thread (considered anonymous).</li> * </ul> * <p> - * Otherwise destroy is being flagged to be called within the next + * Otherwise destroy is being flagged to be called within the next * call of display(). * </p> * <p> @@ -270,9 +270,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe */ protected final void destroyAvoidAwareOfLocking() { final NativeSurface ns = getNativeSurface(); - + final GLAnimatorControl ctrl = helper.getAnimator(); - + // Is an animator thread perform rendering? if ( helper.isAnimatorStartedOnOtherThread() ) { // Pause animations before initiating safe destroy. @@ -292,7 +292,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe destroy(); } } - + /** * Calls {@link #destroyImplInLock()} while claiming the lock. */ @@ -305,7 +305,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe lock.unlock(); } } - + /** * Default implementation to destroys the drawable and context of this GLAutoDrawable: * <ul> @@ -323,7 +323,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe pullGLEventListenerState(); } if( null != context ) { - if( context.isCreated() ) { + if( context.isCreated() ) { // Catch dispose GLExceptions by GLEventListener, just 'print' them // so we can continue with the destruction. try { @@ -341,9 +341,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe if( ownsDevice ) { device.close(); } - } + } } - + public final void defaultSwapBuffers() throws GLException { final RecursiveLock _lock = getLock(); _lock.lock(); @@ -359,7 +359,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // // GLAutoDrawable // - + protected final Runnable defaultInitAction = new Runnable() { @Override public final void run() { @@ -397,7 +397,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe _lock.unlock(); } } - + protected final GLEventListener defaultDisposeGLEventListener(GLEventListener listener, boolean remove) { final RecursiveLock _lock = getLock(); _lock.lock(); @@ -405,14 +405,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe return helper.disposeGLEventListener(GLAutoDrawableBase.this, drawable, context, listener, remove); } finally { _lock.unlock(); - } + } } - + @Override public final GLDrawable getDelegatedDrawable() { return drawable; } - + @Override public final GLContext getContext() { return context; @@ -458,7 +458,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe @Override public final void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException { - helper.addGLEventListener(index, listener); + helper.addGLEventListener(index, listener); } @Override @@ -480,21 +480,21 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } - + @Override public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { return defaultDisposeGLEventListener(listener, remove); } - + @Override public final GLEventListener removeGLEventListener(GLEventListener listener) { - return helper.removeGLEventListener(listener); + return helper.removeGLEventListener(listener); } - + @Override public final void setAnimator(GLAnimatorControl animatorControl) throws GLException { - helper.setAnimator(animatorControl); + helper.setAnimator(animatorControl); } @Override @@ -511,20 +511,20 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe public final Thread getExclusiveContextThread() { return helper.getExclusiveContextThread(); } - + @Override public final boolean invoke(boolean wait, GLRunnable glRunnable) { - return helper.invoke(this, wait, glRunnable); + return helper.invoke(this, wait, glRunnable); } @Override public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) { return helper.invoke(this, wait, glRunnables); } - + @Override public final void setAutoSwapBufferMode(boolean enable) { - helper.setAutoSwapBufferMode(enable); + helper.setAutoSwapBufferMode(enable); } @Override @@ -534,7 +534,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe @Override public final void setContextCreationFlags(int flags) { - additionalCtxCreationFlags = flags; + additionalCtxCreationFlags = flags; final GLContext _context = context; if(null != _context) { _context.setContextCreationFlags(additionalCtxCreationFlags); @@ -549,7 +549,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // // FPSCounter // - + @Override public final void setUpdateFPSFrames(int frames, PrintStream out) { fpsCounter.setUpdateFPSFrames(frames, out); @@ -599,11 +599,11 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe public final float getTotalFPS() { return fpsCounter.getTotalFPS(); } - + // // GLDrawable delegation // - + @Override public final GLContext createContext(final GLContext shareWith) { final RecursiveLock lock = getLock(); @@ -624,10 +624,10 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe public final void setRealized(boolean realized) { final RecursiveLock _lock = getLock(); _lock.lock(); - try { + try { final GLDrawable _drawable = drawable; if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) { - return; + return; } _drawable.setRealized(realized); if( realized && _drawable.isRealized() ) { @@ -637,7 +637,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe _lock.unlock(); } } - + @Override public final boolean isRealized() { final GLDrawable _drawable = drawable; @@ -661,7 +661,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.isGLOriented() : true; } - + @Override public final GLCapabilitiesImmutable getChosenGLCapabilities() { final GLDrawable _drawable = drawable; @@ -685,7 +685,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.getHandle() : 0; } - + protected static String getThreadName() { return Thread.currentThread().getName(); } @Override diff --git a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java index 17646cc7b..73a864304 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -93,7 +93,7 @@ public class GLBufferSizeTracker { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferSizeTracker", true); } - + // Map from buffer names to sizes. // Note: should probably have some way of shrinking this map, but // can't just make it a WeakHashMap because nobody holds on to the @@ -102,7 +102,7 @@ public class GLBufferSizeTracker { // pattern of buffer objects indicates that the fact that this map // never shrinks is probably not that bad. private IntLongHashMap bufferSizeMap; - + public GLBufferSizeTracker() { bufferSizeMap = new IntLongHashMap(); bufferSizeMap.setKeyNotFoundValue(0xFFFFFFFFFFFFFFFFL); diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index f14d16ec4..cd9eea287 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -50,7 +50,7 @@ import com.jogamp.common.util.IntIntHashMap; * This class is used to verify that e.g. the vertex * buffer object extension is in use when the glVertexPointer variant * taking a long as argument is called. <P> - * + * * Note that because the enumerated value used for the binding of a * buffer object (e.g. GL_ARRAY_BUFFER) is different than that used to * query the binding using glGetIntegerv (e.g. @@ -77,16 +77,16 @@ import com.jogamp.common.util.IntIntHashMap; public class GLBufferStateTracker { protected static final boolean DEBUG; - + static { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferStateTracker", true); } - + // Maps binding targets to buffer objects. A null value indicates // that the binding is unknown. A zero value indicates that it is - // known that no buffer is bound to the target, according to the - // OpenGL specifications. + // known that no buffer is bound to the target, according to the + // OpenGL specifications. // http://www.opengl.org/sdk/docs/man/xhtml/glBindBuffer.xml private IntIntHashMap bindingMap; @@ -108,7 +108,7 @@ public class GLBufferStateTracker { public final void setBoundBufferObject(int target, int value) { bindingMap.put(target, value); if (DEBUG) { - System.err.println("GLBufferStateTracker.setBoundBufferObject() target 0x" + + System.err.println("GLBufferStateTracker.setBoundBufferObject() target 0x" + Integer.toHexString(target) + " -> mapped bound buffer 0x" + Integer.toHexString(value)); // Thread.dumpStack(); @@ -146,7 +146,7 @@ public class GLBufferStateTracker { value = 0; } if (DEBUG) { - System.err.println("GLBufferStateTracker.getBoundBufferObject() glerr[pre 0x"+Integer.toHexString(glerrPre)+", post 0x"+Integer.toHexString(glerrPost)+"], [queried value]: target 0x" + + System.err.println("GLBufferStateTracker.getBoundBufferObject() glerr[pre 0x"+Integer.toHexString(glerrPre)+", post 0x"+Integer.toHexString(glerrPost)+"], [queried value]: target 0x" + Integer.toHexString(target) + " / query 0x"+Integer.toHexString(queryTarget)+ " -> mapped bound buffer 0x" + Integer.toHexString(value)); } @@ -156,7 +156,7 @@ public class GLBufferStateTracker { return 0; } if (DEBUG) { - System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" + + System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" + Integer.toHexString(target) + " -> mapped bound buffer 0x" + Integer.toHexString(value)); } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 7f9f20a21..7c3a5922b 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -106,14 +106,14 @@ public abstract class GLContextImpl extends GLContext { private final GLStateTracker glStateTracker = new GLStateTracker(); private GLDebugMessageHandler glDebugHandler = null; private final int[] boundFBOTarget = new int[] { 0, 0 }; // { draw, read } - private int defaultVAO = 0; - + private int defaultVAO = 0; + protected GLDrawableImpl drawable; protected GLDrawableImpl drawableRead; - + private volatile boolean pixelDataEvaluated; private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType; - + protected GL gl; protected static final Object mappedContextTypeObjectLock; @@ -161,7 +161,7 @@ public abstract class GLContextImpl extends GLContext { glStateTracker.setEnabled(false); glStateTracker.clearStates(); } - + @Override protected void resetStates(boolean isInit) { if( !isInit ) { @@ -177,12 +177,12 @@ public abstract class GLContextImpl extends GLContext { glRenderer = glVendor; glRendererLowerCase = glRenderer; glVersion = glVendor; - + if (boundFBOTarget != null) { // <init> boundFBOTarget[0] = 0; // draw boundFBOTarget[1] = 0; // read } - + pixelDataEvaluated = false; super.resetStates(isInit); @@ -190,7 +190,7 @@ public abstract class GLContextImpl extends GLContext { @Override public final GLDrawable setGLReadDrawable(GLDrawable read) { - if(!isGLReadDrawableAvailable()) { + if(!isGLReadDrawableAvailable()) { throw new GLException("Setting read drawable feature not available"); } final boolean lockHeld = lock.isOwner(Thread.currentThread()); @@ -220,7 +220,7 @@ public abstract class GLContextImpl extends GLContext { final Thread currentThread = Thread.currentThread(); if( lock.isLockedByOtherThread() ) { throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName()); - } + } final boolean lockHeld = lock.isOwner(currentThread); if( lockHeld && lock.getHoldCount() > 1 ) { // would need to makeCurrent * holdCount @@ -272,7 +272,7 @@ public abstract class GLContextImpl extends GLContext { } return _gl; } - + @Override public final GL getGL() { return gl; @@ -314,7 +314,7 @@ public abstract class GLContextImpl extends GLContext { @Override public void release() throws GLException { release(false); - } + } private void release(boolean inDestruction) throws GLException { if( TRACE_SWITCH ) { System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock); @@ -332,7 +332,7 @@ public abstract class GLContextImpl extends GLContext { } throw new GLException(msg); } - + Throwable drawableContextMadeCurrentException = null; final boolean actualRelease = ( inDestruction || lock.getHoldCount() == 1 ) && 0 != contextHandle; try { @@ -365,7 +365,7 @@ public abstract class GLContextImpl extends GLContext { if(null != drawableContextMadeCurrentException) { throw new GLException("GLContext.release(false) during GLDrawableImpl.contextMadeCurrent(this, false)", drawableContextMadeCurrentException); } - + } private Throwable lastCtxReleaseStack = null; protected abstract void releaseImpl() throws GLException; @@ -518,21 +518,21 @@ public abstract class GLContextImpl extends GLContext { public final int makeCurrent() throws GLException { return makeCurrent(false); } - + protected final int makeCurrent(boolean forceDrawableAssociation) throws GLException { if( TRACE_SWITCH ) { System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - "+lock); - } + } // Note: the surface is locked within [makeCurrent .. swap .. release] final int lockRes = drawable.lockSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { if( DEBUG_TRACE_SWITCH ) { - System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+lock); + System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+lock); } return CONTEXT_NOT_CURRENT; } - + boolean unlockResources = true; // Must be cleared if successful, otherwise finally block will release context and/or surface! int res = CONTEXT_NOT_CURRENT; try { @@ -552,7 +552,7 @@ public abstract class GLContextImpl extends GLContext { drawableUpdatedNotify(); unlockResources = false; // success if( TRACE_SWITCH ) { - System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+lock); + System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+lock); } return CONTEXT_CURRENT; } else { @@ -561,7 +561,7 @@ public abstract class GLContextImpl extends GLContext { } res = makeCurrentWithinLock(lockRes); unlockResources = CONTEXT_NOT_CURRENT == res; // success ? - + /** * FIXME: refactor dependence on Java 2D / JOGL bridge if ( tracker != null && res == CONTEXT_CURRENT_NEW ) { @@ -608,16 +608,16 @@ public abstract class GLContextImpl extends GLContext { if(TRACE_GL) { gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); } - + forceDrawableAssociation = true; } - + if( forceDrawableAssociation ) { associateDrawable(true); } - + contextMadeCurrent(true); - + /* FIXME: refactor dependence on Java 2D / JOGL bridge // Try cleaning up any stale server-side OpenGL objects @@ -629,10 +629,10 @@ public abstract class GLContextImpl extends GLContext { } if( TRACE_SWITCH ) { System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+lock); - } + } return res; } - + private final int makeCurrentWithinLock(int surfaceLockRes) throws GLException { if (!isCreated()) { if( 0 >= drawable.getWidth() || 0 >= drawable.getHeight() ) { @@ -683,7 +683,7 @@ public abstract class GLContextImpl extends GLContext { final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); - // Non ARB desktop profiles may not have been registered + // Non ARB desktop profiles may not have been registered if( !GLContext.getAvailableGLVersionsSet(device) ) { // not yet set if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile final int reqMajor; @@ -701,10 +701,10 @@ public abstract class GLContextImpl extends GLContext { GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); GLContext.setAvailableGLVersionsSet(device); - + if (DEBUG) { System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " + device+" -> "+reqMajor+"."+reqProfile+ " -> "+getGLVersion()); - } + } } } } @@ -717,17 +717,17 @@ public abstract class GLContextImpl extends GLContext { protected abstract void makeCurrentImpl() throws GLException; /** - * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)} - */ - protected void associateDrawable(boolean bound) { - drawable.associateContext(this, bound); + * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)} + */ + protected void associateDrawable(boolean bound) { + drawable.associateContext(this, bound); } - + /** - * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)} - */ + * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)} + */ protected void contextMadeCurrent(boolean current) { - drawable.contextMadeCurrent(this, current); + drawable.contextMadeCurrent(this, current); } /** @@ -827,7 +827,7 @@ public abstract class GLContextImpl extends GLContext { final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int[] reqMajorCTP = new int[] { 0, 0 }; getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP); - + int _major[] = { 0 }; int _minor[] = { 0 }; int _ctp[] = { 0 }; @@ -842,7 +842,7 @@ public abstract class GLContextImpl extends GLContext { } return _ctx; } - + private final boolean mapGLVersions(AbstractGraphicsDevice device) { synchronized (GLContext.deviceVersionAvailable) { final long t0 = ( DEBUG ) ? System.nanoTime() : 0; @@ -854,7 +854,7 @@ public abstract class GLContextImpl extends GLContext { boolean hasGL4 = false; boolean hasGL3 = false; boolean hasES3 = false; - + // Even w/ PROFILE_ALIASING, try to use true core GL profiles // ensuring proper user behavior across platforms due to different feature sets! // @@ -863,7 +863,7 @@ public abstract class GLContextImpl extends GLContext { success |= hasGL4; if(hasGL4) { // Map all lower compatible profiles: GL3 - GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); + GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); if(PROFILE_ALIASING) { hasGL3 = true; } @@ -874,7 +874,7 @@ public abstract class GLContextImpl extends GLContext { hasGL3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_CORE); // GL3 success |= hasGL3; if(hasGL3) { - resetStates(false); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasGL4bc) { @@ -919,14 +919,14 @@ public abstract class GLContextImpl extends GLContext { hasGL2 = createContextARBMapVersionsAvailable(2, CTX_PROFILE_COMPAT); // GL2 success |= hasGL2; if(hasGL2) { - resetStates(false); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasES3) { hasES3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_ES); // ES3 success |= hasES3; if(hasES3) { - resetStates(false); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(success) { @@ -935,7 +935,7 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { final long t1 = System.nanoTime(); System.err.println("GLContextImpl.mapGLVersions: "+device+", profileAliasing: "+PROFILE_ALIASING+", total "+(t1-t0)/1e6 +"ms"); - System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); + System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); } } else if (DEBUG) { System.err.println(getThreadName() + ": createContextARB-MapVersions NONE for :"+device); @@ -944,9 +944,9 @@ public abstract class GLContextImpl extends GLContext { } } - /** + /** * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true. - * This method does not reset the states, allowing the caller to utilize the state variables. + * This method does not reset the states, allowing the caller to utilize the state variables. **/ private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) { long _context; @@ -1059,7 +1059,7 @@ public abstract class GLContextImpl extends GLContext { if ( 0 == ctp ) { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } - + if (!GLContext.isValidGLVersion(ctp, major, minor)) { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } @@ -1080,10 +1080,10 @@ public abstract class GLContextImpl extends GLContext { if( ctxGLSLVersion.isZero() ) { ctxGLSLVersion = getStaticGLSLVersionNumber(major, minor, ctxOptions); } - } + } } } - + //---------------------------------------------------------------------- // Helpers for various context implementations // @@ -1107,8 +1107,8 @@ public abstract class GLContextImpl extends GLContext { */ return gl; } - - /** + + /** * Finalizes GL instance initialization after this context has been initialized. * <p> * Method calls 'void finalizeInit()' of instance 'gl' as retrieved by reflection, if exist. @@ -1138,7 +1138,7 @@ public abstract class GLContextImpl extends GLContext { * ie for GLXExt, EGLExt, .. */ public abstract ProcAddressTable getPlatformExtProcAddressTable(); - + /** * Part of <code>GL_NV_vertex_array_range</code>. * <p> @@ -1154,7 +1154,7 @@ public abstract class GLContextImpl extends GLContext { * Provides platform-independent access to the <code>wglFreeMemoryNV</code> / * <code>glXFreeMemoryNV</code>. * </p> - */ + */ public abstract void glFreeMemoryNV(ByteBuffer pointer); /** Maps the given "platform-independent" function name to a real function @@ -1195,7 +1195,7 @@ public abstract class GLContextImpl extends GLContext { } } ); } - + private final boolean initGLRendererAndGLVersionStrings() { final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString"); @@ -1215,7 +1215,7 @@ public abstract class GLContextImpl extends GLContext { return false; } glVendor = _glVendor; - + final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString); if(null == _glRenderer) { if(DEBUG) { @@ -1226,7 +1226,7 @@ public abstract class GLContextImpl extends GLContext { } glRenderer = _glRenderer; glRendererLowerCase = glRenderer.toLowerCase(); - + final String _glVersion = glGetStringInt(GL.GL_VERSION, _glGetString); if(null == _glVersion) { // FIXME @@ -1237,7 +1237,7 @@ public abstract class GLContextImpl extends GLContext { return false; } glVersion = _glVersion; - + return true; } } @@ -1251,7 +1251,7 @@ public abstract class GLContextImpl extends GLContext { minor[0] = 0; } } - + /** * Returns null if version string is invalid, otherwise a valid instance. * <p> @@ -1278,7 +1278,7 @@ public abstract class GLContextImpl extends GLContext { * version for given arrays. * <p> * If the GL query fails, major will be zero. - * </p> + * </p> * <p> * Note: Non ARB ctx is limited to GL 3.0. * </p> @@ -1292,20 +1292,20 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { Thread.dumpStack(); } - return false; + return false; } else { glGetIntegervInt(GL2GL3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); glGetIntegervInt(GL2GL3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); limitNonARBContextVersion(glIntMajor, glIntMinor, ctp); - return true; + return true; } } - + protected final int getCtxOptions() { return ctxOptions; } - + /** * Sets the OpenGL implementation class and * the cache of which GL functions are available for calling through this @@ -1325,8 +1325,8 @@ public abstract class GLContextImpl extends GLContext { * <li>be greater or equal than the requested <code>major.minor</code> version, and</li> * <li>match the ctxProfileBits</li> * </ul>, otherwise method aborts and returns <code>false</code>. - * @return returns <code>true</code> if successful, otherwise <code>false</code>. See <code>strictMatch</code>. - * If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc. + * @return returns <code>true</code> if successful, otherwise <code>false</code>. See <code>strictMatch</code>. + * If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc. * @see #setContextVersion * @see javax.media.opengl.GLContext#CTX_OPTION_ANY * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT @@ -1340,7 +1340,7 @@ public abstract class GLContextImpl extends GLContext { if ( 0 < major && !GLContext.isValidGLVersion(ctxProfileBits, major, minor) ) { throw new GLException("Invalid GL Version Request "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)); } - + if(null==this.gl || !verifyInstance(gl.getGLProfile(), "Impl", this.gl)) { setGL( createGL( getGLDrawable().getGLProfile() ) ); } @@ -1348,7 +1348,7 @@ public abstract class GLContextImpl extends GLContext { final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); - + { final boolean initGLRendererAndGLVersionStringsOK = initGLRendererAndGLVersionStrings(); if( !initGLRendererAndGLVersionStringsOK ) { @@ -1367,7 +1367,7 @@ public abstract class GLContextImpl extends GLContext { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Given "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)); } } - + // // Validate GL version either by GL-Integer or GL-String // @@ -1377,8 +1377,8 @@ public abstract class GLContextImpl extends GLContext { boolean versionValidated = false; boolean versionGL3IntFailed = false; { - // Validate the requested version w/ the GL-version from an integer query. - final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 }; + // Validate the requested version w/ the GL-version from an integer query. + final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 }; final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor, ctxProfileBits); if( !getGLIntVersionOK ) { final String errMsg = "Fetching GL Integer Version failed. "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null); @@ -1392,14 +1392,14 @@ public abstract class GLContextImpl extends GLContext { // unusable GL context - non query mode - hard fail! throw new GLException(errMsg); } - } + } if (DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: version verification (Int): "+glVersion+", "+glIntMajor[0]+"."+glIntMinor[0]); } - + // Only validate if a valid int version was fetched, otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX! if ( GLContext.isValidGLVersion(ctxProfileBits, glIntMajor[0], glIntMinor[0]) ) { - if( glIntMajor[0]<major || ( glIntMajor[0]==major && glIntMinor[0]<minor ) || 0 == major ) { + if( glIntMajor[0]<major || ( glIntMajor[0]==major && glIntMinor[0]<minor ) || 0 == major ) { if( strictMatch && 2 < major ) { // relaxed match for versions major < 3 requests, last resort! if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (Int): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+glIntMajor[0]+"."+glIntMinor[0]); @@ -1415,13 +1415,13 @@ public abstract class GLContextImpl extends GLContext { } } if( !versionValidated ) { - // Validate the requested version w/ the GL-version from the version string. + // Validate the requested version w/ the GL-version from the version string. final VersionNumber setGLVersionNumber = new VersionNumber(major, minor, 0); final VersionNumber strGLVersionNumber = getGLVersionNumber(ctxProfileBits, glVersion); if (DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: version verification (String): "+glVersion+", "+strGLVersionNumber); } - + // Only validate if a valid string version was fetched -> MIN > Version || Version > MAX! if( null != strGLVersionNumber ) { if( strGLVersionNumber.compareTo(setGLVersionNumber) < 0 || 0 == major ) { @@ -1438,7 +1438,7 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL3 version Int failed, String: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+strGLVersionNumber); } - return false; + return false; } versionValidated = true; } @@ -1447,27 +1447,27 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, No GL version validation possible: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion); } - return false; + return false; } if (DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: post version verification "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntFailed "+versionGL3IntFailed); } - + if( 2 > major ) { // there is no ES2/3-compat for a profile w/ major < 2 ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT ) ; } - + final VersionNumberString vendorVersion = GLVersionNumber.createVendorVersion(glVersion); - + setRendererQuirks(adevice, major, minor, ctxProfileBits, vendorVersion); - + if( strictMatch && glRendererQuirks.exist(GLRendererQuirks.GLNonCompliant) ) { if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL is not compliant: "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)+", "+glRenderer); } return false; } - + if(!isCurrentContextHardwareRasterizer()) { ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT; } @@ -1529,7 +1529,7 @@ public abstract class GLContextImpl extends GLContext { } } } - + if( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) ) { if( major >= 3 ) { ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ; @@ -1550,45 +1550,45 @@ public abstract class GLContextImpl extends GLContext { } else if( hasFBOImpl(major, ctxProfileBits, extensionAvailability) ) { ctxProfileBits |= CTX_IMPL_FBO; } - + if( ( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) && major == 1 ) || isExtensionAvailable(GLExtensions.OES_single_precision) ) { ctxProfileBits |= CTX_IMPL_FP32_COMPAT_API; } - + if(FORCE_NO_FBO_SUPPORT) { ctxProfileBits &= ~CTX_IMPL_FBO ; - } - + } + // // Set GL Version (complete w/ version string) // setContextVersion(major, minor, ctxProfileBits, vendorVersion, true); - + finalizeInit(gl); - + setDefaultSwapInterval(); - + final int glErrX = gl.glGetError(); // clear GL error, maybe caused by above operations - + if(DEBUG) { System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: OK "+contextFQN+" - "+GLContext.getGLVersion(ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions, null)+" - glErr "+toHexString(glErrX)); } return true; } - + private final void setRendererQuirks(final AbstractGraphicsDevice adevice, int major, int minor, int ctp, final VersionNumberString vendorVersion) { int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) int i = 0; - + final String MesaSP = "Mesa "; - // final String MesaRendererAMDsp = " AMD "; - // final String MesaRendererIntelsp = "Intel(R)"; + // final String MesaRendererAMDsp = " AMD "; + // final String MesaRendererIntelsp = "Intel(R)"; final boolean hwAccel = 0 == ( ctp & GLContext.CTX_IMPL_ACCEL_SOFT ); final boolean compatCtx = 0 != ( ctp & GLContext.CTX_PROFILE_COMPAT ); final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium "); final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") ); final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") ); - + // // OS related quirks // @@ -1603,7 +1603,7 @@ public abstract class GLContextImpl extends GLContext { } quirks[i++] = quirk; } - + if( isDriverNVIDIAGeForce ) { final VersionNumber osxVersionNVFlushClean = new VersionNumber(10,7,3); // < OSX 10.7.3 w/ NV needs glFlush if( Platform.getOSVersionNumber().compareTo(osxVersionNVFlushClean) < 0 ) { @@ -1622,7 +1622,7 @@ public abstract class GLContextImpl extends GLContext { quirks[i++] = quirk; } } - } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) { + } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) { // // WINDOWS // @@ -1633,28 +1633,28 @@ public abstract class GLContextImpl extends GLContext { } quirks[i++] = quirk; } - + if( isDriverATICatalyst ) { - final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0); - final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3); - + final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0); + final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3); + if ( vendorVersion.compareTo(amdSafeMobilityVersion) < 0 ) { // includes: vendorVersion.isZero() final int quirk = GLRendererQuirks.NeedCurrCtx4ARBCreateContext; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"], driverVersion "+vendorVersion); } - quirks[i++] = quirk; + quirks[i++] = quirk; } - + if( Platform.getOSVersionNumber().compareTo(winXPVersionNumber) <= 0 ) { final int quirk = GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS-Version "+Platform.getOSType()+" "+Platform.getOSVersionNumber()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"]"); } - quirks[i++] = quirk; + quirks[i++] = quirk; } } - } else if( Platform.OSType.ANDROID == Platform.getOSType() ) { + } else if( Platform.OSType.ANDROID == Platform.getOSType() ) { // // ANDROID // @@ -1667,7 +1667,7 @@ public abstract class GLContextImpl extends GLContext { quirks[i++] = quirk; } } - + // // Windowing Toolkit related quirks // @@ -1704,8 +1704,8 @@ public abstract class GLContextImpl extends GLContext { } } } - - + + // // RENDERER related quirks // @@ -1735,8 +1735,8 @@ public abstract class GLContextImpl extends GLContext { } if( Platform.getOSType() == Platform.OSType.WINDOWS && glRenderer.contains("SVGA3D") ) { - final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0); - if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero() + final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0); + if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero() final int quirk = GLRendererQuirks.NoFullFBOSupport; if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion); @@ -1745,7 +1745,7 @@ public abstract class GLContextImpl extends GLContext { } } } - + // // Property related quirks // @@ -1754,28 +1754,28 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: property"); } - quirks[i++] = quirk; + quirks[i++] = quirk; } - + glRendererQuirks = new GLRendererQuirks(quirks, 0, i); } - + private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) { return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0 - - major >= 3 || // any >= 3.0 GL ctx - + + major >= 3 || // any >= 3.0 GL ctx + ( null != extCache && - + extCache.isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) || // ES 2.0 compatible - + extCache.isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object - + extCache.isExtensionAvailable(GLExtensions.EXT_framebuffer_object) || // EXT_framebuffer_object - - extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded + + extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded } - + private final void removeCachedVersion(int major, int minor, int ctxProfileBits) { if(!isCurrentContextHardwareRasterizer()) { ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT; @@ -1932,7 +1932,7 @@ public abstract class GLContextImpl extends GLContext { evalPixelDataType(); return pixelDataFormat; } - + private final void evalPixelDataType() { if(!pixelDataEvaluated) { synchronized(this) { @@ -1946,14 +1946,14 @@ public abstract class GLContextImpl extends GLContext { } else */ if( isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format) ) { final int[] glImplColorReadVals = new int[] { 0, 0 }; gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_FORMAT, glImplColorReadVals, 0); - gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1); + gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1); // pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB; pixelDataFormat = glImplColorReadVals[0]; pixelDataType = glImplColorReadVals[1]; ok = 0 != pixelDataFormat && 0 != pixelDataType; } if( !ok ) { - // RGBA read is safe for all GL profiles + // RGBA read is safe for all GL profiles // pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB; pixelDataFormat=GL.GL_RGBA; pixelDataType = GL.GL_UNSIGNED_BYTE; @@ -1984,54 +1984,54 @@ public abstract class GLContextImpl extends GLContext { public final GLStateTracker getGLStateTracker() { return glStateTracker; } - + //--------------------------------------------------------------------------- // Helpers for context optimization where the last context is left // current on the OpenGL worker thread // - /** + /** * Returns true if the given thread is owner, otherwise false. * <p> * Method exists merely for code validation of {@link #isCurrent()}. - * </p> + * </p> */ public final boolean isOwner(Thread thread) { return lock.isOwner(thread); } - - /** + + /** * Returns true if there are other threads waiting for this GLContext to {@link #makeCurrent()}, otherwise false. * <p> * Since method does not perform any synchronization, accurate result are returned if lock is hold - only. - * </p> + * </p> */ public final boolean hasWaiters() { return lock.getQueueLength()>0; } - - /** + + /** * Returns the number of hold locks. See {@link RecursiveLock#getHoldCount()} for semantics. * <p> * Since method does not perform any synchronization, accurate result are returned if lock is hold - only. - * </p> + * </p> */ public final int getLockCount() { return lock.getHoldCount(); } - + //--------------------------------------------------------------------------- // Special FBO hook // - + /** * Tracks {@link GL#GL_FRAMEBUFFER}, {@link GL2GL3#GL_DRAW_FRAMEBUFFER} and {@link GL2GL3#GL_READ_FRAMEBUFFER} * to be returned via {@link #getBoundFramebuffer(int)}. - * + * * <p>Invoked by {@link GL#glBindFramebuffer(int, int)}. </p> - * - * <p>Assumes valid <code>framebufferName</code> range of [0..{@link Integer#MAX_VALUE}]</p> - * + * + * <p>Assumes valid <code>framebufferName</code> range of [0..{@link Integer#MAX_VALUE}]</p> + * * <p>Does not throw an exception if <code>target</code> is unknown or <code>framebufferName</code> invalid.</p> */ public final void setBoundFramebuffer(int target, int framebufferName) { @@ -2064,14 +2064,14 @@ public abstract class GLContextImpl extends GLContext { throw new InternalError("Invalid FBO target name: "+toHexString(target)); } } - + @Override - public final int getDefaultDrawFramebuffer() { return drawable.getDefaultDrawFramebuffer(); } + public final int getDefaultDrawFramebuffer() { return drawable.getDefaultDrawFramebuffer(); } @Override - public final int getDefaultReadFramebuffer() { return drawable.getDefaultReadFramebuffer(); } + public final int getDefaultReadFramebuffer() { return drawable.getDefaultReadFramebuffer(); } @Override public final int getDefaultReadBuffer() { return drawable.getDefaultReadBuffer(gl); } - + //--------------------------------------------------------------------------- // GL_ARB_debug_output, GL_AMD_debug_output helpers // @@ -2090,7 +2090,7 @@ public abstract class GLContextImpl extends GLContext { public final int getContextCreationFlags() { return additionalCtxCreationFlags; } - + @Override public final void setContextCreationFlags(int flags) { if(!isCreated()) { @@ -2160,7 +2160,7 @@ public abstract class GLContextImpl extends GLContext { /** Internal bootstraping glGetString(GL_RENDERER) */ private static native String glGetStringInt(int name, long procAddress); - + /** Internal bootstraping glGetIntegerv(..) for version */ private static native void glGetIntegervInt(int pname, int[] params, int params_offset, long procAddress); } diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java index b7acc0dff..70ade34b7 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java +++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2011 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -55,7 +55,7 @@ import javax.media.opengl.GLException; public class GLContextShareSet { private static final boolean DEBUG = GLContextImpl.DEBUG; - + // This class is implemented using a HashMap which maps from all shared contexts // to a share set, containing all shared contexts itself. @@ -74,17 +74,17 @@ public class GLContextShareSet { } else { destroyedShares.put(ctx, dummyValue); } - } + } } public Set<GLContext> getCreatedShares() { return createdShares.keySet(); } - + public Set<GLContext> getDestroyedShares() { return destroyedShares.keySet(); } - + public GLContext getCreatedShare(GLContext ignore) { for (Iterator<GLContext> iter = createdShares.keySet().iterator(); iter.hasNext(); ) { GLContext ctx = iter.next(); @@ -133,9 +133,9 @@ public class GLContextShareSet { addEntry(share1, share); addEntry(share2, share); if (DEBUG) { - System.err.println("GLContextShareSet: registereSharing: 1: " + + System.err.println("GLContextShareSet: registereSharing: 1: " + toHexString(share1.getHandle()) + ", 2: " + toHexString(share2.getHandle())); - } + } } public static synchronized void unregisterSharing(GLContext lastContext) { @@ -155,9 +155,9 @@ public class GLContextShareSet { throw new GLException("Last context's share set contains no destroyed context"); } if (DEBUG) { - System.err.println("GLContextShareSet: unregisterSharing: " + + System.err.println("GLContextShareSet: unregisterSharing: " + toHexString(lastContext.getHandle())+", entries: "+s.size()); - } + } for(Iterator<GLContext> iter = s.iterator() ; iter.hasNext() ; ) { GLContext ctx = iter.next(); if(null == removeEntry(ctx)) { @@ -165,7 +165,7 @@ public class GLContextShareSet { } } } - + private static synchronized Set<GLContext> getCreatedSharedImpl(GLContext context) { if (context == null) { throw new IllegalArgumentException("context is null"); @@ -174,9 +174,9 @@ public class GLContextShareSet { if (share != null) { return share.getCreatedShares(); } - return null; + return null; } - + public static synchronized boolean isShared(GLContext context) { if (context == null) { throw new IllegalArgumentException("context is null"); @@ -184,12 +184,12 @@ public class GLContextShareSet { final ShareSet share = entryFor(context); return share != null; } - + public static synchronized boolean hasCreatedSharedLeft(GLContext context) { final Set<GLContext> s = getCreatedSharedImpl(context); return null != s && s.size()>0 ; } - + /** currently not used .. public static synchronized Set<GLContext> getCreatedShared(GLContext context) { final Set<GLContext> s = getCreatedSharedImpl(context); @@ -198,7 +198,7 @@ public class GLContextShareSet { } return s; } - + public static synchronized Set<GLContext> getDestroyedShared(GLContext context) { if (context == null) { throw new IllegalArgumentException("context is null"); @@ -209,7 +209,7 @@ public class GLContextShareSet { } return share.getDestroyedShares(); } */ - + public static synchronized GLContext getShareContext(GLContext contextToCreate) { ShareSet share = entryFor(contextToCreate); if (share == null) { @@ -262,7 +262,7 @@ public class GLContextShareSet { //---------------------------------------------------------------------- // Internals only below this point - + private static ShareSet entryFor(GLContext context) { return (ShareSet) shareMap.get(context); @@ -276,8 +276,8 @@ public class GLContextShareSet { private static ShareSet removeEntry(GLContext context) { return (ShareSet) shareMap.remove(context); } - + protected static String toHexString(long hex) { return "0x" + Long.toHexString(hex); - } + } } diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 9ecaca75d..b770f3b05 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -44,57 +44,57 @@ import com.jogamp.opengl.GLExtensions; /** * The GLDebugMessageHandler, handling <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i> * debug messages.<br> - * + * * <p>An instance must be bound to the current thread's GLContext to achieve thread safety.</p> - * - * <p>A native callback function is registered at {@link #enable(boolean) enable(true)}, - * which forwards received messages to the added {@link GLDebugListener} directly. + * + * <p>A native callback function is registered at {@link #enable(boolean) enable(true)}, + * which forwards received messages to the added {@link GLDebugListener} directly. * Hence the {@link GLDebugListener#messageSent(GLDebugMessage)} implementation shall * return as fast as possible.</p> - * + * * <p>In case no <i>GL_ARB_debug_output</i> is available, but <i>GL_AMD_debug_output</i>, * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(javax.media.opengl.GLContext, long, int, int, int, String)}.</p> */ public class GLDebugMessageHandler { private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler"); - + private static final int EXT_ARB = 1; - private static final int EXT_AMD = 2; - + private static final int EXT_AMD = 2; + static { if ( !initIDs0() ) { throw new NativeWindowException("Failed to initialize GLDebugMessageHandler jmethodIDs"); - } + } } - - private final GLContextImpl ctx; + + private final GLContextImpl ctx; private final ListenerSyncedImplStub<GLDebugListener> listenerImpl; - + // licefycle: init - EOL private String extName; private int extType; private long glDebugMessageCallbackProcAddress; - private boolean extAvailable; + private boolean extAvailable; private boolean synchronous; - + // licefycle: enable - disable/EOL private long handle; - + /** * @param ctx the associated GLContext * @param glDebugExtension chosen extension to use */ - public GLDebugMessageHandler(GLContextImpl ctx) { + public GLDebugMessageHandler(GLContextImpl ctx) { this.ctx = ctx; - this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>(); + this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>(); this.glDebugMessageCallbackProcAddress = 0; this.extName = null; this.extType = 0; - this.extAvailable = false; + this.extAvailable = false; this.handle = 0; this.synchronous = true; } - + public void init(boolean enable) { if(DEBUG) { System.err.println("GLDebugMessageHandler.init("+enable+")"); @@ -106,13 +106,13 @@ public class GLDebugMessageHandler { System.err.println("GLDebugMessageHandler.init("+enable+") .. n/a"); } } - + private final long getAddressFor(final ProcAddressTable table, final String functionName) { return AccessController.doPrivileged(new PrivilegedAction<Long>() { public Long run() { try { return Long.valueOf( table.getAddressFor(functionName) ); - } catch (IllegalArgumentException iae) { + } catch (IllegalArgumentException iae) { return Long.valueOf(0); } } @@ -124,12 +124,12 @@ public class GLDebugMessageHandler { if( isAvailable()) { return; } - + if( !ctx.isGLDebugEnabled() ) { if(DEBUG) { System.err.println("GLDebugMessageHandler: GL DEBUG not set in ARB ctx options: "+ctx.getGLVersion()); } - return; + return; } if(Platform.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) { // Currently buggy, ie. throws an exception after leaving the native callback. @@ -149,93 +149,93 @@ public class GLDebugMessageHandler { if(DEBUG) { System.err.println("GLDebugMessageHandler: Using extension: <"+extName+">"); } - + if(0 == extType) { if(DEBUG) { System.err.println("GLDebugMessageHandler: No extension available! "+ctx.getGLVersion()); System.err.println("GL_EXTENSIONS "+ctx.getGLExtensionCount()); - System.err.println(ctx.getGLExtensionsString()); + System.err.println(ctx.getGLExtensionsString()); } return; } - + final ProcAddressTable procAddressTable = ctx.getGLProcAddressTable(); if( !ctx.isGLES1() && !ctx.isGLES2() ) { switch(extType) { - case EXT_ARB: + case EXT_ARB: glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackARB"); break; - case EXT_AMD: + case EXT_AMD: glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackAMD"); break; } } else { glDebugMessageCallbackProcAddress = 0; if(DEBUG) { - System.err.println("Non desktop context not supported"); - } + System.err.println("Non desktop context not supported"); + } } extAvailable = 0 < extType && null != extName && 0 != glDebugMessageCallbackProcAddress; - + if(DEBUG) { System.err.println("GLDebugMessageHandler: extAvailable: "+extAvailable+", glDebugMessageCallback* : 0x"+Long.toHexString(glDebugMessageCallbackProcAddress)); } - + if(!extAvailable) { glDebugMessageCallbackProcAddress = 0; } - + handle = 0; } public final boolean isAvailable() { return extAvailable; } - + /** - * @return The extension implementing the GLDebugMessage feature, - * either {@link #GL_ARB_debug_output} or {@link #GL_AMD_debug_output}. - * If unavailable <i>null</i> is returned. + * @return The extension implementing the GLDebugMessage feature, + * either {@link #GL_ARB_debug_output} or {@link #GL_AMD_debug_output}. + * If unavailable <i>null</i> is returned. */ public final String getExtension() { return extName; } - + public final boolean isExtensionARB() { return extName == GLExtensions.ARB_debug_output; } - + public final boolean isExtensionAMD() { return extName == GLExtensions.AMD_debug_output; } - + /** - * @see javax.media.opengl.GLContext#isGLDebugSynchronous() + * @see javax.media.opengl.GLContext#isGLDebugSynchronous() */ public final boolean isSynchronous() { return synchronous; } - + /** - * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean) + * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean) */ public final void setSynchronous(boolean synchronous) { this.synchronous = synchronous; if( isEnabled() ) { setSynchronousImpl(); } - } + } private final void setSynchronousImpl() { if(isExtensionARB()) { if(synchronous) { ctx.getGL().glEnable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { ctx.getGL().glDisable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); - } + } if(DEBUG) { System.err.println("GLDebugMessageHandler: synchronous "+synchronous); } } } - + /** - * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean) + * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean) */ public final void enable(boolean enable) throws GLException { ctx.validateCurrent(); @@ -243,7 +243,7 @@ public class GLDebugMessageHandler { return; } enableImpl(enable); - } + } final void enableImpl(boolean enable) throws GLException { if(enable) { if(0 == handle) { @@ -257,19 +257,19 @@ public class GLDebugMessageHandler { if(0 != handle) { unregister0(glDebugMessageCallbackProcAddress, handle); handle = 0; - } + } } if(DEBUG) { System.err.println("GLDebugMessageHandler: enable("+enable+") -> 0x" + Long.toHexString(handle)); } } - + public final boolean isEnabled() { return 0 != handle; } - public final int listenerSize() { - return listenerImpl.size(); + public final int listenerSize() { + return listenerImpl.size(); } - + public final void addListener(GLDebugListener listener) { listenerImpl.addListener(-1, listener); } @@ -277,11 +277,11 @@ public class GLDebugMessageHandler { public final void addListener(int index, GLDebugListener listener) { listenerImpl.addListener(index, listener); } - + public final void removeListener(GLDebugListener listener) { listenerImpl.removeListener(listener); } - + private final void sendMessage(GLDebugMessage msg) { synchronized(listenerImpl) { if(DEBUG) { @@ -293,10 +293,10 @@ public class GLDebugMessageHandler { } } } - + public static class StdErrGLDebugListener implements GLDebugListener { boolean threadDump; - + public StdErrGLDebugListener(boolean threadDump) { this.threadDump = threadDump; } @@ -305,13 +305,13 @@ public class GLDebugMessageHandler { if(threadDump) { Thread.dumpStack(); } - } + } } - + // // native -> java // - + protected final void glDebugMessageARB(int source, int type, int id, int severity, String msg) { final GLDebugMessage event = new GLDebugMessage(ctx, System.currentTimeMillis(), source, type, id, severity, msg); sendMessage(event); @@ -321,11 +321,11 @@ public class GLDebugMessageHandler { final GLDebugMessage event = GLDebugMessage.translateAMDEvent(ctx, System.currentTimeMillis(), id, category, severity, msg); sendMessage(event); } - + // // java -> native - // - + // + private static native boolean initIDs0(); private native long register0(long glDebugMessageCallbackProcAddress, int extType); private native void unregister0(long glDebugMessageCallbackProcAddress, long handle); diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index f5ceb8058..1e4cb38fa 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -95,14 +95,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } } catch (GLException gle) { if(DEBUG) { - System.err.println("Catched Exception on thread "+getThreadName()); + System.err.println("Catched Exception on thread "+getThreadName()); gle.printStackTrace(); } } return null; } protected abstract SharedResourceRunner.Resource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device); - + /** * Returns the shared context mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, * either a pre-existing or newly created, or <code>null</code> if creation failed or <b>not supported</b>.<br> @@ -176,7 +176,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(target, true); if(null != ols) { final GLCapabilitiesImmutable chosenCapsMod = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(chosenCaps, this, adevice); - + // layered surface -> Offscreen/[FBO|PBuffer] if( !chosenCapsMod.isFBO() && !chosenCapsMod.isPBuffer() ) { throw new GLException("Neither FBO nor Pbuffer is available for "+chosenCapsMod+", "+target); @@ -193,10 +193,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } if( ! ( target instanceof MutableSurface ) ) { throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target); - } + } if( chosenCapsMod.isFBO() ) { result = createFBODrawableImpl(target, chosenCapsMod, 0); - } else { + } else { result = createOffscreenDrawableImpl(target); } } else if(chosenCaps.isOnscreen()) { @@ -217,7 +217,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { throw new IllegalArgumentException("Passed NativeSurface must implement MutableSurface for offscreen: "+target); } if( chosenCaps.isFBO() && isFBOAvailable ) { - // need to hook-up a native dummy surface since source may not have & use minimum GLCapabilities for it w/ same profile + // need to hook-up a native dummy surface since source may not have & use minimum GLCapabilities for it w/ same profile final ProxySurface dummySurface = createDummySurfaceImpl(adevice, false, new GLCapabilities(chosenCaps.getGLProfile()), (GLCapabilitiesImmutable)config.getRequestedCapabilities(), null, 64, 64); dummySurface.setUpstreamSurfaceHook(new DelegatedUpstreamSurfaceHookWithSurfaceSize(dummySurface.getUpstreamSurfaceHook(), target)); result = createFBODrawableImpl(dummySurface, chosenCaps, 0); @@ -245,7 +245,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // // PBuffer Offscreen GLAutoDrawable construction // - + @Override public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp); @@ -271,7 +271,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { GLDrawableImpl drawable = null; device.lock(); try { - drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, + drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, new UpstreamSurfaceHookMutableSize(width, height) ) ); if(null != drawable) { drawable.setRealized(true); @@ -294,9 +294,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } - return GLContext.isFBOAvailable(device, glp); + return GLContext.isFBOAvailable(device, glp); } - + @Override public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable capsRequested, @@ -311,7 +311,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } return new GLOffscreenAutoDrawableImpl( drawable, context, null, null); } - + @Override public final GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable capsRequested, @@ -324,18 +324,18 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } - + final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device); device.lock(); try { if( capsChosen.isFBO() ) { - // Use minimum GLCapabilities for the dummy surface w/ same profile + // Use minimum GLCapabilities for the dummy surface w/ same profile final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height); final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0); - } - return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, + } + return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser, new UpstreamSurfaceHookMutableSize(width, height) ) ); } finally { device.unlock(); @@ -343,7 +343,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp) { + public final GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp) { final AbstractGraphicsDevice device = createNewDevice ? getOrCreateSharedDevice(deviceReq) : deviceReq; if(null == device) { throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice); @@ -357,14 +357,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { device.unlock(); } } - - /** Creates a platform independent unrealized FBO offscreen GLDrawable */ + + /** Creates a platform independent unrealized FBO offscreen GLDrawable */ protected final GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) { final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); return new GLFBODrawableImpl(this, dummyDrawable, dummySurface, fboCaps, textureUnit); } - - /** Creates a platform dependent unrealized offscreen pbuffer/pixmap GLDrawable instance */ + + /** Creates a platform dependent unrealized offscreen pbuffer/pixmap GLDrawable instance */ protected abstract GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) ; /** @@ -381,10 +381,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param capsChosen * @param capsRequested * @param chooser the custom chooser, may be null for default - * @param upstreamHook surface size information and optional control of the surface's lifecycle + * @param upstreamHook surface size information and optional control of the surface's lifecycle * @return the created {@link MutableSurface} instance w/o defined surface handle */ - protected abstract ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice, + protected abstract ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook); @@ -399,7 +399,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param deviceReq which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. * @param requestedCaps * @param chooser the custom chooser, may be null for default - * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. * The latter is platform specific and small * @param height the initial height as returned by {@link NativeSurface#getHeight()}, not the actual dummy surface height, * The latter is platform specific and small @@ -419,7 +419,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { device.unlock(); } } - + /** * A dummy surface is not visible on screen and will not be used to render directly to, * it maybe on- or offscreen. @@ -433,22 +433,22 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param chosenCaps * @param requestedCaps * @param chooser the custom chooser, may be null for default - * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. * The latter is platform specific and small * @param height the initial height as returned by {@link NativeSurface#getHeight()}, not the actual dummy surface height, * The latter is platform specific and small * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. */ - public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice, + public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height); //--------------------------------------------------------------------------- // // ProxySurface (Wrapped pre-existing native surface) construction // - + @Override - public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, + public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { @@ -473,7 +473,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * </p> * @param upstream TODO */ - protected abstract ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, + protected abstract ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream); //--------------------------------------------------------------------------- diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 5418fbaf3..2cf384fd7 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -63,12 +63,12 @@ import javax.media.opengl.GLRunnable; public class GLDrawableHelper { /** true if property <code>jogl.debug.GLDrawable.PerfStats</code> is defined. */ private static final boolean PERF_STATS; - + static { Debug.initSingleton(); PERF_STATS = Debug.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true); } - + protected static final boolean DEBUG = GLDrawableImpl.DEBUG; private final Object listenersLock = new Object(); private final ArrayList<GLEventListener> listeners = new ArrayList<GLEventListener>(); @@ -120,7 +120,7 @@ public class GLDrawableHelper { /** Limit release calls of {@link #forceNativeRelease(GLContext)} to {@value}. */ private static final int MAX_RELEASE_ITER = 512; - + /** * Since GLContext's {@link GLContext#makeCurrent()} and {@link GLContext#release()} * is recursive, a call to {@link GLContext#release()} may not natively release the context. @@ -138,36 +138,36 @@ public class GLDrawableHelper { System.err.println("GLDrawableHelper.forceNativeRelease() #"+releaseCount+" -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent()); } } while( MAX_RELEASE_ITER > releaseCount && ctx.isCurrent() ); - + if( ctx.isCurrent() ) { throw new GLException("Context still current after "+MAX_RELEASE_ITER+" releases: "+ctx); } } - + /** * Switch {@link GLContext} / {@link GLDrawable} association. * <p> * The <code>oldCtx</code> will be destroyed if <code>destroyPrevCtx</code> is <code>true</code>, - * otherwise dis-associate <code>oldCtx</code> from <code>drawable</code> + * otherwise dis-associate <code>oldCtx</code> from <code>drawable</code> * via {@link GLContext#setGLDrawable(GLDrawable, boolean) oldCtx.setGLDrawable(null, true);}. * </p> * <p> - * Re-associate <code>newCtx</code> with <code>drawable</code> + * Re-associate <code>newCtx</code> with <code>drawable</code> * via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}. * </p> - * <p> + * <p> * If the old or new context was current on this thread, it is being released before switching the drawable. * </p> * <p> * No locking is being performed on the drawable, caller is required to take care of it. * </p> - * + * * @param drawable the drawable which context is changed * @param oldCtx the old context, maybe <code>null</code>. * @param destroyOldCtx if <code>true</code>, destroy the <code>oldCtx</code> * @param newCtx the new context, maybe <code>null</code> for dis-association. * @param newCtxCreationFlags additional creation flags if newCtx is not null and not been created yet, see {@link GLContext#setContextCreationFlags(int)} - * + * * @see GLAutoDrawable#setContext(GLContext, boolean) */ public static final void switchContext(GLDrawable drawable, GLContext oldCtx, boolean destroyOldCtx, GLContext newCtx, int newCtxCreationFlags) { @@ -178,16 +178,16 @@ public class GLDrawableHelper { oldCtx.setGLDrawable(null, true); // dis-associate old pair } } - + if(null!=newCtx) { newCtx.setContextCreationFlags(newCtxCreationFlags); - newCtx.setGLDrawable(drawable, true); // re-associate new pair + newCtx.setGLDrawable(drawable, true); // re-associate new pair } } - + /** * If the drawable is not realized, OP is a NOP. - * <ul> + * <ul> * <li>release context if current</li> * <li>destroy old drawable</li> * <li>create new drawable</li> @@ -197,12 +197,12 @@ public class GLDrawableHelper { * <p> * Locking is performed via {@link GLContext#makeCurrent()} on the passed <code>context</code>. * </p> - * + * * @param drawable * @param context maybe null * @return the new drawable */ - public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) { + public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) { if( ! drawable.isRealized() ) { return drawable; } @@ -210,7 +210,7 @@ public class GLDrawableHelper { final GLDrawableFactory factory = drawable.getFactory(); final NativeSurface surface = drawable.getNativeSurface(); final ProxySurface proxySurface = (surface instanceof ProxySurface) ? (ProxySurface)surface : null; - + if( null != context ) { // Ensure to sync GL command stream if( currentContext != context ) { @@ -219,7 +219,7 @@ public class GLDrawableHelper { context.getGL().glFinish(); context.setGLDrawable(null, true); // dis-associate } - + if(null != proxySurface) { proxySurface.enableUpstreamSurfaceHookLifecycle(false); } @@ -236,18 +236,18 @@ public class GLDrawableHelper { if(null != context) { context.setGLDrawable(drawable, true); // re-association } - + if( null != currentContext ) { currentContext.makeCurrent(); } return drawable; } - + /** * Performs resize operation on the given drawable, assuming it is offscreen. * <p> * The {@link GLDrawableImpl}'s {@link NativeSurface} is being locked during operation. - * In case the holder is an auto drawable or similar, it's lock shall be claimed by the caller. + * In case the holder is an auto drawable or similar, it's lock shall be claimed by the caller. * </p> * <p> * May recreate the drawable via {@link #recreateGLDrawable(GLDrawableImpl, GLContext)} @@ -257,10 +257,10 @@ public class GLDrawableHelper { * FBO drawables are resized w/o drawable destruction. * </p> * <p> - * Offscreen resize operation is validated w/ drawable size in the end. + * Offscreen resize operation is validated w/ drawable size in the end. * An exception is thrown if not successful. * </p> - * + * * @param drawable * @param context * @param newWidth the new width, it's minimum is capped to 1 @@ -270,7 +270,7 @@ public class GLDrawableHelper { * @throws GLException may be thrown a resize operation */ public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, GLContext context, int newWidth, int newHeight) - throws NativeWindowException, GLException + throws NativeWindowException, GLException { if(drawable.getChosenGLCapabilities().isOnscreen()) { throw new NativeWindowException("Drawable is not offscreen: "+drawable); @@ -288,7 +288,7 @@ public class GLDrawableHelper { } if(0>=newWidth) { newWidth = 1; validateSize=false; } if(0>=newHeight) { newHeight = 1; validateSize=false; } - // propagate new size + // propagate new size if(ns instanceof ProxySurface) { final ProxySurface ps = (ProxySurface) ns; final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook(); @@ -301,7 +301,7 @@ public class GLDrawableHelper { System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen surface n.a. ProxySurface, but "+ns.getClass().getName()+": "+ns); } if(drawable instanceof GLFBODrawable) { - if( null != context && context.isCreated() ) { + if( null != context && context.isCreated() ) { ((GLFBODrawable) drawable).resetSize(context.getGL()); } } else { @@ -315,7 +315,7 @@ public class GLDrawableHelper { } return drawable; } - + public final void addGLEventListener(GLEventListener listener) { addGLEventListener(-1, listener); } @@ -328,14 +328,14 @@ public class GLDrawableHelper { // GLEventListener may be added after context is created, // hence we earmark initialization for the next display call. listenersToBeInit.add(listener); - + listeners.add(index, listener); } } /** * Note that no {@link GLEventListener#dispose(GLAutoDrawable)} call is being issued - * due to the lack of a current context. + * due to the lack of a current context. * Consider calling {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}. * @return the removed listener, or null if listener was not added */ @@ -356,11 +356,11 @@ public class GLDrawableHelper { return listener; } } - + public final int getGLEventListenerCount() { synchronized(listenersLock) { return listeners.size(); - } + } } public final GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { @@ -371,13 +371,13 @@ public class GLDrawableHelper { return listeners.get(index); } } - + public final boolean getGLEventListenerInitState(GLEventListener listener) { synchronized(listenersLock) { return !listenersToBeInit.contains(listener); } } - + public final void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { synchronized(listenersLock) { if(initialized) { @@ -387,16 +387,16 @@ public class GLDrawableHelper { } } } - + /** - * Disposes the given {@link GLEventListener} via {@link GLEventListener#dispose(GLAutoDrawable)} + * Disposes the given {@link GLEventListener} via {@link GLEventListener#dispose(GLAutoDrawable)} * if it has been initialized and added to this queue. * <p> * If <code>remove</code> is <code>true</code>, the {@link GLEventListener} is removed from this drawable queue before disposal, * otherwise marked uninitialized. * </p> * <p> - * Please consider using {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)} + * Please consider using {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)} * for correctness, i.e. encapsulating all calls w/ makeCurrent etc. * </p> * @param autoDrawable @@ -405,9 +405,9 @@ public class GLDrawableHelper { */ public final GLEventListener disposeGLEventListener(GLAutoDrawable autoDrawable, GLEventListener listener, boolean remove) { synchronized(listenersLock) { - if( remove ) { + if( remove ) { if( listeners.remove(listener) ) { - if( !listenersToBeInit.remove(listener) ) { + if( !listenersToBeInit.remove(listener) ) { listener.dispose(autoDrawable); } return listener; @@ -417,12 +417,12 @@ public class GLDrawableHelper { listener.dispose(autoDrawable); listenersToBeInit.add(listener); return listener; - } + } } } return null; } - + /** * Disposes all added initialized {@link GLEventListener}s via {@link GLEventListener#dispose(GLAutoDrawable)}. * <p> @@ -456,20 +456,20 @@ public class GLDrawableHelper { listenersToBeInit.add(listener); disposeCount++; } - } + } } } return disposeCount; } /** - * Principal helper method which runs {@link #disposeGLEventListener(GLAutoDrawable, GLEventListener, boolean)} + * Principal helper method which runs {@link #disposeGLEventListener(GLAutoDrawable, GLEventListener, boolean)} * with the context made current. * <p> - * If an {@link GLAnimatorControl} is being attached and the current thread is different + * If an {@link GLAnimatorControl} is being attached and the current thread is different * than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> - * + * * @param autoDrawable * @param context * @param listener @@ -477,7 +477,7 @@ public class GLDrawableHelper { */ public final GLEventListener disposeGLEventListener(final GLAutoDrawable autoDrawable, final GLDrawable drawable, - final GLContext context, + final GLContext context, final GLEventListener listener, final boolean remove) { synchronized(listenersLock) { @@ -485,7 +485,7 @@ public class GLDrawableHelper { if( listenersToBeInit.contains(listener) ) { if( remove ) { listenersToBeInit.remove(listener); - return listeners.remove(listener) ? listener : null; + return listeners.remove(listener) ? listener : null; } return null; } @@ -498,21 +498,21 @@ public class GLDrawableHelper { } }; invokeGL(drawable, context, action, nop); - + if(isPaused) { animatorCtrl.resume(); } return res[0]; } - + /** - * Principal helper method which runs {@link #disposeAllGLEventListener(GLAutoDrawable, boolean)} + * Principal helper method which runs {@link #disposeAllGLEventListener(GLAutoDrawable, boolean)} * with the context made current. * <p> - * If an {@link GLAnimatorControl} is being attached and the current thread is different + * If an {@link GLAnimatorControl} is being attached and the current thread is different * than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> - * + * * @param autoDrawable * @param context * @param remove @@ -521,21 +521,21 @@ public class GLDrawableHelper { final GLDrawable drawable, final GLContext context, final boolean remove) { - + final boolean isPaused = isAnimatorAnimatingOnOtherThread() && animatorCtrl.pause(); - + final Runnable action = new Runnable() { public void run() { disposeAllGLEventListener(autoDrawable, remove); } }; invokeGL(drawable, context, action, nop); - + if(isPaused) { animatorCtrl.resume(); } } - + private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) { l.init(drawable); if(sendReshape) { @@ -543,8 +543,8 @@ public class GLDrawableHelper { } } - /** - * The default init action to be called once after ctx is being created @ 1st makeCurrent(). + /** + * The default init action to be called once after ctx is being created @ 1st makeCurrent(). * @param sendReshape set to true if the subsequent display call won't reshape, otherwise false to avoid double reshape. **/ public final void init(GLAutoDrawable drawable, boolean sendReshape) { @@ -554,7 +554,7 @@ public class GLDrawableHelper { if( listenerCount > 0 ) { for (int i=0; i < listenerCount; i++) { final GLEventListener listener = _listeners.get(i) ; - + // If make ctx current, invoked by invokGL(..), results in a new ctx, init gets called. // This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window), // hence it must be called unconditional, always. @@ -571,7 +571,7 @@ public class GLDrawableHelper { public final void display(GLAutoDrawable drawable) { displayImpl(drawable); if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0 - displayImpl(drawable); + displayImpl(drawable); } } private final void displayImpl(GLAutoDrawable drawable) { @@ -580,7 +580,7 @@ public class GLDrawableHelper { final int listenerCount = _listeners.size(); for (int i=0; i < listenerCount; i++) { final GLEventListener listener = _listeners.get(i) ; - // GLEventListener may need to be init, + // GLEventListener may need to be init, // in case this one is added after the realization of the GLAutoDrawable if( listenersToBeInit.remove(listener) ) { init( listener, drawable, true /* sendReshape */, listenersToBeInit.size() + 1 == listenerCount /* setViewport if 1st init */ ); @@ -589,11 +589,11 @@ public class GLDrawableHelper { } } } - + private final void reshape(GLEventListener listener, GLAutoDrawable drawable, int x, int y, int width, int height, boolean setViewport, boolean checkInit) { if(checkInit) { - // GLEventListener may need to be init, + // GLEventListener may need to be init, // in case this one is added after the realization of the GLAutoDrawable synchronized(listenersLock) { if( listenersToBeInit.remove(listener) ) { @@ -627,7 +627,7 @@ public class GLDrawableHelper { _glRunnables = null; } } - + if(null!=_glRunnables) { for (int i=0; i < _glRunnables.size(); i++) { res = _glRunnables.get(i).run(drawable) && res; @@ -648,7 +648,7 @@ public class GLDrawableHelper { _glRunnables = null; } } - + if(null!=_glRunnables) { for (int i=0; i < _glRunnables.size(); i++) { _glRunnables.get(i).flush(); @@ -656,7 +656,7 @@ public class GLDrawableHelper { } } } - + public final void setAnimator(GLAnimatorControl animator) throws GLException { synchronized(glRunnablesLock) { if(animatorCtrl!=animator && null!=animator && null!=animatorCtrl) { @@ -693,7 +693,7 @@ public class GLDrawableHelper { * If <code>wait</code> is <code>true</code> the call blocks until the <code>glRunnable</code> * has been executed.<p> * <p> - * If <code>wait</code> is <code>true</code> <b>and</b> + * If <code>wait</code> is <code>true</code> <b>and</b> * {@link GLDrawable#isRealized()} returns <code>false</code> <i>or</i> {@link GLAutoDrawable#getContext()} returns <code>null</code>, * the call is ignored and returns <code>false</code>.<br> * This helps avoiding deadlocking the caller. @@ -709,7 +709,7 @@ public class GLDrawableHelper { wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; } - + GLRunnableTask rTask = null; Object rTaskLock = new Object(); Throwable throwable = null; @@ -743,13 +743,13 @@ public class GLDrawableHelper { } return true; } - + public final boolean invoke(GLAutoDrawable drawable, boolean wait, List<GLRunnable> newGLRunnables) { if( null == newGLRunnables || newGLRunnables.size() == 0 || null == drawable || wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; } - + final int count = newGLRunnables.size(); GLRunnableTask rTask = null; Object rTaskLock = new Object(); @@ -785,18 +785,18 @@ public class GLDrawableHelper { } } } - return true; + return true; } public final void enqueue(GLRunnable glRunnable) { if( null == glRunnable) { return; - } + } synchronized(glRunnablesLock) { glRunnables.add( new GLRunnableTask(glRunnable, null, false) ); } } - + public final void setAutoSwapBufferMode(boolean enable) { autoSwapBufferMode = enable; } @@ -812,17 +812,17 @@ public class GLDrawableHelper { /** * Dedicates this instance's {@link GLContext} to the given thread.<br/> * The thread will exclusively claim the {@link GLContext} via {@link #display()} and not release it - * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called. + * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called. * <p> * Default non-exclusive behavior is <i>requested</i> via <code>setExclusiveContextThread(null)</code>, - * which will cause the next call of {@link #display()} on the exclusive thread to - * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()} + * which will cause the next call of {@link #display()} on the exclusive thread to + * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()} * will return <code>null</code>. * </p> * <p> * To release a previous made exclusive thread, a user issues <code>setExclusiveContextThread(null)</code> - * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>, - * <i>while</i> the exclusive thread is still running. + * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>, + * <i>while</i> the exclusive thread is still running. * </p> * <p> * Note: Setting a new exclusive thread without properly releasing a previous one @@ -833,7 +833,7 @@ public class GLDrawableHelper { * and spare redundant context switches. * </p> * @param t the exclusive thread to claim the context, or <code>null</code> for default operation. - * @return previous exclusive context thread + * @return previous exclusive context thread * @throws GLException If an exclusive thread is still active but a new one is attempted to be set */ public final Thread setExclusiveContextThread(Thread t, GLContext context) throws GLException { @@ -857,7 +857,7 @@ public class GLDrawableHelper { ex.printStackTrace(); throw new GLException(ex); } - } + } exclusiveContextThread = t; } if (DEBUG) { @@ -865,14 +865,14 @@ public class GLDrawableHelper { } return oldExclusiveContextThread; } - + /** - * @see #setExclusiveContextThread(Thread, GLContext) + * @see #setExclusiveContextThread(Thread, GLContext) */ public final Thread getExclusiveContextThread() { return exclusiveContextThread; } - + private static final ThreadLocal<Runnable> perThreadInitAction = new ThreadLocal<Runnable>(); /** Principal helper method which runs a Runnable with the context @@ -904,15 +904,15 @@ public class GLDrawableHelper { } if(PERF_STATS) { - invokeGLImplStats(drawable, context, runnable, initAction); + invokeGLImplStats(drawable, context, runnable, initAction); } else { invokeGLImpl(drawable, context, runnable, initAction); } } - /** - * Principal helper method which runs - * {@link #disposeAllGLEventListener(GLAutoDrawable, boolean) disposeAllGLEventListener(autoDrawable, false)} + /** + * Principal helper method which runs + * {@link #disposeAllGLEventListener(GLAutoDrawable, boolean) disposeAllGLEventListener(autoDrawable, false)} * with the context made current. * <p> * If <code>destroyContext</code> is <code>true</code> the context is destroyed in the end while holding the lock. @@ -940,7 +940,7 @@ public class GLDrawableHelper { } } - int res; + int res; try { res = context.makeCurrent(); if (GLContext.CONTEXT_NOT_CURRENT != res) { @@ -975,7 +975,7 @@ public class GLDrawableHelper { private final void invokeGLImpl(final GLDrawable drawable, final GLContext context, final Runnable runnable, - final Runnable initAction) { + final Runnable initAction) { final Thread currentThread = Thread.currentThread(); // Exclusive Cases: @@ -1013,7 +1013,7 @@ public class GLDrawableHelper { lastContext.release(); } } - + try { final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { @@ -1110,7 +1110,7 @@ public class GLDrawableHelper { long tdX = 0; // release boolean ctxClaimed = false; boolean ctxReleased = false; - boolean ctxDestroyed = false; + boolean ctxDestroyed = false; try { final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { @@ -1129,7 +1129,7 @@ public class GLDrawableHelper { } initAction.run(); } - tdR = System.currentTimeMillis(); + tdR = System.currentTimeMillis(); tdA = tdR - t0; // makeCurrent runnable.run(); tdS = System.currentTimeMillis(); @@ -1172,5 +1172,5 @@ public class GLDrawableHelper { } protected static String getThreadName() { return Thread.currentThread().getName(); } - + } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index e1088da29..a79a3cf25 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -53,11 +53,11 @@ import javax.media.opengl.GLProfile; public abstract class GLDrawableImpl implements GLDrawable { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; - + protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, boolean realized) { this(factory, comp, (GLCapabilitiesImmutable) comp.getGraphicsConfiguration().getRequestedCapabilities(), realized); } - + protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, GLCapabilitiesImmutable requestedCapabilities, boolean realized) { this.factory = factory; this.surface = comp; @@ -100,20 +100,20 @@ public abstract class GLDrawableImpl implements GLDrawable { } } finally { unlockSurface(); - } + } surface.surfaceUpdated(this, surface, System.currentTimeMillis()); } - + /** * Platform and implementation depending surface swap. * <p>The surface is locked.</p> * <p> - * If <code>doubleBuffered</code> is <code>true</code>, + * If <code>doubleBuffered</code> is <code>true</code>, * an actual platform dependent surface swap shall be executed. * </p> * <p> - * If <code>doubleBuffered</code> is <code>false</code>, - * {@link GL#glFlush()} has been called already and + * If <code>doubleBuffered</code> is <code>false</code>, + * {@link GL#glFlush()} has been called already and * the implementation may execute implementation specific code. * </p> * @param doubleBuffered indicates whether double buffering is enabled, see above. @@ -143,19 +143,19 @@ public abstract class GLDrawableImpl implements GLDrawable { return surface; } - /** + /** * called with locked surface @ setRealized(false) or @ lockSurface(..) when surface changed * <p> * Must be paired w/ {@link #createHandle()}. - * </p> + * </p> */ protected void destroyHandle() {} - /** + /** * called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed * <p> * Must be paired w/ {@link #destroyHandle()}. - * </p> + * </p> */ protected void createHandle() {} @@ -213,16 +213,16 @@ public abstract class GLDrawableImpl implements GLDrawable { System.err.println(getThreadName() + ": setRealized: "+getClass().getName()+" "+this.realized+" == "+realizedArg); } } - + /** - * Platform specific realization of drawable + * Platform specific realization of drawable */ protected abstract void setRealizedImpl(); /** * Callback for special implementations, allowing * <ul> - * <li>to associate bound context to this drawable (bound == true) + * <li>to associate bound context to this drawable (bound == true) * or to remove such association (bound == false).</li> * <li>to trigger GLContext/GLDrawable related lifecycle: <code>construct</code>, <code>destroy</code>.</li> * </ul> @@ -239,8 +239,8 @@ public abstract class GLDrawableImpl implements GLDrawable { * @param bound if <code>true</code> create an association, otherwise remove it */ protected void associateContext(GLContext ctx, boolean bound) { } - - /** + + /** * Callback for special implementations, allowing GLContext to trigger GL related lifecycle: <code>makeCurrent</code>, <code>release</code>. * <p> * If <code>current</code> is <code>true</code>, the context has just been made current. @@ -252,13 +252,13 @@ public abstract class GLDrawableImpl implements GLDrawable { * Being called by {@link GLContextImpl#contextMadeCurrent(boolean)}. * </p> * @see #associateContext(GLContext, boolean) - */ + */ protected void contextMadeCurrent(GLContext glc, boolean current) { } /** Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.*/ protected int getDefaultDrawFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */ - protected int getDefaultReadFramebuffer() { return 0; } + protected int getDefaultReadFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */ protected int getDefaultReadBuffer(GL gl) { if(gl.isGLES() || getChosenGLCapabilities().getDoubleBuffered()) { @@ -266,9 +266,9 @@ public abstract class GLDrawableImpl implements GLDrawable { // Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i return GL.GL_BACK; } - return GL.GL_FRONT ; + return GL.GL_FRONT ; } - + @Override public final boolean isRealized() { return realized; @@ -286,22 +286,22 @@ public abstract class GLDrawableImpl implements GLDrawable { @Override public boolean isGLOriented() { - return true; + return true; } - - /** + + /** * {@link NativeSurface#lockSurface() Locks} the underlying windowing toolkit's {@link NativeSurface surface}. * <p> * <i>If</i> drawable is {@link #setRealized(boolean) realized}, - * the {@link #getHandle() drawable handle} is valid after successfully {@link NativeSurface#lockSurface() locking} + * the {@link #getHandle() drawable handle} is valid after successfully {@link NativeSurface#lockSurface() locking} * it's {@link NativeSurface surface} until being {@link #unlockSurface() unlocked}. * </p> * <p> - * In case the {@link NativeSurface surface} has changed as indicated by it's + * In case the {@link NativeSurface surface} has changed as indicated by it's * {@link NativeSurface#lockSurface() lock} result {@link NativeSurface#LOCK_SURFACE_CHANGED}, - * the implementation is required to update this information as needed within it's implementation. + * the implementation is required to update this information as needed within it's implementation. * </p> - * + * * @see NativeSurface#lockSurface() * @see #getHandle() */ @@ -312,7 +312,7 @@ public abstract class GLDrawableImpl implements GLDrawable { final long _handle1 = getHandle(); destroyHandle(); createHandle(); - final long _handle2 = getHandle(); + final long _handle2 = getHandle(); if(DEBUG) { if( _handle1 != _handle2) { System.err.println(getThreadName() + ": Drawable handle changed: "+toHexString(_handle1)+" -> "+toHexString(_handle2)); @@ -320,14 +320,14 @@ public abstract class GLDrawableImpl implements GLDrawable { } } return lockRes; - + } - /** + /** * {@link NativeSurface#unlockSurface() Unlocks} the underlying windowing toolkit {@link NativeSurface surface}, * which may render the {@link #getHandle() drawable handle} invalid. - * - * @see NativeSurface#unlockSurface() + * + * @see NativeSurface#unlockSurface() * @see #getHandle() */ public final void unlockSurface() { diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java index 8ba9f617b..640e181ae 100644 --- a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import com.jogamp.common.os.DynamicLibraryBundle; @@ -36,7 +36,7 @@ public abstract class GLDynamicLibraryBundleInfo implements DynamicLibraryBundle protected GLDynamicLibraryBundleInfo() { } - /** + /** * Returns <code>true</code>, * since we might load a desktop GL library and allow symbol access to subsequent libs. * <p> @@ -47,19 +47,19 @@ public abstract class GLDynamicLibraryBundleInfo implements DynamicLibraryBundle * </p> */ public final boolean shallLinkGlobal() { return true; } - + /** * {@inheritDoc} * <p> * Returns <code>false</code>. * </p> - */ + */ @Override public boolean shallLookupGlobal() { return false; } @Override public final RunnableExecutor getLibLoaderExecutor() { return DynamicLibraryBundle.getDefaultRunnableExecutor(); - } + } } diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java index 1ed73f15e..421f06205 100644 --- a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import com.jogamp.common.os.DynamicLibraryBundle; diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index f2248b388..ab318927c 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -26,11 +26,11 @@ import com.jogamp.opengl.JoglVersion; * to initialize the {@link FBObject} instance. * </p> * <p> - * It utilizes the context current hook {@link #contextMadeCurrent(GLContext, boolean) contextMadeCurrent(context, true)} + * It utilizes the context current hook {@link #contextMadeCurrent(GLContext, boolean) contextMadeCurrent(context, true)} * to {@link FBObject#bind(GL) bind} the FBO. * </p> * See {@link GLFBODrawable} for double buffering details. - * + * * @see GLDrawableImpl#contextRealized(GLContext, boolean) * @see GLDrawableImpl#contextMadeCurrent(GLContext, boolean) * @see GLDrawableImpl#getDefaultDrawFramebuffer() @@ -39,21 +39,21 @@ import com.jogamp.opengl.JoglVersion; public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected static final boolean DEBUG; protected static final boolean DEBUG_SWAP; - + static { Debug.initSingleton(); DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject"); DEBUG_SWAP = DEBUG || Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true); } - + private final GLDrawableImpl parent; private GLCapabilitiesImmutable origParentChosenCaps; - + private boolean initialized; private int texUnit; private int samples; private boolean fboResetQuirk; - + private FBObject[] fbos; private int fboIBack; // points to GL_BACK buffer private int fboIFront; // points to GL_FRONT buffer @@ -64,19 +64,19 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { private boolean fboSwapped; /** dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode */ - private static volatile boolean resetQuirkInfoDumped = false; - + private static volatile boolean resetQuirkInfoDumped = false; + /** number of FBOs for double buffering. TODO: Possible to configure! */ - private static final int bufferCount = 2; - + private static final int bufferCount = 2; + // private DoubleBufferMode doubleBufferMode; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support - + private SwapBufferContext swapBufferContext; - + public static interface SwapBufferContext { public void swapBuffers(boolean doubleBuffered); } - + /** * @param factory * @param parent @@ -84,7 +84,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { * @param fboCaps the requested FBO capabilities * @param textureUnit */ - protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface, + protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface, GLCapabilitiesImmutable fboCaps, int textureUnit) { super(factory, surface, fboCaps, false); this.initialized = false; @@ -94,13 +94,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { this.texUnit = textureUnit; this.samples = fboCaps.getNumSamples(); fboResetQuirk = false; - + // default .. // TODO: Add or remove TEXTURE (only) DoubleBufferMode support // this.doubleBufferMode = ( samples > 0 || fboCaps.getDoubleBuffered() ) ? DoubleBufferMode.FBO : DoubleBufferMode.NONE ; - + this.swapBufferContext = null; } - + private final void initialize(boolean realize, GL gl) { if( !initialized && !realize ) { if( DEBUG ) { @@ -114,7 +114,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } if(realize) { final GLCapabilities chosenFBOCaps = (GLCapabilities) getChosenGLCapabilities(); // cloned at setRealized(true) - + final int maxSamples = gl.getMaxRenderbufferSamples(); { final int newSamples = samples <= maxSamples ? samples : maxSamples; @@ -123,7 +123,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } samples = newSamples; } - + final int fbosN; if(samples > 0) { fbosN = 1; @@ -136,7 +136,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fbos = new FBObject[fbosN]; fboIBack = 0; // head fboIFront = fbos.length - 1; // tail - + for(int i=0; i<fbosN; i++) { fbos[i] = new FBObject(); fbos[i].reset(gl, getWidth(), getHeight(), samples, false); @@ -168,13 +168,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fboSwapped = false; pendingFBOReset = -1; initialized = realize; - + if(DEBUG) { System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this); Thread.dumpStack(); } } - + public final void setSwapBufferContext(SwapBufferContext sbc) { swapBufferContext = sbc; } @@ -200,7 +200,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { System.err.println(joglVersion.toString()); System.err.println(JoglVersion.getGLInfo(gl, null)); } else { - System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null)); + System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null)); } e.printStackTrace(); } @@ -226,16 +226,16 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fbos[idx].attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); } } - + private final void reset(GL gl, int newSamples) throws GLException { if(!initialized) { // NOP if not yet initializes return; } - + final GLContext curContext = GLContext.getCurrent(); final GLContext ourContext = gl.getContext(); - final boolean ctxSwitch = null != curContext && curContext != ourContext; + final boolean ctxSwitch = null != curContext && curContext != ourContext; if(DEBUG) { System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): BEGIN - ctxSwitch "+ctxSwitch+", "+this); Thread.dumpStack(); @@ -247,9 +247,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { fboBound = false; // clear bound-flag immediatly, caused by contextMadeCurrent(..) - otherwise we would swap @ release fboSwapped = false; try { - final int maxSamples = gl.getMaxRenderbufferSamples(); + final int maxSamples = gl.getMaxRenderbufferSamples(); newSamples = newSamples <= maxSamples ? newSamples : maxSamples; - + if(0==samples && 0<newSamples || 0<samples && 0==newSamples) { // MSAA on/off switch if(DEBUG) { @@ -258,7 +258,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { initialize(false, gl); samples = newSamples; initialize(true, gl); - } else { + } else { if(DEBUG) { System.err.println("GLFBODrawableImpl.reset(): simple reconfig: "+samples+" -> "+newSamples+"/"+maxSamples); } @@ -297,11 +297,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): END "+this); } } - + // // GLDrawable // - + @Override public final GLContext createContext(GLContext shareWith) { final GLContext ctx = parent.createContext(shareWith); @@ -312,7 +312,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // // GLDrawableImpl // - + @Override public final GLDynamicLookupHelper getGLDynamicLookupHelper() { return parent.getGLDynamicLookupHelper(); @@ -320,13 +320,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { @Override protected final int getDefaultDrawFramebuffer() { return initialized ? fbos[fboIBack].getWriteFramebuffer() : 0; } - + @Override protected final int getDefaultReadFramebuffer() { return initialized ? fbos[fboIFront].getReadFramebuffer() : 0; } @Override protected final int getDefaultReadBuffer(GL gl) { return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; } - + @Override protected final void setRealizedImpl() { final MutableGraphicsConfiguration msConfig = (MutableGraphicsConfiguration) surface.getGraphicsConfiguration(); @@ -341,12 +341,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { parent.setRealized(false); } } - + @Override protected void associateContext(GLContext glc, boolean bound) { - initialize(bound, glc.getGL()); + initialize(bound, glc.getGL()); } - + @Override protected final void contextMadeCurrent(GLContext glc, boolean current) { final GL gl = glc.getGL(); @@ -367,7 +367,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } } - + @Override protected void swapBuffersImpl(boolean doubleBuffered) { final GLContext ctx = GLContext.getCurrent(); @@ -389,7 +389,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { swapFBOImplPost(ctx); } } - + private final void swapFBOImplPost(GLContext glc) { // Safely reset the previous front FBO - after completing propagating swap if(0 <= pendingFBOReset) { @@ -398,18 +398,18 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { pendingFBOReset = -1; } } - + private final void swapFBOImpl(GLContext glc) { final GL gl = glc.getGL(); fbos[fboIBack].markUnbound(); // fast path, use(gl,..) is called below - + if(DEBUG) { int _fboIFront = ( fboIFront + 1 ) % fbos.length; if(_fboIFront != fboIBack) { throw new InternalError("XXX: "+_fboIFront+"!="+fboIBack); } } fboIFront = fboIBack; fboIBack = ( fboIBack + 1 ) % fbos.length; - + final Colorbuffer colorbuffer = samples > 0 ? fbos[fboIFront].getSamplingSink() : fbos[fboIFront].getColorbuffer(0); final TextureAttachment texAttachment; if(colorbuffer instanceof TextureAttachment) { @@ -423,12 +423,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit); fbos[fboIFront].use(gl, texAttachment); - - /* Included in above use command: + + /* Included in above use command: gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, fbos[fboIBack].getDrawFramebuffer()); gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbos[fboIFront].getReadFramebuffer()); } */ - + if(DEBUG_SWAP) { System.err.println("Post FBO swap(X): fboI back "+fboIBack+", front "+fboIFront+", num "+fbos.length); } @@ -436,62 +436,62 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // // GLFBODrawable - // - + // + @Override public final boolean isInitialized() { return initialized; } - + @Override public final void resetSize(GL gl) throws GLException { reset(gl, samples); - } - + } + @Override public final int getTextureUnit() { return texUnit; } - + @Override public final void setTextureUnit(int u) { texUnit = u; } - + @Override public final int getNumSamples() { return samples; } - + @Override public void setNumSamples(GL gl, int newSamples) throws GLException { if(samples != newSamples) { reset(gl, newSamples); } } - + @Override public final int setNumBuffers(int bufferCount) throws GLException { // FIXME: Implement return bufferCount; } - + @Override public final int getNumBuffers() { return bufferCount; } - + /** // TODO: Add or remove TEXTURE (only) DoubleBufferMode support @Override public final DoubleBufferMode getDoubleBufferMode() { return doubleBufferMode; } - + @Override public final void setDoubleBufferMode(DoubleBufferMode mode) throws GLException { if(initialized) { throw new GLException("Not allowed past initialization: "+this); - } + } final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); if(0 == samples && caps.getDoubleBuffered() && DoubleBufferMode.NONE != mode) { doubleBufferMode = mode; } } */ - + @Override public FBObject getFBObject(int bufferName) throws IllegalArgumentException { if(!initialized) { @@ -509,12 +509,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { case GL.GL_BACK: res = fbos[fboIBack]; break; - default: + default: throw new IllegalArgumentException(illegalBufferName+toHexString(bufferName)); - } - return res; + } + return res; } - + @Override public final TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException { if(!initialized) { @@ -536,13 +536,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { res = (TextureAttachment) fbos[fboIBack].getColorbuffer(0); } break; - default: + default: throw new IllegalArgumentException(illegalBufferName+toHexString(bufferName)); - } - return res; + } + return res; } private static final String illegalBufferName = "Only GL_FRONT and GL_BACK buffer are allowed, passed "; - + @Override public String toString() { return getClass().getSimpleName()+"[Initialized "+initialized+", realized "+isRealized()+", texUnit "+texUnit+", samples "+samples+ @@ -555,13 +555,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { ",\n\tSurface "+getNativeSurface()+ "]"; } - + public static class ResizeableImpl extends GLFBODrawableImpl implements GLFBODrawable.Resizeable { - protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface, + protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface, GLCapabilitiesImmutable fboCaps, int textureUnit) { super(factory, parent, surface, fboCaps, textureUnit); } - + @Override public final void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { if(DEBUG) { @@ -572,7 +572,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { throw new NativeWindowException("Could not lock surface: "+this); } try { - // propagate new size + // propagate new size final ProxySurface ps = (ProxySurface) getNativeSurface(); final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook(); if(ush instanceof UpstreamSurfaceHook.MutableSize) { diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java index d54da4d28..702fb77de 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java @@ -85,12 +85,12 @@ public class GLGraphicsConfigurationUtil { } if(isFBO) { winattrbits |= FBO_BIT; - } + } if(isPBuffer ){ winattrbits |= PBUFFER_BIT; - } + } if(isBitmap) { - winattrbits |= BITMAP_BIT; + winattrbits |= BITMAP_BIT; } return winattrbits; } @@ -110,7 +110,7 @@ public class GLGraphicsConfigurationUtil { } else if(isPBuffer ){ winattrbits = PBUFFER_BIT; } else if(isBitmap) { - winattrbits = BITMAP_BIT; + winattrbits = BITMAP_BIT; } else { throw new InternalError("Empty bitmask"); } @@ -136,9 +136,9 @@ public class GLGraphicsConfigurationUtil { caps.setHardwareAccelerated(false); } - return caps; + return caps; } - + /** * Fixes the requested {@link GLCapabilitiesImmutable} according to on- and offscreen usage. * <p> @@ -150,17 +150,17 @@ public class GLGraphicsConfigurationUtil { * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ - public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested, + public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested, GLDrawableFactory factory, AbstractGraphicsDevice device) { if( !capsRequested.isOnscreen() ) { return fixOffscreenGLCapabilities(capsRequested, factory, device); } return capsRequested; } - + public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(GLCapabilitiesImmutable capsRequested) { - if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) { + if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setBitmap (false); @@ -174,7 +174,7 @@ public class GLGraphicsConfigurationUtil { public static GLCapabilitiesImmutable fixOffscreenBitOnly(GLCapabilitiesImmutable capsRequested) { - if( capsRequested.isOnscreen() ) { + if( capsRequested.isOnscreen() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setOnscreen(false); @@ -182,7 +182,7 @@ public class GLGraphicsConfigurationUtil { } return capsRequested; } - + /** * Fixes the requested {@link GLCapabilitiesImmutable} according to: * <ul> @@ -203,15 +203,15 @@ public class GLGraphicsConfigurationUtil { final GLProfile glp = capsRequested.getGLProfile(); final boolean fboAvailable = GLContext.isFBOAvailable(device, glp); final boolean pbufferAvailable = factory.canCreateGLPbuffer(device, glp); - + final GLRendererQuirks glrq = factory.getRendererQuirks(device); final boolean bitmapAvailable; final boolean doubleBufferAvailable; - + if(null != glrq) { bitmapAvailable = !glrq.exist(GLRendererQuirks.NoOffscreenBitmap); if( capsRequested.getDoubleBuffered() && - ( capsRequested.isPBuffer() && glrq.exist(GLRendererQuirks.NoDoubleBufferedPBuffer) ) || + ( capsRequested.isPBuffer() && glrq.exist(GLRendererQuirks.NoDoubleBufferedPBuffer) ) || ( capsRequested.isBitmap() && glrq.exist(GLRendererQuirks.NoDoubleBufferedBitmap) ) ) { doubleBufferAvailable = false; } else { @@ -221,25 +221,25 @@ public class GLGraphicsConfigurationUtil { bitmapAvailable = true; doubleBufferAvailable = true; } - - final boolean auto = !( fboAvailable && capsRequested.isFBO() ) && - !( pbufferAvailable && capsRequested.isPBuffer() ) && + + final boolean auto = !( fboAvailable && capsRequested.isFBO() ) && + !( pbufferAvailable && capsRequested.isPBuffer() ) && !( bitmapAvailable && capsRequested.isBitmap() ) ; final boolean useFBO = fboAvailable && ( auto || capsRequested.isFBO() ) ; final boolean usePbuffer = !useFBO && pbufferAvailable && ( auto || capsRequested.isPBuffer() ) ; final boolean useBitmap = !useFBO && !usePbuffer && bitmapAvailable && ( auto || capsRequested.isBitmap() ) ; - + if( capsRequested.isOnscreen() || - useFBO != capsRequested.isFBO() || - usePbuffer != capsRequested.isPBuffer() || + useFBO != capsRequested.isFBO() || + usePbuffer != capsRequested.isPBuffer() || useBitmap != capsRequested.isBitmap() || !doubleBufferAvailable && capsRequested.getDoubleBuffered() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setOnscreen(false); - caps2.setFBO( useFBO ); + caps2.setFBO( useFBO ); caps2.setPBuffer( usePbuffer ); caps2.setBitmap( useBitmap ); if( !doubleBufferAvailable ) { @@ -253,8 +253,8 @@ public class GLGraphicsConfigurationUtil { public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() || - !capsRequested.isPBuffer() || - capsRequested.isFBO() ) + !capsRequested.isPBuffer() || + capsRequested.isFBO() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); @@ -277,7 +277,7 @@ public class GLGraphicsConfigurationUtil { } return capsRequested; } - + /** Fix double buffered setting */ public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean doubleBuffered) { @@ -288,7 +288,7 @@ public class GLGraphicsConfigurationUtil { } return capsRequested; } - + public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555, boolean allowAlpha) { final int iR = caps.getRedBits(); @@ -305,21 +305,21 @@ public class GLGraphicsConfigurationUtil { caps2.setGreenBits(oG); caps2.setBlueBits(oB); caps2.setAlphaBits(oA); - return caps2; + return caps2; } return caps; } - + public static int clipColor(final int compIn, final boolean allowRGB555) { final int compOut; if( 5 < compIn || !allowRGB555 ) { - compOut = 8; + compOut = 8; } else { compOut = 5; - } + } return compOut; } - + public static GLCapabilitiesImmutable fixGLProfile(GLCapabilitiesImmutable caps, GLProfile glp) { if( caps.getGLProfile() != glp ) { diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java index 6d9116303..a22454d60 100644 --- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -42,10 +42,10 @@ import com.jogamp.opengl.GLAutoDrawableDelegate; import jogamp.opengl.GLFBODrawableImpl; public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implements GLOffscreenAutoDrawable { - + /** * @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet. - * @param context a valid {@link GLContext}, + * @param context a valid {@link GLContext}, * may not have been made current (created) yet, * may not be associated w/ <code>drawable<code> yet, * may be <code>null</code> for lazy initialization @@ -55,16 +55,16 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen public GLOffscreenAutoDrawableImpl(GLDrawable drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { super(drawable, context, upstreamWidget, true, lock); } - + @Override public void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException { this.defaultWindowResizedOp(newWidth, newHeight); } - - public static class FBOImpl extends GLOffscreenAutoDrawableImpl implements GLOffscreenAutoDrawable.FBO { + + public static class FBOImpl extends GLOffscreenAutoDrawableImpl implements GLOffscreenAutoDrawable.FBO { /** * @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet. - * @param context a valid {@link GLContext}, + * @param context a valid {@link GLContext}, * may not have been made current (created) yet, * may not be associated w/ <code>drawable<code> yet, * may be <code>null</code> for lazy initialization @@ -74,7 +74,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen public FBOImpl(GLFBODrawableImpl drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { super(drawable, context, upstreamWidget, lock); } - + @Override public boolean isInitialized() { return ((GLFBODrawableImpl)drawable).isInitialized(); @@ -84,7 +84,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen public final int getTextureUnit() { return ((GLFBODrawableImpl)drawable).getTextureUnit(); } - + @Override public final void setTextureUnit(int unit) { ((GLFBODrawableImpl)drawable).setTextureUnit(unit); @@ -94,23 +94,23 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen public final int getNumSamples() { return ((GLFBODrawableImpl)drawable).getNumSamples(); } - + @Override public final void setNumSamples(GL gl, int newSamples) throws GLException { ((GLFBODrawableImpl)drawable).setNumSamples(gl, newSamples); windowRepaintOp(); } - + @Override public final int setNumBuffers(int bufferCount) throws GLException { return ((GLFBODrawableImpl)drawable).setNumBuffers(bufferCount); } - + @Override public final int getNumBuffers() { return ((GLFBODrawableImpl)drawable).getNumBuffers(); } - + /** // TODO: Add or remove TEXTURE (only) DoubleBufferMode support @Override public DoubleBufferMode getDoubleBufferMode() { @@ -119,14 +119,14 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen @Override public void setDoubleBufferMode(DoubleBufferMode mode) throws GLException { - ((GLFBODrawableImpl)drawable).setDoubleBufferMode(mode); + ((GLFBODrawableImpl)drawable).setDoubleBufferMode(mode); } */ - + @Override - public final FBObject getFBObject(int bufferName) { + public final FBObject getFBObject(int bufferName) { return ((GLFBODrawableImpl)drawable).getFBObject(bufferName); } - + public final FBObject.TextureAttachment getTextureBuffer(int bufferName) { return ((GLFBODrawableImpl)drawable).getTextureBuffer(bufferName); } @@ -134,6 +134,6 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen @Override public void resetSize(GL gl) throws GLException { ((GLFBODrawableImpl)drawable).resetSize(gl); - } + } } } diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index b8841d6e2..c32957b86 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -51,7 +51,7 @@ import com.jogamp.common.util.locks.RecursiveLock; public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContextImpl pbufferContext) { - super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext + super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext } // @@ -60,26 +60,26 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { // // GLDrawable delegation - // - + // + @Override public final void swapBuffers() throws GLException { defaultSwapBuffers(); } - + // // GLAutoDrawable completion // private final RecursiveLock lock = LockFactory.createRecursiveLock(); // instance wide lock - + @Override protected final RecursiveLock getLock() { return lock; } - + @Override public final Object getUpstreamWidget() { return null; } - + @Override public void destroy() { defaultDestroy(); @@ -92,7 +92,7 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { @Override public final void display() { - final RecursiveLock _lock = lock; + final RecursiveLock _lock = lock; _lock.lock(); // sync: context/drawable could been recreated/destroyed while animating try { if( null != context ) { diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java index 244a3fd79..2238d49bc 100644 --- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java +++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl; import javax.media.opengl.GLRunnable; @@ -86,41 +86,41 @@ public class GLRunnableTask implements GLRunnable { } return res; } - - /** + + /** * Simply flush this task and notify a waiting executor. * The executor which might have been blocked until notified * will be unblocked and the task removed from the queue. - * + * * @see #isFlushed() * @see #isInQueue() - */ + */ public void flush() { if(!isExecuted() && null != notifyObject) { synchronized (notifyObject) { isFlushed=true; - notifyObject.notifyAll(); + notifyObject.notifyAll(); } } } - + /** * @return !{@link #isExecuted()} && !{@link #isFlushed()} */ public boolean isInQueue() { return !isExecuted && !isFlushed; } - + /** * @return whether this task has been executed. * @see #isInQueue() */ public boolean isExecuted() { return isExecuted; } - + /** * @return whether this task has been flushed. * @see #isInQueue() */ public boolean isFlushed() { return isFlushed; } - + public Throwable getThrowable() { return runnableException; } } diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index 01c3716e0..307fd0a15 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -28,11 +28,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -53,47 +53,47 @@ import java.util.ArrayList; * Currently supported states: PixelStorei */ public class GLStateTracker { - - /** Minimum value of MAX_CLIENT_ATTRIB_STACK_DEPTH */ + + /** Minimum value of MAX_CLIENT_ATTRIB_STACK_DEPTH */ public static final int MIN_CLIENT_ATTRIB_STACK_DEPTH = 16; - + /** static size of pixel state map */ static final int PIXEL_STATE_MAP_SIZE = 16; /** avoid rehash of static size pixel state map */ static final int PIXEL_STATE_MAP_CAPACITY = 32; - + private volatile boolean enabled = true; private IntIntHashMap pixelStateMap; private final ArrayList<SavedState> stack; - + private static class SavedState { /** * Empty pixel-store state - */ + */ private IntIntHashMap pixelStateMap; - + /** * set (client) pixel-store state, deep copy - */ + */ private final void setPixelStateMap(IntIntHashMap pixelStateMap) { this.pixelStateMap = (IntIntHashMap) pixelStateMap.clone(); } - + /** * get (client) pixel-store state, return reference - */ + */ private final IntIntHashMap getPixelStateMap() { return pixelStateMap; } } - - public GLStateTracker() { + + public GLStateTracker() { pixelStateMap = new IntIntHashMap(PIXEL_STATE_MAP_CAPACITY, 0.75f); pixelStateMap.setKeyNotFoundValue(0xFFFFFFFF); resetStates(); - + stack = new ArrayList<SavedState>(MIN_CLIENT_ATTRIB_STACK_DEPTH); } @@ -102,18 +102,18 @@ public class GLStateTracker { } public final void setEnabled(boolean on) { - enabled = on; + enabled = on; } public final boolean isEnabled() { return enabled; } - /** @return true if found in our map, otherwise false, + /** @return true if found in our map, otherwise false, * which forces the caller to query GL. */ public final boolean getInt(int pname, int[] params, int params_offset) { if(enabled) { - final int value = pixelStateMap.get(pname); + final int value = pixelStateMap.get(pname); if(0xFFFFFFFF != value) { params[params_offset] = value; return true; @@ -122,7 +122,7 @@ public class GLStateTracker { return false; } - /** @return true if found in our map, otherwise false, + /** @return true if found in our map, otherwise false, * which forces the caller to query GL. */ public final boolean getInt(int pname, IntBuffer params, int dummy) { if(enabled) { @@ -158,7 +158,7 @@ public class GLStateTracker { throw new GLException("stack contains no elements"); } SavedState state = stack.remove(stack.size()-1); // pop - + if(null==state) { throw new GLException("null stack element (remaining stack size "+stack.size()+")"); } @@ -166,7 +166,7 @@ public class GLStateTracker { if ( null != state.getPixelStateMap() ) { // use pulled client pixel-store state from stack pixelStateMap = state.getPixelStateMap(); - } // else: empty-slot, not pushed by GL_CLIENT_PIXEL_STORE_BIT + } // else: empty-slot, not pushed by GL_CLIENT_PIXEL_STORE_BIT } } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index e4187b35b..431c1a387 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -43,9 +43,9 @@ public class GLVersionNumber extends VersionNumberString { super(val[0], val[1], val[2], strEnd, state, versionString); this.valid = valid; } - + private static java.util.regex.Pattern getUnderscorePattern() { - if( null == _Pattern ) { // volatile dbl-checked-locking OK + if( null == _Pattern ) { // volatile dbl-checked-locking OK synchronized( VersionNumber.class ) { if( null == _Pattern ) { _Pattern = getVersionNumberPattern("_"); @@ -55,7 +55,7 @@ public class GLVersionNumber extends VersionNumberString { return _Pattern; } private static volatile java.util.regex.Pattern _Pattern = null; - + public static final GLVersionNumber create(String versionString) { int[] val = new int[] { 0, 0, 0 }; int strEnd = 0; @@ -73,7 +73,7 @@ public class GLVersionNumber extends VersionNumberString { strEnd = version.endOfStringMatch(); val[0] = version.getMajor(); val[1] = version.getMinor(); - state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | + state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component! } catch (Exception e) { @@ -82,16 +82,16 @@ public class GLVersionNumber extends VersionNumberString { val[0] = 1; val[1] = 0; } - } + } return new GLVersionNumber(val, strEnd, state, versionString, valid); } public final boolean isValid() { return valid; } - - /** - * Returns the optional vendor version at the end of the + + /** + * Returns the optional vendor version at the end of the * <code>GL_VERSION</code> string if exists, otherwise the {@link VersionNumberString#zeroVersion zero version} instance. * <pre> * 2.1 Mesa 7.0.3-rc2 -> 7.0.3 (7.0.3-rc2) @@ -105,14 +105,14 @@ public class GLVersionNumber extends VersionNumberString { if (versionString == null || versionString.length() <= 0) { return null; } - + // Skip the 1st GL version String str; { final GLVersionNumber glv = create(versionString); str = versionString.substring(glv.endOfStringMatch()).trim(); } - + while ( str.length() > 0 ) { final VersionNumberString version = new VersionNumberString(str, getDefaultVersionNumberPattern()); final int eosm = version.endOfStringMatch(); diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index 112dfcb64..979c6dc0a 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -28,11 +28,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -67,7 +67,7 @@ public class GLWorkerThread { private static volatile Runnable work; // Queue of Runnables to be asynchronously invoked private static List<Runnable> queue = new ArrayList<Runnable>(); - + /** Should only be called by Threading class if creation of the GLWorkerThread was requested via the opengl.1thread system property. <br> @@ -149,7 +149,7 @@ public class GLWorkerThread { } } - public static void invoke(boolean wait, Runnable runnable) + public static void invoke(boolean wait, Runnable runnable) throws InvocationTargetException, InterruptedException { if(wait) { invokeAndWait(runnable); @@ -157,7 +157,7 @@ public class GLWorkerThread { invokeLater(runnable); } } - + public static void invokeAndWait(Runnable runnable) throws InvocationTargetException, InterruptedException { if (!started) { @@ -220,7 +220,7 @@ public class GLWorkerThread { } protected static String getThreadName() { return Thread.currentThread().getName(); } - + static class WorkerRunnable implements Runnable { public void run() { // Notify starting thread that we're ready @@ -244,7 +244,7 @@ public class GLWorkerThread { break; } } - + if (shouldTerminate) { lock.notifyAll(); thread = null; diff --git a/src/jogl/classes/jogamp/opengl/GLXExtensions.java b/src/jogl/classes/jogamp/opengl/GLXExtensions.java index 36c6c4665..9325c6f68 100644 --- a/src/jogl/classes/jogamp/opengl/GLXExtensions.java +++ b/src/jogl/classes/jogamp/opengl/GLXExtensions.java @@ -28,9 +28,9 @@ package jogamp.opengl; /** - * Class holding GLX/WGL/.. extension strings, commonly used by JOGL's implementation. + * Class holding GLX/WGL/.. extension strings, commonly used by JOGL's implementation. */ -public class GLXExtensions { +public class GLXExtensions { public static final String GLX_MESA_swap_control = "GLX_MESA_swap_control"; public static final String GLX_SGI_swap_control = "GLX_SGI_swap_control"; public static final String GLX_NV_swap_group = "GLX_NV_swap_group"; diff --git a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java index 1cde551be..a64a2f5cd 100644 --- a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java +++ b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java @@ -33,9 +33,9 @@ import java.util.ArrayList; /** * Simple locked listener implementation stub to be used for listener handler, * synchronized on it's instance. - * + * * <p>Utilizing simple locking via synchronized.</p> - * + * * @param <E> The listener type */ public class ListenerSyncedImplStub<E> { @@ -48,7 +48,7 @@ public class ListenerSyncedImplStub<E> { public synchronized final void reset() { listeners = new ArrayList<E>(); } - + public synchronized final void destroy() { listeners.clear(); listeners = null; @@ -57,7 +57,7 @@ public class ListenerSyncedImplStub<E> { public synchronized final int size() { return listeners.size(); } - + public synchronized final void addListener(E listener) { addListener(-1, listener); } @@ -68,12 +68,12 @@ public class ListenerSyncedImplStub<E> { } listeners.add(index, listener); } - + public synchronized final void removeListener(E listener) { listeners.remove(listener); } public final ArrayList<E> getListeners() { return listeners; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 439ddc76e..d4fd1c935 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -6,9 +6,9 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND @@ -24,13 +24,13 @@ ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -45,34 +45,34 @@ ** $Header$ */ -/* +/* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -80,22 +80,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2011 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -108,7 +108,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -129,14 +129,14 @@ import com.jogamp.opengl.math.FloatUtil; * <p> * Created 11-jan-2004 * </p> - * + * * @author Erik Duijs * @author Kenneth Russell * @author Sven Gothel */ public class ProjectFloat { public static final int getRequiredFloatBufferSize() { return 1*16; } - + // Note that we have cloned parts of the implementation in order to // support incoming Buffers. The reason for this is to avoid loading // non-direct buffer subclasses unnecessarily, because doing so can @@ -162,22 +162,22 @@ public class ProjectFloat { public ProjectFloat() { this(true); } - + public ProjectFloat(boolean useBackingArray) { - this(useBackingArray ? null : Buffers.newDirectByteBuffer(getRequiredFloatBufferSize() * Buffers.SIZEOF_FLOAT), - useBackingArray ? new float[getRequiredFloatBufferSize()] : null, + this(useBackingArray ? null : Buffers.newDirectByteBuffer(getRequiredFloatBufferSize() * Buffers.SIZEOF_FLOAT), + useBackingArray ? new float[getRequiredFloatBufferSize()] : null, 0); } /** * @param floatBuffer source buffer, may be ByteBuffer (recommended) or FloatBuffer or <code>null</code>. - * If used, shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset. + * If used, shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset. * Buffer's position is ignored and floatPos is being used. * @param floatArray source float array or <code>null</code>. * If used, size shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset. * @param floatOffset Offset for either of the given sources (buffer or array) */ - public ProjectFloat(Buffer floatBuffer, float[] floatArray, int floatOffset) { + public ProjectFloat(Buffer floatBuffer, float[] floatArray, int floatOffset) { matrixBuf = Buffers.slice2Float(floatBuffer, floatArray, floatOffset, 16); } @@ -259,7 +259,7 @@ public class ProjectFloat { /** * @param src * @param inverse - * + * * @return */ public boolean gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) { @@ -268,7 +268,7 @@ public class ProjectFloat { final int srcPos = src.position(); final int invPos = inverse.position(); - + final float[][] temp = tempInvertMatrix; for (i = 0; i < 4; i++) { @@ -297,7 +297,7 @@ public class ProjectFloat { t = temp[i][k]; temp[i][k] = temp[swap][k]; temp[swap][k] = t; - + t = inverse.get(i*4+k + invPos); inverse.put(i*4+k + invPos, inverse.get(swap*4+k + invPos)); inverse.put(swap*4+k + invPos, t); @@ -335,7 +335,7 @@ public class ProjectFloat { /** * Method gluOrtho2D. - * + * * @param left * @param right * @param bottom @@ -347,7 +347,7 @@ public class ProjectFloat { /** * Method gluPerspective. - * + * * @param fovy * @param aspect * @param zNear @@ -380,7 +380,7 @@ public class ProjectFloat { /** * Method gluLookAt - * + * * @param eyex * @param eyey * @param eyez @@ -436,7 +436,7 @@ public class ProjectFloat { /** * Map object coordinates to window coordinates. - * + * * @param objx * @param objy * @param objz @@ -444,7 +444,7 @@ public class ProjectFloat { * @param projMatrix * @param viewport * @param win_pos - * + * * @return */ public boolean gluProject(float objx, float objy, float objz, @@ -518,13 +518,13 @@ public class ProjectFloat { win_pos[0+win_pos_offset] = in[0] * viewport[2+viewport_offset] + viewport[0+viewport_offset]; win_pos[1+win_pos_offset] = in[1] * viewport[3+viewport_offset] + viewport[1+viewport_offset]; win_pos[2+win_pos_offset] = in[2]; - + return true; } - + /** * Map object coordinates to window coordinates. - * + * * @param objx * @param objy * @param objz @@ -532,7 +532,7 @@ public class ProjectFloat { * @param projMatrix * @param viewport * @param win_pos - * + * * @return */ public boolean gluProject(float objx, float objy, float objz, @@ -576,7 +576,7 @@ public class ProjectFloat { /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -584,7 +584,7 @@ public class ProjectFloat { * @param projMatrix * @param viewport * @param obj_pos - * + * * @return */ public boolean gluUnProject(float winx, float winy, float winz, @@ -633,7 +633,7 @@ public class ProjectFloat { /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -646,7 +646,7 @@ public class ProjectFloat { * @return */ public boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, + FloatBuffer modelMatrix, FloatBuffer projMatrix, int[] viewport, int viewport_offset, float[] obj_pos, int obj_pos_offset) { @@ -674,7 +674,7 @@ public class ProjectFloat { in[2] = in[2] * 2 - 1; FloatUtil.multMatrixVecf(matrixBuf, in, out); - + if (out[3] == 0.0) { return false; } @@ -687,10 +687,10 @@ public class ProjectFloat { return true; } - + /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -698,11 +698,11 @@ public class ProjectFloat { * @param projMatrix * @param viewport * @param obj_pos - * + * * @return */ public boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, + FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer obj_pos) { @@ -722,7 +722,7 @@ public class ProjectFloat { // Map x and y from window coordinates final int vPos = viewport.position(); - final int oPos = obj_pos.position(); + final int oPos = obj_pos.position(); in[0] = (in[0] - viewport.get(0+vPos)) / viewport.get(2+vPos); in[1] = (in[1] - viewport.get(1+vPos)) / viewport.get(3+vPos); @@ -749,7 +749,7 @@ public class ProjectFloat { /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -760,7 +760,7 @@ public class ProjectFloat { * @param near * @param far * @param obj_pos - * + * * @return */ public boolean gluUnProject4(float winx, @@ -815,7 +815,7 @@ public class ProjectFloat { /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -826,7 +826,7 @@ public class ProjectFloat { * @param near * @param far * @param obj_pos - * + * * @return */ public boolean gluUnProject4(float winx, @@ -857,7 +857,7 @@ public class ProjectFloat { in[0] = (in[0] - viewport.get(0+vPos)) / viewport.get(2+vPos); in[1] = (in[1] - viewport.get(1+vPos)) / viewport.get(3+vPos); in[2] = (in[2] - near) / (far - near); - + // Map to range -1 to 1 in[0] = in[0] * 2 - 1; in[1] = in[1] * 2 - 1; @@ -873,14 +873,14 @@ public class ProjectFloat { obj_pos.put(0+oPos, out[0]); obj_pos.put(1+oPos, out[1]); obj_pos.put(2+oPos, out[2]); - obj_pos.put(3+oPos, out[3]); + obj_pos.put(3+oPos, out[3]); return true; } /** * Method gluPickMatrix - * + * * @param x * @param y * @param deltaX @@ -907,7 +907,7 @@ public class ProjectFloat { /** * Method gluPickMatrix - * + * * @param x * @param y * @param deltaX diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index e5f5ee09a..eddb36975 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -52,30 +52,30 @@ public class SharedResourceRunner implements Runnable { * <p> * Called within synchronized block. * </p> - * @param connection for creation a {@link AbstractGraphicsDevice} instance. - * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>. + * @param connection for creation a {@link AbstractGraphicsDevice} instance. + * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>. */ boolean isDeviceSupported(String connection); - + /** * <p> * Called within synchronized block. * </p> - * @param connection for creation a {@link AbstractGraphicsDevice} instance. - * @return A new shared resource instance + * @param connection for creation a {@link AbstractGraphicsDevice} instance. + * @return A new shared resource instance */ Resource createSharedResource(String connection); - - /** Called within synchronized block. */ + + /** Called within synchronized block. */ void releaseSharedResource(Resource shared); - /** Called within synchronized block. */ + /** Called within synchronized block. */ void clear(); - /** Called within synchronized block. */ + /** Called within synchronized block. */ Resource mapPut(String connection, Resource resource); - /** Called within synchronized block. */ + /** Called within synchronized block. */ Resource mapGet(String connection); - /** Called within synchronized block. */ + /** Called within synchronized block. */ Collection<Resource> mapValues(); } @@ -103,7 +103,7 @@ public class SharedResourceRunner implements Runnable { this.impl = impl; resetState(); } - + private void resetState() { // synchronized call devicesTried.clear(); thread = null; @@ -114,12 +114,12 @@ public class SharedResourceRunner implements Runnable { releaseConnection = null; } - /** + /** * Start the shared resource runner thread, if not running. * <p> * Validate the thread upfront and release all related resource if it was killed. * </p> - * + * * @return the shared resource runner thread. */ public Thread start() { @@ -132,7 +132,7 @@ public class SharedResourceRunner implements Runnable { releaseSharedResources(); thread = null; running = false; - } + } if( null == thread ) { if (DEBUG) { System.err.println("SharedResourceRunner.start() - start new Thread - "+getThreadName()); @@ -150,7 +150,7 @@ public class SharedResourceRunner implements Runnable { } return thread; } - + public void stop() { synchronized (this) { if(null != thread) { @@ -160,7 +160,7 @@ public class SharedResourceRunner implements Runnable { synchronized (this) { shouldRelease = true; this.notifyAll(); - + while (running) { try { this.wait(); @@ -170,7 +170,7 @@ public class SharedResourceRunner implements Runnable { } } } - + public SharedResourceRunner.Resource getOrCreateShared(AbstractGraphicsDevice device) { SharedResourceRunner.Resource sr = null; if(null != device) { @@ -203,7 +203,7 @@ public class SharedResourceRunner implements Runnable { if(null != device) { synchronized (this) { final String connection = device.getConnection(); - sr = impl.mapGet(connection); + sr = impl.mapGet(connection); if (null != sr) { removeDeviceTried(connection); if (DEBUG) { @@ -261,7 +261,7 @@ public class SharedResourceRunner implements Runnable { synchronized (this) { running = true; - + while (!shouldRelease) { try { // wait for stop or init @@ -271,7 +271,7 @@ public class SharedResourceRunner implements Runnable { } notifyAll(); this.wait(); - } catch (InterruptedException ex) { + } catch (InterruptedException ex) { shouldRelease = true; if(DEBUG) { System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+threadName); @@ -311,7 +311,7 @@ public class SharedResourceRunner implements Runnable { } catch (Exception e) { e.printStackTrace(); } - } + } } } initConnection = null; diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java index d55a2c976..6ffe46b36 100644 --- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java +++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,7 +29,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * */ package jogamp.opengl; @@ -49,14 +49,14 @@ import com.jogamp.common.util.ReflectionUtil; public class ThreadingImpl { public enum Mode { - MT(0), ST_AWT(1), ST_WORKER(2); - + MT(0), ST_AWT(1), ST_WORKER(2); + public final int id; Mode(int id){ this.id = id; } - } + } protected static final boolean DEBUG = Debug.debug("Threading"); @@ -68,7 +68,7 @@ public class ThreadingImpl { private static boolean _isX11; private static final ToolkitThreadingPlugin threadingPlugin; - + static { threadingPlugin = AccessController.doPrivileged(new PrivilegedAction<ToolkitThreadingPlugin>() { @@ -94,7 +94,7 @@ public class ThreadingImpl { // default setting singleThreaded = true; mode = ( hasAWT ? Mode.ST_AWT : Mode.ST_WORKER ); - + if (singleThreadProp != null) { if (singleThreadProp.equals("true") || singleThreadProp.equals("auto")) { @@ -113,7 +113,7 @@ public class ThreadingImpl { throw new RuntimeException("Unsupported value for property jogl.1thread: "+singleThreadProp+", should be [true/auto, worker, awt or false]"); } } - + ToolkitThreadingPlugin threadingPlugin=null; if(hasAWT) { // try to fetch the AWTThreadingPlugin @@ -139,9 +139,9 @@ public class ThreadingImpl { public static boolean isX11() { return _isX11; } public static Mode getMode() { return mode; } - /** If an implementation of the javax.media.opengl APIs offers a - multithreading option but the default behavior is single-threading, - this API provides a mechanism for end users to disable single-threading + /** If an implementation of the javax.media.opengl APIs offers a + multithreading option but the default behavior is single-threading, + this API provides a mechanism for end users to disable single-threading in this implementation. Users are strongly discouraged from calling this method unless they are aware of all of the consequences and are prepared to enforce some amount of @@ -151,7 +151,7 @@ public class ThreadingImpl { GLPbuffer. Currently there is no supported way to re-enable it once disabled, partly to discourage careless use of this method. This method should be called as early as possible in an - application. */ + application. */ public static final void disableSingleThreading() { singleThreaded = false; if (Debug.verbose()) { @@ -183,7 +183,7 @@ public class ThreadingImpl { throw new InternalError("Illegal single-threading mode " + mode); } } - + public static final boolean isToolkitThread() throws GLException { if(null!=threadingPlugin) { return threadingPlugin.isToolkitThread(); @@ -215,7 +215,7 @@ public class ThreadingImpl { throw new InternalError("Illegal single-threading mode " + mode); } } - + public static final void invokeOnWorkerThread(boolean wait, Runnable r) throws GLException { GLWorkerThread.start(); // singleton start via volatile-dbl-checked-locking try { @@ -224,6 +224,6 @@ public class ThreadingImpl { throw new GLException(e.getTargetException()); } catch (InterruptedException e) { throw new GLException(e); - } + } } } diff --git a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java index 22972953a..06fb0fe91 100644 --- a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2012 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -46,7 +46,7 @@ public interface ToolkitThreadingPlugin { /** Indicates whether the current thread is the designated toolkit thread, if such semantics exists. */ public boolean isToolkitThread() throws GLException; - + /** Indicates whether the current thread is the thread on which this implementation of the javax.media.opengl APIs performs all of its OpenGL-related work. This method should only diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java index 56f00b370..cd1bb45c9 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -57,7 +57,7 @@ public class AWTThreadingPlugin implements ToolkitThreadingPlugin { public final boolean isToolkitThread() throws GLException { return EventQueue.isDispatchThread(); } - + public final boolean isOpenGLThread() throws GLException { switch (ThreadingImpl.getMode()) { case ST_AWT: diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index 9bdceff48..5faee1307 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -67,19 +67,19 @@ import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider; */ public class AWTTilePainter { private static final boolean DEBUG_TILES = Debug.debug("TileRenderer.PNG"); - + public final TileRenderer renderer; public final int componentCount; public final double scaleMatX, scaleMatY; public final int customTileWidth, customTileHeight, customNumSamples; public final boolean verbose; - + public boolean flipVertical; private AWTGLPixelBuffer tBuffer = null; private BufferedImage vFlipImage = null; private Graphics2D g2d = null; - private AffineTransform saveAT = null; - + private AffineTransform saveAT = null; + public static void dumpHintsAndScale(Graphics2D g2d) { final RenderingHints rHints = g2d.getRenderingHints(); final Set<Entry<Object, Object>> rEntries = rHints.entrySet(); @@ -92,13 +92,13 @@ public class AWTTilePainter { if( null != aTrans ) { System.err.println(" type "+aTrans.getType()); System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY()); - System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY()); + System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY()); System.err.println(" mat "+aTrans); } else { System.err.println(" null transform"); } } - + /** * @return resulting number of samples by comparing w/ {@link #customNumSamples} and the caps-config, 0 if disabled */ @@ -114,12 +114,12 @@ public class AWTTilePainter { return caps.getNumSamples(); } } - - /** + + /** * Assumes a configured {@link TileRenderer}, i.e. * an {@link TileRenderer#attachAutoDrawable(GLAutoDrawable) attached} * {@link GLAutoDrawable} with {@link TileRenderer#setTileSize(int, int, int) set tile size}. - * <p> + * <p> * Sets the renderer to {@link TileRenderer#TR_TOP_TO_BOTTOM} row order. * </p> * <p> @@ -129,7 +129,7 @@ public class AWTTilePainter { * @param componentCount * @param scaleMatX {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatX * width pixels * @param scaleMatY {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatY * height pixels - * @param numSamples custom multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples custom multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param verbose @@ -146,13 +146,13 @@ public class AWTTilePainter { this.verbose = verbose; this.flipVertical = true; } - + public String toString() { return renderer.toString(); } - + public void setIsGLOriented(boolean v) { flipVertical = v; } - + private static Rectangle2D getClipBounds2D(Graphics2D g) { final Shape shape = g.getClip(); return null != shape ? shape.getBounds2D() : null; @@ -170,7 +170,7 @@ public class AWTTilePainter { } return new Rectangle2D.Double(x, y, width, height); } - + /** * Caches the {@link Graphics2D} instance for rendering. * <p> @@ -201,9 +201,9 @@ public class AWTTilePainter { final Rectangle2D dClipOrigR = getClipBounds2D(g2d); final Rectangle2D dClipOrig = clipNegative(dClipOrigR); final Rectangle2D dImageSizeOrig = new Rectangle2D.Double(0, 0, width, height); - + // Retrieve scaled image-size and clip-bounds - // Note: Clip bounds lie within image-size! + // Note: Clip bounds lie within image-size! final Rectangle2D dImageSizeScaled, dClipScaled; { final AffineTransform scaledATI; @@ -230,10 +230,10 @@ public class AWTTilePainter { // GL y-offset is lower-left origin, AWT y-offset upper-left. scaledYOffset = iClipScaled.y; renderer.setTileOffset(iClipScaled.x, iImageSizeScaled.height - ( iClipScaled.y + clipH )); - + // Scale actual Grahics2D matrix g2d.scale(scaleMatX, scaleMatY); - + if( verbose ) { System.err.println("AWT print.0: image "+dImageSizeOrig + " -> " + dImageSizeScaled + " -> " + iImageSizeScaled); System.err.println("AWT print.0: clip "+dClipOrigR + " -> " + dClipOrig + " -> " + dClipScaled + " -> " + iClipScaled); @@ -241,12 +241,12 @@ public class AWTTilePainter { } } private int scaledYOffset; - + /** See {@ #setupGraphics2DAndClipBounds(Graphics2D)}. */ - public void resetGraphics2D() { + public void resetGraphics2D() { g2d.setTransform(saveAT); } - + /** * Disposes resources and {@link TileRenderer#detachAutoDrawable() detaches} * the {@link TileRenderer}'s {@link GLAutoDrawable}. @@ -263,7 +263,7 @@ public class AWTTilePainter { vFlipImage = null; } } - + final GLEventListener preTileGLEL = new GLEventListener() { @Override public void init(GLAutoDrawable drawable) {} @@ -275,7 +275,7 @@ public class AWTTilePainter { if( null == tBuffer ) { final int tWidth = renderer.getParam(TileRenderer.TR_TILE_WIDTH); final int tHeight = renderer.getParam(TileRenderer.TR_TILE_HEIGHT); - final AWTGLPixelBufferProvider printBufferProvider = new AWTGLPixelBufferProvider( true /* allowRowStride */ ); + final AWTGLPixelBufferProvider printBufferProvider = new AWTGLPixelBufferProvider( true /* allowRowStride */ ); final GLPixelAttributes pixelAttribs = printBufferProvider.getAttributes(gl, componentCount); tBuffer = printBufferProvider.allocate(gl, pixelAttribs, tWidth, tHeight, 1, true, 0); renderer.setTileBuffer(tBuffer); @@ -300,7 +300,7 @@ public class AWTTilePainter { @Override public void dispose(GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(GLAutoDrawable drawable) { final DimensionImmutable cis = renderer.getClippedImageSize(); final int tWidth = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH); final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT); @@ -309,26 +309,26 @@ public class AWTTilePainter { final int imgYOff = flipVertical ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image final int pX = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); // tileX == pX final int pY = cis.getHeight() - ( tY - tYOff + tHeight ) + scaledYOffset; - + // Copy temporary data into raster of BufferedImage for faster // blitting Note that we could avoid this copy in the cases // where !offscreenDrawable.isGLOriented(), // but that's the software rendering path which is very slow anyway. final BufferedImage dstImage; if( DEBUG_TILES ) { - final String fname = String.format("file_%03d_0_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png", - _counter, + final String fname = String.format("file_%03d_0_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png", + _counter, renderer.getParam(TileRenderer.TR_CURRENT_COLUMN), renderer.getParam(TileRenderer.TR_CURRENT_ROW), tWidth, tHeight, pX, tY, tYOff, pX, pY).replace(' ', '_'); System.err.println("XXX file "+fname); - final File fout = new File(fname); + final File fout = new File(fname); try { ImageIO.write(tBuffer.image, "png", fout); } catch (IOException e) { e.printStackTrace(); } - } + } if( flipVertical ) { final BufferedImage srcImage = tBuffer.image; dstImage = vFlipImage; @@ -347,20 +347,20 @@ public class AWTTilePainter { dstImage = tBuffer.image; } if( DEBUG_TILES ) { - final String fname = String.format("file_%03d_1_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png", - _counter, + final String fname = String.format("file_%03d_1_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png", + _counter, renderer.getParam(TileRenderer.TR_CURRENT_COLUMN), renderer.getParam(TileRenderer.TR_CURRENT_ROW), tWidth, tHeight, pX, tY, tYOff, pX, pY).replace(' ', '_'); System.err.println("XXX file "+fname); - final File fout = new File(fname); + final File fout = new File(fname); try { ImageIO.write(dstImage, "png", fout); } catch (IOException e) { e.printStackTrace(); } _counter++; - } + } // Draw resulting image in one shot final BufferedImage outImage = dstImage.getSubimage(0, imgYOff, tWidth, tHeight); final boolean drawDone = g2d.drawImage(outImage, pX, pY, null); // Null ImageObserver since image data is ready. diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java index e15e538c2..dc286ca59 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,7 +29,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -85,7 +85,7 @@ public class AWTUtil { NativeWindowFactory.getAWTToolkitLock().lock(); } } catch (Exception e) { j2dOk=false; } - } + } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().lock(); } @@ -108,7 +108,7 @@ public class AWTUtil { NativeWindowFactory.getAWTToolkitLock().unlock(); } } catch (Exception e) { j2dOk=false; } - } + } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().unlock(); } diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index edf9e89f8..7a8ddf0b4 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -28,11 +28,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -144,7 +144,7 @@ public class Java2D { } else { if (DEBUG) { System.err.println("Java2D support disabled: by Property "+java2dOGLDisabledByProp+", by OS "+java2dOGLDisabledByOS); - } + } cfg = null; cfgName = "nil"; } @@ -154,8 +154,8 @@ public class Java2D { System.err.println("Java2D support: default GraphicsConfiguration = " + cfgName); } isOGLPipelineActive = cfgName.startsWith("sun.java2d.opengl"); - isOGLPipelineResourceCompatible = isOGLPipelineActive; - + isOGLPipelineResourceCompatible = isOGLPipelineActive; + if (isOGLPipelineActive) { try { // Try to get methods we need to integrate @@ -179,19 +179,19 @@ public class Java2D { Integer.TYPE }); getOGLViewportMethod.setAccessible(true); - + getOGLScissorBoxMethod = utils.getDeclaredMethod("getOGLScissorBox", new Class[] { Graphics.class }); getOGLScissorBoxMethod.setAccessible(true); - + getOGLSurfaceIdentifierMethod = utils.getDeclaredMethod("getOGLSurfaceIdentifier", new Class[] { Graphics.class }); getOGLSurfaceIdentifierMethod.setAccessible(true); - + // Try to get additional methods required for proper FBO support fbObjectSupportInitialized = true; try { @@ -201,7 +201,7 @@ public class Java2D { Runnable.class }); invokeWithOGLSharedContextCurrentMethod.setAccessible(true); - + getOGLSurfaceTypeMethod = utils.getDeclaredMethod("getOGLSurfaceType", new Class[] { Graphics.class @@ -214,7 +214,7 @@ public class Java2D { System.err.println("Info: Disabling Java2D/JOGL FBO support"); } } - + // Try to get an additional method for FBO support in recent Mustang builds try { getOGLTextureTypeMethod = utils.getDeclaredMethod("getOGLTextureType", @@ -228,7 +228,7 @@ public class Java2D { System.err.println("Info: GL_ARB_texture_rectangle FBO support disabled"); } } - + // Try to set up APIs for enabling the bridge on OS X, // where it isn't possible to create generalized // external GLDrawables @@ -244,7 +244,7 @@ public class Java2D { if (cglSurfaceData != null) { // FIXME: for now, assume that FBO support is not enabled on OS X fbObjectSupportInitialized = false; - + // We need to find these methods in order to make the bridge work on OS X createOGLContextOnSurfaceMethod = cglSurfaceData.getDeclaredMethod("createOGLContextOnSurface", new Class[] { @@ -252,14 +252,14 @@ public class Java2D { Long.TYPE }); createOGLContextOnSurfaceMethod.setAccessible(true); - + makeOGLContextCurrentOnSurfaceMethod = cglSurfaceData.getDeclaredMethod("makeOGLContextCurrentOnSurface", new Class[] { Graphics.class, Long.TYPE }); makeOGLContextCurrentOnSurfaceMethod.setAccessible(true); - + destroyOGLContextMethod = cglSurfaceData.getDeclaredMethod("destroyOGLContext", new Class[] { Long.TYPE @@ -273,7 +273,7 @@ public class Java2D { System.err.println("Info: Disabling Java2D/JOGL integration"); } isOGLPipelineActive = false; - isOGLPipelineResourceCompatible = false; + isOGLPipelineResourceCompatible = false; } } } catch (HeadlessException e) { @@ -297,7 +297,7 @@ public class Java2D { public static boolean isOGLPipelineActive() { return isOGLPipelineActive; } - + public static boolean isOGLPipelineResourceCompatible() { return isOGLPipelineResourceCompatible; } @@ -317,7 +317,7 @@ public class Java2D { throw (InternalError) new InternalError().initCause(e); } } - + /** Makes current the OpenGL context associated with the passed Graphics object and runs the given Runnable on the Queue Flushing Thread in one atomic action. */ @@ -556,7 +556,7 @@ public class Java2D { throw new GLException("Java2D OpenGL pipeline not active"); } } - + private static void checkCompatible() { if ( !isOGLPipelineResourceCompatible() ) { throw new GLException("Java2D OpenGL pipeline not resource compatible"); diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java index 55fb3f9a2..a29d1e6aa 100644 --- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java +++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java @@ -42,7 +42,7 @@ public class VersionApplet extends Applet { va.init(); frame.add(va, BorderLayout.CENTER); frame.validate(); - + frame.setVisible(true); va.start(); } @@ -68,7 +68,7 @@ public class VersionApplet extends Applet { if(null != canvas) { return; } setEnabled(true); - + GLProfile glp = GLProfile.getDefault(); GLCapabilities glcaps = new GLCapabilities(glp); @@ -87,7 +87,7 @@ public class VersionApplet extends Applet { /* s = NativeWindowVersion.getInstance().toString(); System.err.println(s); - tareaVersion.append(NativeWindowVersion.getInstance().toString()); + tareaVersion.append(NativeWindowVersion.getInstance().toString()); */ s = JoglVersion.getInstance().toString(); diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java index 3d59d1d53..1179e2b7f 100644 --- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; @@ -60,12 +60,12 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu public final boolean useToolGetProcAdressFirst(String funcName) { return true; } - + public final List<List<String>> getToolLibNames() { final List<List<String>> libsList = new ArrayList<List<String>>(); final List<String> libsGL = new ArrayList<String>(); - - // Be aware that on DRI systems, eg ATI fglrx, etc, + + // Be aware that on DRI systems, eg ATI fglrx, etc, // you have to set LIBGL_DRIVERS_PATH env variable. // Eg on Ubuntu 64bit systems this is: // export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri @@ -82,15 +82,15 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu // OSX (guess ES2 on OSX will never happen) libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); - + // last but not least .. the generic one libsGL.add("GL"); - + libsList.add(libsGL); return libsList; - } - + } + public final List<String> getGlueLibNames() { return glueLibNames; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 179cb7504..3de910369 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -115,7 +115,7 @@ public class EGLContext extends GLContextImpl { if (EGL.eglGetCurrentContext() != contextHandle) { final long dpy = drawable.getNativeSurface().getDisplayHandle(); if (!EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + + throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + " with display " + toHexString(dpy) + ", drawableWrite " + toHexString(drawable.getHandle()) + @@ -128,7 +128,7 @@ public class EGLContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { if (!EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT)) { - throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) + + throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) + ": error code " + toHexString(EGL.eglGetError())); } } @@ -138,7 +138,7 @@ public class EGLContext extends GLContextImpl { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ - throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) + + throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) + ": error code " + toHexString(eglError)); } } @@ -285,11 +285,11 @@ public class EGLContext extends GLContextImpl { // // Accessible .. // - + /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } - /* pp */ int getContextOptions() { return ctxOptions; } + /* pp */ int getContextOptions() { return ctxOptions; } /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; @@ -305,7 +305,7 @@ public class EGLContext extends GLContextImpl { reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT; } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); - } + } /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, final int major) { int ctp = GLContext.CTX_PROFILE_ES; if( major >= 3 ) { @@ -324,20 +324,20 @@ public class EGLContext extends GLContextImpl { if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp); - } + } } } protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } - + protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { GLContext.setAvailableGLVersionsSet(device); } - + protected static String toHexString(int hex) { return GLContext.toHexString(hex); } @@ -358,7 +358,7 @@ public class EGLContext extends GLContextImpl { public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { throw new GLException("Should not call this"); } - + @Override public final void glFreeMemoryNV(ByteBuffer pointer) { throw new GLException("Should not call this"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index f2efb0479..89f34432d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -41,8 +41,8 @@ import jogamp.opengl.Debug; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; -/** - * This implementation provides recursive calls to +/** + * This implementation provides recursive calls to * {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} and {@link EGL#eglTerminate(long)}, * where <code>eglInitialize(..)</code> is issued only for the 1st call per <code>eglDisplay</code> * and <code>eglTerminate(..)</code> is issued only for the last call. @@ -53,30 +53,30 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; */ public class EGLDisplayUtil { protected static final boolean DEBUG = Debug.debug("EGLDisplayUtil"); - + private static class DpyCounter { final long eglDisplay; final Throwable createdStack; int refCount; - + private DpyCounter(long eglDisplay) { this.eglDisplay = eglDisplay; this.refCount = 0; this.createdStack = DEBUG ? new Throwable() : null; } - + public String toString() { return "EGLDisplay[0x"+Long.toHexString(eglDisplay)+": refCnt "+refCount+"]"; } } static final LongObjectHashMap eglDisplayCounter; - + static { eglDisplayCounter = new LongObjectHashMap(); eglDisplayCounter.setKeyNotFoundValue(null); } - /** + /** * @return number of unclosed EGL Displays.<br> */ public static int shutdown(boolean verbose) { @@ -91,7 +91,7 @@ public class EGLDisplayUtil { } return eglDisplayCounter.size(); } - + public static void dumpOpenDisplayConnections() { System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+eglDisplayCounter.size()); int i=0; @@ -104,7 +104,7 @@ public class EGLDisplayUtil { } } } - + public static long eglGetDisplay(long nativeDisplay_id) { final long eglDisplay = EGL.eglGetDisplay(nativeDisplay_id); if(DEBUG) { @@ -114,16 +114,16 @@ public class EGLDisplayUtil { } return eglDisplay; } - + /** * @param eglDisplay * @param major * @param minor * @return true if the eglDisplay is valid and it's reference counter becomes one and {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} was successful, otherwise false - * + * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { + public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -157,16 +157,16 @@ public class EGLDisplayUtil { } return res; } - + /** * @param nativeDisplayID * @param eglDisplay array of size 1 holding return value if successful, otherwise {@link EGL#EGL_NO_DISPLAY}. - * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful. + * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful. * @param major * @param minor - * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed + * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed * or {@link EGL#EGL_NOT_INITIALIZED} if {@link #eglInitialize(long, IntBuffer, IntBuffer)} failed. - * + * * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ @@ -184,7 +184,7 @@ public class EGLDisplayUtil { eglDisplay[0] = _eglDisplay; return EGL.EGL_SUCCESS; } - + /** * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle * @return the initialized EGL display ID @@ -209,7 +209,7 @@ public class EGLDisplayUtil { } throw new GLException("Failed to created/initialize EGL display incl. fallback default: native "+EGLContext.toHexString(nativeDisplayID[0])+", error "+EGLContext.toHexString(eglRes)+"/"+EGLContext.toHexString(eglError[0])); } - + /** * @param eglDisplay the EGL display handle * @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false @@ -218,7 +218,7 @@ public class EGLDisplayUtil { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } - final boolean res; + final boolean res; final int refCnt; final DpyCounter d; { @@ -237,7 +237,7 @@ public class EGLDisplayUtil { } else { if(0 < refCnt) { // no negative refCount d.refCount = refCnt; - } + } res = true; } if(DEBUG) { @@ -246,7 +246,7 @@ public class EGLDisplayUtil { } return res; } - + public static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { public long eglGetAndInitDisplay(long[] nativeDisplayID) { return eglGetDisplayAndInitialize(nativeDisplayID); @@ -255,25 +255,25 @@ public class EGLDisplayUtil { EGLDisplayUtil.eglTerminate(eglDisplayHandle); } }; - + /** * @param nativeDisplayID * @param connection * @param unitID - * @return an initialized EGLGraphicsDevice + * @return an initialized EGLGraphicsDevice * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails - * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback) + * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback) */ public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) { final EGLGraphicsDevice eglDisplay = new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback); eglDisplay.open(); return eglDisplay; } - + /** * @param surface - * @return an initialized EGLGraphicsDevice - * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback + * @return an initialized EGLGraphicsDevice + * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback */ public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) { final long nativeDisplayID; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 2edf26145..bf269c548 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -59,15 +59,15 @@ public abstract class EGLDrawable extends GLDrawableImpl { @Override public abstract GLContext createContext(GLContext shareWith); - protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle); + protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle); private final long createEGLSurface() { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; - final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); + final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); final NativeSurface upstreamSurface = eglws.getUpstreamSurface(); - + long eglSurface = createSurface(eglConfig, eglws.getWidth(), eglws.getHeight(), upstreamSurface.getSurfaceHandle()); - + int eglError0; if (EGL.EGL_NO_SURFACE == eglSurface) { eglError0 = EGL.eglGetError(); @@ -104,7 +104,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; if(DEBUG) { System.err.println(getThreadName() + ": createHandle of "+eglws); - } + } if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { if( EGL.EGL_NO_SURFACE != eglws.getSurfaceHandle() ) { throw new InternalError("Set surface but claimed to be invalid: "+eglws); @@ -114,12 +114,12 @@ public abstract class EGLDrawable extends GLDrawableImpl { throw new InternalError("Nil surface but claimed to be valid: "+eglws); } } - - protected void destroyHandle() { + + protected void destroyHandle() { final EGLWrappedSurface eglws = (EGLWrappedSurface) surface; if(DEBUG) { System.err.println(getThreadName() + ": destroyHandle of "+eglws); - } + } if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) { throw new InternalError("Nil surface but claimed to be valid: "+eglws); } @@ -134,7 +134,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { if( 0 == surfaceHandle ) { return false; } - final IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, surfaceHandle, EGL.EGL_CONFIG_ID, val); if( !eglSurfaceValid ) { final int eglErr = EGL.eglGetError(); @@ -144,7 +144,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } return eglSurfaceValid; } - + @Override protected final void setRealizedImpl() { if(DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 5d99e3eba..a0d896e3a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -83,14 +83,14 @@ import com.jogamp.opengl.GLRendererQuirks; public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access - + /* package */ static final boolean QUERY_EGL_ES_NATIVE_TK; - + static { Debug.initSingleton(); QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } - + private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; @@ -109,7 +109,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { dl.isFunctionAvailable("glEnableClientState") && dl.isFunctionAvailable("glColorPointer"); } - + public EGLDrawableFactory() { super(); @@ -189,10 +189,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { if( isANGLE && ( DEBUG || GLProfile.DEBUG ) ) { System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE enabled"); - } + } sharedMap = new HashMap<String /*uniqueKey*/, SharedResource>(); sharedMapCreateAttempt = new HashSet<String>(); - + // FIXME: Following triggers eglInitialize(..) which crashed on Windows w/ Chrome/Angle, FF/Angle! defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); } @@ -204,8 +204,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected final boolean isComplete() { return null != sharedMap; // null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper; } - - + + @Override protected final void destroy() { if(null != sharedMap) { @@ -247,7 +247,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGLGraphicsConfigurationFactory.unregisterFactory(); EGLDisplayUtil.shutdown(DEBUG); } - + private void dumpMap() { synchronized(sharedMap) { System.err.println("EGLDrawableFactory.map "+sharedMap.size()); @@ -265,7 +265,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } private HashMap<String /*uniqueKey*/, SharedResource> sharedMap = null; - private HashSet<String> sharedMapCreateAttempt = null; + private HashSet<String> sharedMapCreateAttempt = null; private EGLGraphicsDevice defaultDevice = null; private SharedResource defaultSharedResource = null; private boolean isANGLE = false; @@ -286,9 +286,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private final boolean hasPBufferES1; private final boolean hasPBufferES3ES2; - SharedResource(EGLGraphicsDevice dev, - boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, - boolean wasContextES2Created, boolean wasContextES3Created, + SharedResource(EGLGraphicsDevice dev, + boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, + boolean wasContextES2Created, boolean wasContextES3Created, boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) { this.device = dev; // this.contextES1 = ctxES1; @@ -296,7 +296,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { this.hasPBufferES1= hasPBufferES1; this.rendererQuirksES1 = rendererQuirksES1; this.ctpES1 = ctpES1; - + // this.contextES2 = ctxES2; // this.contextES3 = ctxES3; this.wasES2ContextCreated = wasContextES2Created; @@ -314,7 +314,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // final EGLContext getContextES1() { return contextES1; } // final EGLContext getContextES2() { return contextES2; } // final EGLContext getContextES3() { return contextES3; } - + @Override public AbstractGraphicsScreen getScreen() { return null; @@ -329,7 +329,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override public GLRendererQuirks getRendererQuirks() { - return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ; + return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ; } } @@ -359,18 +359,18 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return new ArrayList<GLCapabilitiesImmutable>(0); } - - private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile, + + private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile, boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) { final String profileString; switch( esProfile ) { case 3: - profileString = GLProfile.GLES3; break; + profileString = GLProfile.GLES3; break; case 2: - profileString = GLProfile.GLES2; break; - case 1: + profileString = GLProfile.GLES2; break; + case 1: profileString = GLProfile.GLES1; break; - default: + default: throw new GLException("Invalid ES profile number "+esProfile); } if ( !GLProfile.isAvailable(adevice, profileString) ) { @@ -394,23 +394,23 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { ProxySurface upstreamSurface = null; // X11, GLX, .. boolean success = false; boolean deviceFromUpstreamSurface = false; - try { + try { final GLCapabilities reqCapsAny = new GLCapabilities(glp); reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0); reqCapsAny.setDoubleBuffered(false); - + if( mapsADeviceToDefaultDevice ) { // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior). - // Only one default shared resource instance is ever be created. + // Only one default shared resource instance is ever be created. final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny); final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(defaultDevice, reqCapsPBuffer); hasPBuffer[0] = availablePBufferCapsL.size() > 0; - + // 1st case: adevice is not the EGL default device, map default shared resources if( adevice != defaultDevice ) { if(null == defaultSharedResource) { return false; - } + } switch(esProfile) { case 3: if( !defaultSharedResource.wasES3ContextCreated ) { @@ -419,14 +419,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; ctp[0] = defaultSharedResource.ctpES3ES2; break; - case 2: + case 2: if( !defaultSharedResource.wasES2ContextCreated ) { return false; } rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2; ctp[0] = defaultSharedResource.ctpES3ES2; break; - case 1: + case 1: if( !defaultSharedResource.wasES1ContextCreated ) { return false; } @@ -437,11 +437,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { EGLContext.mapStaticGLVersion(adevice, esProfile, 0, ctp[0]); return true; } - + // attempt to created the default shared resources .. - + eglDevice = defaultDevice; // reuse - + if( hasPBuffer[0] ) { // 2nd case create defaultDevice shared resource using pbuffer surface surface = createDummySurfaceImpl(eglDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen @@ -459,15 +459,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(DEBUG) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success); EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err); - } - } + } + } } else { - // 4th case always creates a true mapping of given device to EGL + // 4th case always creates a true mapping of given device to EGL surface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window upstreamSurface = ( surface instanceof ProxySurface ) ? (ProxySurface)surface : null ; if(null != upstreamSurface) { upstreamSurface.createNotify(); - } + } eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(surface); deviceFromUpstreamSurface = true; hasPBuffer[0] = true; @@ -482,7 +482,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { context.makeCurrent(); // could cause exception if(context.isCurrent()) { final String glVersion = context.getGL().glGetString(GL.GL_VERSION); - if(null != glVersion) { + if(null != glVersion) { context.mapCurrentAvailableGLVersion(eglDevice); if(eglDevice != adevice) { context.mapCurrentAvailableGLVersion(adevice); @@ -493,7 +493,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { // Oops .. something is wrong if(DEBUG) { - System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!"); + System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!"); } } } @@ -510,7 +510,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } catch (Throwable t) { if(DEBUG) { - System.err.println("Catched Exception on thread "+getThreadName()); + System.err.println("Catched Exception on thread "+getThreadName()); t.printStackTrace(); } success = false; @@ -518,7 +518,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(eglDevice == defaultDevice) { if(null != upstreamSurface) { upstreamSurface.destroyNotify(); - } + } } else if( deviceFromUpstreamSurface ) { if(null != eglDevice) { eglDevice.close(); @@ -529,7 +529,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } else { if(null != upstreamSurface) { upstreamSurface.destroyNotify(); - } + } if(null != eglDevice) { eglDevice.close(); } @@ -553,9 +553,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return false; } - } + } } - + @Override protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper @@ -571,27 +571,27 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { dumpMap(); throw new InternalError("defaultSharedResource already exist: "+defaultSharedResource); } - defaultSharedResource = createEGLSharedResourceImpl(defaultDevice); + defaultSharedResource = createEGLSharedResourceImpl(defaultDevice); } - + final String key = adevice.getUniqueID(); if( defaultDevice.getUniqueID().equals(key) ) { return defaultSharedResource; } else { - if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device + if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device dumpMap(); - throw new InternalError("defaultSharedResource does not exist"); + throw new InternalError("defaultSharedResource does not exist"); } final SharedResource[] existing = new SharedResource[] { null }; if ( !needsToCreateSharedResource(key, existing) ) { return existing[0]; - } + } return createEGLSharedResourceImpl(adevice); } } - + private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) { - final boolean madeCurrentES1; + final boolean madeCurrentES1; final boolean madeCurrentES2; final boolean madeCurrentES3; boolean[] hasPBufferES1 = new boolean[] { false }; @@ -602,12 +602,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; int[] ctpES1 = new int[] { -1 }; int[] ctpES3ES2 = new int[] { -1 }; - - + + if (DEBUG) { System.err.println("EGLDrawableFactory.createShared(): device "+adevice); } - + if( null != eglES1DynamicLookupHelper ) { madeCurrentES1 = mapAvailableEGLESConfig(adevice, 1, hasPBufferES1, rendererQuirksES1, ctpES1); } else { @@ -625,10 +625,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { madeCurrentES2 = false; madeCurrentES3 = false; } - + if( !EGLContext.getAvailableGLVersionsSet(adevice) ) { // Even though we override the non EGL native mapping intentionally, - // avoid exception due to double 'set' - carefull exception of the rule. + // avoid exception due to double 'set' - carefull exception of the rule. EGLContext.setAvailableGLVersionsSet(adevice); } if( hasX11 ) { @@ -637,7 +637,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } final SharedResource sr = new SharedResource(defaultDevice, madeCurrentES1, hasPBufferES1[0], rendererQuirksES1[0], ctpES1[0], madeCurrentES2, madeCurrentES3, hasPBufferES3ES2[0], rendererQuirksES3ES2[0], ctpES3ES2[0]); - + synchronized(sharedMap) { sharedMap.put(adevice.getUniqueID(), sr); } @@ -650,7 +650,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return sr; } - + private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) { if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); @@ -692,7 +692,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target)); } - + @Override protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { if (target == null) { @@ -715,8 +715,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, + protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; @@ -732,21 +732,21 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final EGLGraphicsConfiguration config = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false); if(null == config) { - throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); - } + throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); + } return new WrappedSurface(config, 0, upstreamHook, ownDevice); } - + @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { - chosenCaps = GLGraphicsConfigurationUtil.fixOffscreenBitOnly(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above + chosenCaps = GLGraphicsConfigurationUtil.fixOffscreenBitOnly(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } - + /** - * @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface. - * It will also hold the resulting pbuffer surface handle. + * @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface. + * It will also hold the resulting pbuffer surface handle. * @param useTexture * @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle */ diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 162e7166a..eb6578ec5 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -9,17 +9,17 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** - * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, - * not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ public EGLDummyUpstreamSurfaceHook(int width, int height) { super(width, height); } - + @Override public final void create(ProxySurface s) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); @@ -31,14 +31,14 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) { s.setSurfaceHandle( EGLDrawableFactory.createPBufferSurfaceImpl((EGLGraphicsConfiguration)s.getGraphicsConfiguration(), 64, 64, false) ); - s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); } finally { eglDevice.unlock(); } } - + @Override public final void destroy(ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 778f0cb38..ac880ebc0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import com.jogamp.common.os.AndroidVersion; @@ -52,7 +52,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle super(); } - /** + /** * Returns <code>true</code> on <code>Android</code>, * and <code>false</code> otherwise. */ @@ -65,7 +65,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle // default behavior for other platforms return false; } - + @Override public final List<String> getToolGetProcAddressFuncNameList() { List<String> res = new ArrayList<String>(); @@ -87,26 +87,26 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle return true; } } - + protected final List<String> getEGLLibNamesList() { List<String> eglLibNames = new ArrayList<String>(); - - // this is the default EGL lib name, according to the spec + + // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); - + // try these as well, if spec fails eglLibNames.add("libEGL.so"); eglLibNames.add("EGL"); - - // for windows distributions using the 'unlike' lib prefix, + + // for windows distributions using the 'unlike' lib prefix, // where our tool does not add it. eglLibNames.add("libEGL"); - + return eglLibNames; } @Override public final List<String> getGlueLibNames() { return glueLibNames; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java index dd3d6faea..9ffcea864 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; @@ -39,29 +39,29 @@ public final class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl final List<List<String>> libsList = new ArrayList<List<String>>(); { final List<String> libsGL = new ArrayList<String>(); - - // this is the default lib name, according to the spec + + // this is the default lib name, according to the spec libsGL.add("libGLESv1_CM.so.2"); - + // try these as well, if spec fails libsGL.add("libGLESv1_CM.so"); - libsGL.add("GLESv1_CM"); + libsGL.add("GLESv1_CM"); // alternative names libsGL.add("GLES_CM"); libsGL.add("GLES_CL"); - - // for windows distributions using the 'unlike' lib prefix, + + // for windows distributions using the 'unlike' lib prefix, // where our tool does not add it. libsGL.add("libGLESv1_CM"); libsGL.add("libGLES_CM"); libsGL.add("libGLES_CL"); - + libsList.add(libsGL); } libsList.add(getEGLLibNamesList()); - + return libsList; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java index 0d20fd4e8..de1f0a42e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,17 +20,17 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.egl; import java.util.*; -/** +/** * <p> * Covering ES3 and ES2. * </p> @@ -44,12 +44,12 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl final List<List<String>> libsList = new ArrayList<List<String>>(); { final List<String> libsGL = new ArrayList<String>(); - - // ES3: This is the default lib name, according to the spec + + // ES3: This is the default lib name, according to the spec libsGL.add("libGLESv3.so.3"); - + // ES3: Try these as well, if spec fails - libsGL.add("libGLESv3.so"); + libsGL.add("libGLESv3.so"); libsGL.add("GLESv3"); // ES3: Alternative names @@ -59,12 +59,12 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl // where our tool does not add it. libsGL.add("libGLESv3"); libsGL.add("libGLES30"); - - // ES2: This is the default lib name, according to the spec + + // ES2: This is the default lib name, according to the spec libsGL.add("libGLESv2.so.2"); - + // ES2: Try these as well, if spec fails - libsGL.add("libGLESv2.so"); + libsGL.add("libGLESv2.so"); libsGL.add("GLESv2"); // ES2: Alternative names @@ -75,14 +75,14 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl // where our tool does not add it. libsGL.add("libGLESv2"); libsGL.add("libGLESv2_CM"); - libsGL.add("libGLES20"); - + libsGL.add("libGLES20"); + libsList.add(libsGL); } libsList.add(getEGLLibNamesList()); - + return libsList; - } - + } + } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index b1ffe608e..f3592c150 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,7 +29,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -57,7 +57,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - + public final long getNativeConfig() { return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfig(); } @@ -66,7 +66,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID(); } - EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, + EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { super(absScreen, capsChosen, capsRequested); this.chooser = chooser; @@ -77,7 +77,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @param absScreen * @param eglConfigID {@link EGL#EGL_CONFIG_ID} for which the config is being created for. * @return - * @throws GLException if invalid EGL display. + * @throws GLException if invalid EGL display. */ public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) { final AbstractGraphicsDevice absDevice = absScreen.getDevice(); @@ -101,9 +101,9 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple public Object clone() { return super.clone(); } - + void updateGraphicsConfiguration() { - CapabilitiesImmutable capsChosen = getChosenCapabilities(); + CapabilitiesImmutable capsChosen = getChosenCapabilities(); EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration( capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); @@ -140,7 +140,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return false; } final IntBuffer val = Buffers.newDirectIntBuffer(1); - + // get the configID if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) { final int eglErr = EGL.eglGetError(); @@ -169,7 +169,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } if ( 0 != ( _stype & EGL.EGL_PBUFFER_BIT ) ) { val |= GLGraphicsConfigurationUtil.PBUFFER_BIT | - GLGraphicsConfigurationUtil.FBO_BIT; + GLGraphicsConfigurationUtil.FBO_BIT; } return val; } @@ -189,7 +189,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple final int cfgID; final int rType; final int visualID; - + // get the configID if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) { if(DEBUG) { @@ -199,7 +199,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return null; } cfgID = val.get(0); - + if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val)) { if(DEBUG) { System.err.println("EGL couldn't retrieve EGL_RENDERABLE_TYPE for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError())); @@ -213,8 +213,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } else { visualID = VisualIDHolder.VID_UNDEFINED; } - - EGLGLCapabilities caps = null; + + EGLGLCapabilities caps = null; try { if(null == glp) { glp = EGLGLCapabilities.getCompatible(device, rType); @@ -232,8 +232,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple System.err.println("config "+toHexString(config)+": "+gle); } return null; - } - + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_CAVEAT, val)) { if( EGL.EGL_SLOW_CONFIG == val.get(0) ) { caps.setHardwareAccelerated(false); @@ -244,11 +244,11 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple caps.setNumSamples(val.get(0)); } if(!caps.getSampleBuffers()) { - // try NV_coverage_sample extension + // try NV_coverage_sample extension if(EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_BUFFERS_NV, val)) { if(val.get(0)>0 && EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_SAMPLES_NV, val)) { - caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample); + caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample); caps.setSampleBuffers(true); caps.setNumSamples(val.get(0)); } @@ -269,7 +269,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val)) { caps.setTransparentBlueValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0)); } - /** Not defined in EGL + /** Not defined in EGL if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val)) { caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0)); } */ @@ -294,16 +294,16 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple caps.setDepthBits(val.get(0)); } - // Since the passed GLProfile may be null, + // Since the passed GLProfile may be null, // we use EGL_RENDERABLE_TYPE derived profile as created in the EGLGLCapabilities constructor. - final int availableTypeBits = EGLConfigDrawableTypeBits(device, config); + final int availableTypeBits = EGLConfigDrawableTypeBits(device, config); final int drawableTypeBits = winattrmask & availableTypeBits; if( 0 == drawableTypeBits ) { return null; } - - return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); + + return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) { @@ -313,7 +313,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, EGL.EGL_SURFACE_TYPE); final int surfaceType; if( caps.isOnscreen() ) { - surfaceType = EGL.EGL_WINDOW_BIT; + surfaceType = EGL.EGL_WINDOW_BIT; } else if( caps.isFBO() ) { surfaceType = EGL.EGL_PBUFFER_BIT; // native replacement! } else if( caps.isPBuffer() ) { @@ -338,7 +338,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, EGL.EGL_ALPHA_SIZE); attrs.put(idx++, caps.getAlphaBits()); } - + if(caps.getStencilBits()>0) { attrs.put(idx++, EGL.EGL_STENCIL_SIZE); attrs.put(idx++, caps.getStencilBits()); @@ -382,7 +382,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple attrs.put(idx++, caps.getTransparentAlphaValue()>=0?caps.getTransparentAlphaValue():EGL.EGL_DONT_CARE; */ } - // 28 + // 28 attrs.put(idx++, EGL.EGL_RENDERABLE_TYPE); if(caps.getGLProfile().usesNativeGLES1()) { attrs.put(idx++, EGL.EGL_OPENGL_ES_BIT); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index b44e08500..5764a6178 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -75,10 +75,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static GraphicsConfigurationFactory nativeGraphicsConfigurationFactory = null; static GraphicsConfigurationFactory kdeglGraphicsConfigurationFactory = null; static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; - + static void registerFactory() { GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); - + // become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected final String nwType = NativeWindowFactory.getNativeWindowType(false); if(NativeWindowFactory.TYPE_X11 == nwType) { @@ -86,32 +86,32 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null != nativeGraphicsConfigurationFactory) { fallbackGraphicsConfigurationFactory = nativeGraphicsConfigurationFactory; } else { - fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); + fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); } } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory); - } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { + } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ - + // become the selector for KD/EGL .. - kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); + kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); } - + static void unregisterFactory() { final String nwType = NativeWindowFactory.getNativeWindowType(false); if(NativeWindowFactory.TYPE_X11 == nwType) { - GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory); + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory); } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory); - } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { + } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ nativeGraphicsConfigurationFactory = null; fallbackGraphicsConfigurationFactory = null; - + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, kdeglGraphicsConfigurationFactory); kdeglGraphicsConfigurationFactory = null; } - + private EGLGraphicsConfigurationFactory() { } @@ -139,21 +139,21 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); - } - + } + AbstractGraphicsConfiguration cfg = null; - + if( absDevice instanceof EGLGraphicsDevice ) { cfg = chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen, (GLCapabilitiesImmutable) capsRequested, (GLCapabilitiesChooser) chooser, - absScreen, nativeVisualID, false); + absScreen, nativeVisualID, false); } else { - // handle non native cases (X11, ..) + // handle non native cases (X11, ..) if(null == fallbackGraphicsConfigurationFactory) { throw new InternalError("Native fallback GraphicsConfigurationFactory is null, but call issued for device: "+absDevice+" of type "+absDevice.getClass().getSimpleName()); } - + if(glCapsChosen.getGLProfile().usesNativeGLES()) { if(DEBUG) { System.err.println("EGLGraphicsConfigurationFactory.choose..: Handle native device "+absDevice.getClass().getSimpleName()); @@ -175,7 +175,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact System.err.println("EGLGraphicsConfigurationFactory.choose..: Delegate to "+fallbackGraphicsConfigurationFactory.getClass().getSimpleName()); } cfg = fallbackGraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, nativeVisualID); - } + } } return cfg; } @@ -219,7 +219,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, int nativeVisualID, + AbstractGraphicsScreen absScreen, int nativeVisualID, boolean forceTransparentFlag) { if (capsChosen == null) { capsChosen = new GLCapabilities(null); @@ -232,7 +232,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } - + final EGLGraphicsDevice eglDevice; final boolean ownEGLDisplay; if( absDevice instanceof EGLGraphicsDevice ) { @@ -253,7 +253,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(DEBUG) { System.err.println("eglChooseConfig failed with given capabilities "+capsChosen); } - + // Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..] // // rgb888 - d16, s4 @@ -268,7 +268,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (1): "+fixedCaps); } @@ -286,7 +286,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (2): "+fixedCaps); } @@ -306,7 +306,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); fixedCaps.setFBO(capsChosen.isFBO()); - } + } if(DEBUG) { System.err.println("trying fixed caps (3): "+fixedCaps); } @@ -322,8 +322,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return res; } - - static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, + + static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, @@ -354,7 +354,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen); PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); - // 1st choice: get GLCapabilities based on users GLCapabilities + // 1st choice: get GLCapabilities based on users GLCapabilities // setting recommendedIndex as preferred choice // skipped if nativeVisualID is given if( VisualIDHolder.VID_UNDEFINED != nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) { @@ -387,7 +387,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: #2 Get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); } if (numConfigs.get(0) > 0) { - availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag); + availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag); } } @@ -400,7 +400,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } return null; } - + if(DEBUG) { System.err.println("EGLGraphicsConfiguration.eglChooseConfig: got configs: "+availableCaps.size()); for(int i=0; i<availableCaps.size(); i++) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java index 19084ba19..065f80dcb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java @@ -54,8 +54,8 @@ public class EGLOnscreenDrawable extends EGLDrawable { } @Override - protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { + protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) { return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null); - } + } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index 8dea10df1..5083c854f 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -23,8 +23,8 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { protected static final boolean DEBUG = EGLDrawableFactory.DEBUG; private final NativeSurface upstreamSurface; - private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; - + private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize; + public EGLUpstreamSurfaceHook(NativeSurface upstream) { upstreamSurface = upstream; if(upstreamSurface instanceof ProxySurface) { @@ -39,32 +39,32 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { upstreamSurfaceHookMutableSize = null; } } - + public final NativeSurface getUpstreamSurface() { return upstreamSurface; } - + static String getThreadName() { return Thread.currentThread().getName(); } - + public final void setSize(int width, int height) { if(null != upstreamSurfaceHookMutableSize) { upstreamSurfaceHookMutableSize.setSize(width, height); - } + } } - + @Override public final void create(ProxySurface surface) { final String dbgPrefix; if(DEBUG) { dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create( up "+upstreamSurface.getClass().getSimpleName()+" -> this "+surface.getClass().getSimpleName()+" ): "; - System.err.println(dbgPrefix+this); + System.err.println(dbgPrefix+this); } else { dbgPrefix = null; } - + if(upstreamSurface instanceof ProxySurface) { - // propagate createNotify(..) so upstreamSurface will be created + // propagate createNotify(..) so upstreamSurface will be created ((ProxySurface)upstreamSurface).createNotify(); } - + // lock upstreamSurface, so it can be used in case EGLDisplay is derived from it! if(NativeSurface.LOCK_SURFACE_NOT_READY >= upstreamSurface.lockSurface()) { throw new GLException("Could not lock: "+upstreamSurface); @@ -73,16 +73,16 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { evalUpstreamSurface(dbgPrefix, surface); } finally { upstreamSurface.unlockSurface(); - } + } } - + private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) { // // evaluate nature of upstreamSurface, may create EGL instances if required // - + boolean isEGLSurfaceValid = true; // assume yes - + final EGLGraphicsDevice eglDevice; final AbstractGraphicsConfiguration aConfig; { @@ -92,14 +92,14 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { System.err.println(dbgPrefix+"SurfaceDevice: "+surfaceDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceDevice.hashCode())+", "+surfaceDevice); System.err.println(dbgPrefix+"SurfaceConfig: "+surfaceConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceConfig.hashCode())+", "+surfaceConfig); } - - final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration(); + + final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration(); final AbstractGraphicsDevice upstreamDevice = upstreamConfig.getScreen().getDevice(); if(DEBUG) { System.err.println(dbgPrefix+"UpstreamDevice: "+upstreamDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamDevice.hashCode())+", "+upstreamDevice); System.err.println(dbgPrefix+"UpstreamConfig: "+upstreamConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamConfig.hashCode())+", "+upstreamConfig); } - + if( surfaceDevice instanceof EGLGraphicsDevice ) { eglDevice = (EGLGraphicsDevice) surfaceDevice; aConfig = surfaceConfig; @@ -129,13 +129,13 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); } } - + final GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities(); final EGLGraphicsConfiguration eglConfig; if( aConfig instanceof EGLGraphicsConfiguration ) { // Config is already in EGL type - reuse .. final EGLGLCapabilities capsChosen = (EGLGLCapabilities) aConfig.getChosenCapabilities(); - if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) { + if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) { // 'refresh' the native EGLConfig handle capsChosen.setEGLConfig(EGLGraphicsConfiguration.EGLConfigId2EGLConfig(eglDevice.getHandle(), capsChosen.getEGLConfigID())); if( 0 == capsChosen.getEGLConfig() ) { @@ -166,7 +166,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { isEGLSurfaceValid = false; } surface.setGraphicsConfiguration(eglConfig); - + if(isEGLSurfaceValid) { isEGLSurfaceValid = EGLDrawable.isValidEGLSurface(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle()); } @@ -182,15 +182,15 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { if(DEBUG) { System.err.println(dbgPrefix+"Fin: EGL surface n/a - TBD: "+upstreamSurface); } - } + } } @Override public final void destroy(ProxySurface surface) { if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); + System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } - surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); if(upstreamSurface instanceof ProxySurface) { ((ProxySurface)upstreamSurface).destroyNotify(); } @@ -205,7 +205,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { public final int getHeight(ProxySurface s) { return upstreamSurface.getHeight(); } - + @Override public String toString() { final String us_s = null != upstreamSurface ? ( upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle()) ) : "nil"; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java index f816151c7..e6d43d957 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java @@ -19,16 +19,16 @@ public class EGLWrappedSurface extends WrappedSurface { } return new EGLWrappedSurface(surface); } - + public EGLWrappedSurface(NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { - System.err.println("EGLWrappedSurface.ctor(): "+this); + System.err.println("EGLWrappedSurface.ctor(): "+this); } } @Override - public final NativeSurface getUpstreamSurface() { - return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface(); - } + public final NativeSurface getUpstreamSurface() { + return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface(); + } } diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java index 9165dbc4b..a4aa1c7c5 100644 --- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java +++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java @@ -6,9 +6,9 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND @@ -24,13 +24,13 @@ ** except that Section 2.2 and 11 are omitted. Any differences between ** the Alternative License and the SGI License are offered solely by Sun ** and not by SGI. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -45,56 +45,56 @@ ** $Header$ */ -/* +/* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -107,7 +107,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -125,7 +125,7 @@ import com.jogamp.common.nio.Buffers; * <p/> * <p/> * Created 11-jan-2004 - * + * * @author Erik Duijs * @author Kenneth Russell */ @@ -155,7 +155,7 @@ public class ProjectDouble { private final double[] forward = new double[3]; private final double[] side = new double[3]; private final double[] up = new double[3]; - + // Buffer-based implementation private DoubleBuffer locbuf; private final DoubleBuffer matrixBuf; @@ -227,7 +227,7 @@ public class ProjectDouble { /** * Method __gluMultMatrixVecd - * + * * @param matrix * @param in * @param out @@ -244,7 +244,7 @@ public class ProjectDouble { /** * Method __gluMultMatrixVecd - * + * * @param matrix * @param in * @param out @@ -265,7 +265,7 @@ public class ProjectDouble { /** * @param src * @param inverse - * + * * @return */ private boolean __gluInvertMatrixd(double[] src, double[] inverse) { @@ -335,7 +335,7 @@ public class ProjectDouble { /** * @param src * @param inverse - * + * * @return */ private boolean __gluInvertMatrixd(DoubleBuffer src, DoubleBuffer inverse) { @@ -525,7 +525,7 @@ public class ProjectDouble { /** * Method gluOrtho2D. - * + * * @param left * @param right * @param bottom @@ -537,7 +537,7 @@ public class ProjectDouble { /** * Method gluPerspective. - * + * * @param fovy * @param aspect * @param zNear @@ -570,7 +570,7 @@ public class ProjectDouble { /** * Method gluLookAt - * + * * @param eyex * @param eyey * @param eyez @@ -631,7 +631,7 @@ public class ProjectDouble { /** * Method gluProject - * + * * @param objx * @param objy * @param objz @@ -639,7 +639,7 @@ public class ProjectDouble { * @param projMatrix * @param viewport * @param win_pos - * + * * @return */ public boolean gluProject(double objx, @@ -685,7 +685,7 @@ public class ProjectDouble { /** * Method gluProject - * + * * @param objx * @param objy * @param objz @@ -693,7 +693,7 @@ public class ProjectDouble { * @param projMatrix * @param viewport * @param win_pos - * + * * @return */ public boolean gluProject(double objx, @@ -738,7 +738,7 @@ public class ProjectDouble { /** * Method gluUnproject - * + * * @param winx * @param winy * @param winz @@ -746,7 +746,7 @@ public class ProjectDouble { * @param projMatrix * @param viewport * @param obj_pos - * + * * @return */ public boolean gluUnProject(double winx, @@ -799,7 +799,7 @@ public class ProjectDouble { /** * Method gluUnproject - * + * * @param winx * @param winy * @param winz @@ -807,7 +807,7 @@ public class ProjectDouble { * @param projMatrix * @param viewport * @param obj_pos - * + * * @return */ public boolean gluUnProject(double winx, @@ -858,7 +858,7 @@ public class ProjectDouble { /** * Method gluUnproject4 - * + * * @param winx * @param winy * @param winz @@ -869,7 +869,7 @@ public class ProjectDouble { * @param near * @param far * @param obj_pos - * + * * @return */ public boolean gluUnProject4(double winx, @@ -923,7 +923,7 @@ public class ProjectDouble { /** * Method gluUnproject4 - * + * * @param winx * @param winy * @param winz @@ -934,7 +934,7 @@ public class ProjectDouble { * @param near * @param far * @param obj_pos - * + * * @return */ public boolean gluUnProject4(double winx, @@ -987,7 +987,7 @@ public class ProjectDouble { /** * Method gluPickMatrix - * + * * @param x * @param y * @param deltaX @@ -1014,7 +1014,7 @@ public class ProjectDouble { /** * Method gluPickMatrix - * + * * @param x * @param y * @param deltaX diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 7cd7da53e..b4383c2e6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -6,15 +6,15 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** NOTE: The Original Code (as defined below) has been licensed to Sun ** Microsystems, Inc. ("Sun") under the SGI Free Software License B ** (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -45,56 +45,56 @@ ** $Header$ */ -/* +/* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -107,7 +107,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -124,8 +124,8 @@ import com.jogamp.opengl.util.glsl.ShaderState; /** * GLUquadricImpl.java - * - * + * + * * Created 22-dec-2003 (originally Quadric.java) * @author Erik Duijs * @author Kenneth Russell, Sven Gothel @@ -197,19 +197,19 @@ public class GLUquadricImpl implements GLUquadric { ImmModeSink res = immModeSink; if(useGLSL) { if(null != shaderState) { - immModeSink = ImmModeSink.createGLSL (32, - 3, GL.GL_FLOAT, // vertex + immModeSink = ImmModeSink.createGLSL (32, + 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color USE_NORM?3:0, normalType, // normal USE_TEXT?2:0, GL.GL_FLOAT, // texCoords GL.GL_STATIC_DRAW, shaderState); } else { - immModeSink = ImmModeSink.createGLSL (32, - 3, GL.GL_FLOAT, // vertex + immModeSink = ImmModeSink.createGLSL (32, + 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color USE_NORM?3:0, normalType, // normal USE_TEXT?2:0, GL.GL_FLOAT, // texCoords - GL.GL_STATIC_DRAW, shaderProgram); + GL.GL_STATIC_DRAW, shaderProgram); } } else { immModeSink = ImmModeSink.createFixed(32, @@ -229,7 +229,7 @@ public class GLUquadricImpl implements GLUquadric { } /** - * specifies the draw style for quadrics. + * specifies the draw style for quadrics. * * The legal values are as follows: * @@ -243,7 +243,7 @@ public class GLUquadricImpl implements GLUquadric { * separating coplanar faces will not be drawn. * * GLU.POINT: Quadrics are rendered as a set of points. - * + * * @param drawStyle The drawStyle to set */ public void setDrawStyle(int drawStyle) { @@ -260,7 +260,7 @@ public class GLUquadricImpl implements GLUquadric { * * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This * is the default. - * + * * @param normals The normals to set */ public void setNormals(int normals) { @@ -277,7 +277,7 @@ public class GLUquadricImpl implements GLUquadric { * * Note that the interpretation of outward and inward depends on the quadric * being drawn. - * + * * @param orientation The orientation to set */ public void setOrientation(int orientation) { @@ -292,7 +292,7 @@ public class GLUquadricImpl implements GLUquadric { * * The manner in which texture coordinates are generated depends upon the * specific quadric rendered. - * + * * @param textureFlag The textureFlag to set */ public void setTextureFlag(boolean textureFlag) { @@ -512,10 +512,10 @@ public class GLUquadricImpl implements GLUquadric { glNormal3f(gl, 0.0f, 0.0f, -1.0f); } } - + da = 2.0f * PI / slices; dr = (outerRadius - innerRadius) / loops; - + switch (drawStyle) { case GLU.GLU_FILL: { @@ -648,18 +648,18 @@ public class GLUquadricImpl implements GLUquadric { * through startAngle + sweepAngle is included (where 0 degrees is along * the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and * 270 along the -x axis). - * + * * The partial disk has a radius of outerRadius, and contains a concentric * circular hole with a radius of innerRadius. If innerRadius is zero, then * no hole is generated. The partial disk is subdivided around the z axis * into slices (like pizza slices), and also about the z axis into rings * (as specified by slices and loops, respectively). - * + * * With respect to orientation, the +z side of the partial disk is * considered to be outside (see gluQuadricOrientation). This means that if * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point * along the +z axis. Otherwise, they point along the -z axis. - * + * * If texturing is turned on (with gluQuadricTexture), texture coordinates * are generated linearly such that where r=outerRadius, the value at (r, 0, 0) * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), @@ -1204,7 +1204,7 @@ public class GLUquadricImpl implements GLUquadric { */ private void normal3f(GL gl, float x, float y, float z) { float mag; - + mag = (float)Math.sqrt(x * x + y * y + z * z); if (mag > 0.00001F) { x /= mag; diff --git a/src/jogl/classes/jogamp/opengl/glu/Glue.java b/src/jogl/classes/jogamp/opengl/glu/Glue.java index 636d17f29..2ad3d8c89 100644 --- a/src/jogl/classes/jogamp/opengl/glu/Glue.java +++ b/src/jogl/classes/jogamp/opengl/glu/Glue.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -89,15 +89,15 @@ public class Glue { "null control point reference", "duplicate point on piecewise linear trimming curve" } ; - + /** Creates a new instance of Glue */ public Glue() { } - + public static String __gluNURBSErrorString( int errno ) { return( __gluNurbsErrors[ errno ] ); } - + private static String[] __gluTessErrors = { " ", "gluTessBeginPolygon() must precede a gluTessEndPolygon", @@ -107,7 +107,7 @@ public class Glue { "a coordinate is too large", "need combine callback" }; - + public static String __gluTessErrorString( int errno ) { return( __gluTessErrors[ errno ] ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java index 2f49db9a4..ffb8d9471 100644 --- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java +++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java @@ -6,9 +6,9 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND @@ -24,13 +24,13 @@ * except that Section 2.2 and 11 are omitted. Any differences between * the Alternative License and the SGI License are offered solely by Sun * and not by SGI. - * + * * Original Code. The Original Code is: OpenGL Sample Implementation, * Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -53,7 +53,7 @@ import jogamp.opengl.glu.Glue; * @author Administrator */ public class Error { - + private static String[] glErrorStrings = { "invalid enumerant", "invalid value", @@ -63,7 +63,7 @@ public class Error { "out of memory", "invalid framebuffer operation" }; - + private static String[] gluErrorStrings = { "invalid enumerant", "invalid value", @@ -71,11 +71,11 @@ public class Error { "", "invalid operation" }; - + /** Creates a new instance of Error */ public Error() { } - + public static String gluErrorString( int errorCode ) { if( errorCode == 0 ) { return( "no error" ); diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java index 2ef4468e5..f57c2310f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -48,7 +48,7 @@ import javax.media.opengl.glu.gl2.GLUgl2; class GL2CurveEvaluator implements CurveEvaluator { /** - * Output triangles (for callback) or render curve + * Output triangles (for callback) or render curve */ private boolean output_triangles; diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index 58b565484..f83b3a805 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -43,9 +43,9 @@ import javax.media.opengl.glu.GLUnurbs; /** * Base object for working with NURBS curves and surfaces - * + * * @author Tomas Hrasky - * + * */ public class GLUgl2nurbsImpl implements GLUnurbs { @@ -272,7 +272,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Sets domain distance for dom.dist. sampling in u direction - * + * * @param d * distance */ @@ -283,7 +283,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Sets domain distance for dom.dist. sampling in v direction - * + * * @param d * distance */ @@ -303,7 +303,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Calls a method with given name and passes argumet - * + * * @param name * name of a method to be called * @param arg @@ -329,7 +329,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Calls a method with given name - * + * * @param name * name of a method to be called */ @@ -349,7 +349,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Begins a NURBS curve - * + * * @param o_curve * curve object */ @@ -381,7 +381,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Begins new surface - * + * * @param o_surface * surface object */ @@ -503,7 +503,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Method for handling error codes - * + * * @param i * error code */ @@ -539,7 +539,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Make a NURBS curve - * + * * @param nknots * number of knots in knot vector * @param knot @@ -587,7 +587,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Check knot vector specification - * + * * @param knots * knot vector * @param msg @@ -607,7 +607,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Draw a curve - * + * * @param o_nurbscurve * NURBS curve object */ @@ -660,7 +660,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Draw NURBS surface - * + * * @param o_nurbssurface * NURBS surface object */ @@ -704,7 +704,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Define a map of given properties - * + * * @param type * map type * @param rational @@ -719,7 +719,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Set NURBS property - * + * * @param type * property type * @param tag @@ -744,7 +744,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Set parameters of existing property - * + * * @param prop * property */ @@ -755,7 +755,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Set given property to rendering hints - * + * * @param prop * property to be set */ @@ -767,7 +767,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Sets wheteher we use domain distance sampling - * + * * @param i * domain distance sampling flag */ @@ -805,7 +805,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Make NURBS surface - * + * * @param sknot_count * number of knots in s direction * @param sknot diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index f5fe17a7b..81a99beab 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -64,7 +64,7 @@ public class BuildMipmap { /** Creates a new instance of BuildMipmap */ public BuildMipmap() { } - + public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat, int width, int widthPowerOf2, int format, int type, int userLevel, int baseLevel, int maxLevel, ByteBuffer data ) { @@ -78,34 +78,34 @@ public class BuildMipmap { int maxsize; int cmpts; PixelStorageModes psm = new PixelStorageModes(); - + assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 ); - + newwidth = widthPowerOf2; levels = Mipmap.computeLog( newwidth ); - + levels += userLevel; - + Mipmap.retrieveStoreModes( gl, psm ); try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); } catch( OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; - + Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - + // if swap_bytes was set, swapping occurred in fill_image gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); - + for( level = userLevel; level <= levels; level++ ) { if( newImage_width == newwidth ) { // user newimage for this level @@ -132,10 +132,10 @@ public class BuildMipmap { imageTemp = otherImage; otherImage = newImage; newImage = imageTemp; - + newImage_width = newwidth; if( baseLevel <= level && level <= maxLevel ) { - gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, + gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); } } @@ -148,10 +148,10 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - + return( 0 ); } - + public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, int width, int height, int format, int type, ByteBuffer data ) { int newwidth[] = new int[1]; @@ -166,37 +166,37 @@ public class BuildMipmap { int maxsize; int cmpts; PixelStorageModes psm = new PixelStorageModes(); - + Mipmap.retrieveStoreModes( gl, psm ); - + Mipmap.closestFit( gl, target, width, height, internalFormat, format, type, newwidth, newheight ); - + levels = Mipmap.computeLog( newwidth[0] ); level = Mipmap.computeLog( newheight[0] ); if( level > levels ) { levels = level; } - + try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); } catch( OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; newImage_height = height; - + Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); - + cmpts = Mipmap.elements_per_group( format, type ); gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - + // if swap_bytes is set, swapping occurred in fill_image gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); - + for( level = 0; level < levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { newImage.rewind(); @@ -216,13 +216,13 @@ public class BuildMipmap { return( GLU.GLU_OUT_OF_MEMORY ); } } - ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height, + ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height, newImage, newwidth[0], newheight[0], otherImage ); // swap newImage and otherImage tempImage = otherImage; otherImage = newImage; newImage = tempImage; - + newImage_width = newwidth[0]; newImage_height = newheight[0]; newImage.rewind(); @@ -241,10 +241,10 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - + return( 0 ); } - + public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, int width, int height, int widthPowerOf2, int heightPowerOf2, int format, int type, int userLevel, int baseLevel, int maxLevel, @@ -263,19 +263,19 @@ public class BuildMipmap { int maxsize; int cmpts; int mark=-1; - + boolean myswap_bytes; int groups_per_line, element_size, group_size; int rowsize, padding; PixelStorageModes psm = new PixelStorageModes(); - + assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 ); - + if( type == GL2.GL_BITMAP ) { return( bitmapBuild2DMipmaps( gl, target, internalFormat, width, height, format, type, data ) ); } - + newwidth = widthPowerOf2; newheight = heightPowerOf2; levels = Mipmap.computeLog( newwidth ); @@ -283,9 +283,9 @@ public class BuildMipmap { if( level > levels ) { levels = level; } - + levels += userLevel; - + Mipmap.retrieveStoreModes( gl, psm ); myswap_bytes = psm.getUnpackSwapBytes(); cmpts = Mipmap.elements_per_group( format, type ); @@ -294,28 +294,28 @@ public class BuildMipmap { } else { groups_per_line = width; } - + element_size = Mipmap.bytes_per_element( type ); group_size = element_size * cmpts; if( element_size == 1 ) { myswap_bytes = false; } - + rowsize = groups_per_line * group_size; padding = ( rowsize % psm.getUnpackAlignment() ); if( padding != 0 ) { rowsize += psm.getUnpackAlignment() - padding; } - + mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; data.position( mark ); - + gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - + level = userLevel; - + // already power of two square if( width == newwidth && height == newheight ) { // use usersImage for level userLevel @@ -333,7 +333,7 @@ public class BuildMipmap { } int nextWidth = newwidth / 2; int nextHeight = newheight / 2; - + // clamp to 1 if( nextWidth < 1 ) { nextWidth = 1; @@ -342,7 +342,7 @@ public class BuildMipmap { nextHeight = 1; } memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); - + try { switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): @@ -452,7 +452,7 @@ public class BuildMipmap { if( newheight < 1 ) { newheight = 1; } - + myswap_bytes = false; rowsize = newwidth * group_size; memReq = Mipmap.image_size( newwidth, newheight, format, type ); @@ -498,7 +498,7 @@ public class BuildMipmap { level = userLevel + 1; } else { // user's image is not nice powerof2 size square memReq = Mipmap.image_size( newwidth, newheight, format, type ); - try { + try { switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): case( GL2.GL_BYTE ): @@ -535,15 +535,15 @@ public class BuildMipmap { data.position( mark ); switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): - ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, + ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; case( GL2.GL_BYTE ): - ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, + ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; case( GL2.GL_UNSIGNED_SHORT ): - ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, + ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; case( GL2.GL_SHORT ): @@ -620,7 +620,7 @@ public class BuildMipmap { tempImage = srcImage; srcImage = dstImage; dstImage = tempImage; - + if( levels != 0 ) { // use as little memory as possible int nextWidth = newwidth / 2; int nextHeight = newheight / 2; @@ -630,7 +630,7 @@ public class BuildMipmap { if( nextHeight < 1 ) { nextHeight = 1; } - + memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); try { switch( type ) { @@ -670,7 +670,7 @@ public class BuildMipmap { // level userLevel is in srcImage; nothing saved yet level = userLevel; } - + gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { srcImage.rewind(); @@ -685,7 +685,7 @@ public class BuildMipmap { } } } - + level++; // update current level for the loop for( ; level <= levels; level++ ) { srcImage.rewind(); @@ -754,12 +754,12 @@ public class BuildMipmap { assert( false ); break; } - + // swap dstImage and srcImage tempImage = srcImage; srcImage = dstImage; dstImage = tempImage; - + if( newwidth > 1 ) { newwidth /= 2; rowsize /= 2; @@ -769,7 +769,7 @@ public class BuildMipmap { } // compute amount to pad per row if any int rowPad = rowsize % psm.getUnpackAlignment(); - + // should row be padded if( rowPad == 0 ) { // call teximage with srcImage untouched since its not padded @@ -792,7 +792,7 @@ public class BuildMipmap { int ii, jj; int dstTrav; int srcTrav; - + // allocate new image for mipmap of size newRowLength x newheight ByteBuffer newMipmapImage = null; try { @@ -813,7 +813,7 @@ public class BuildMipmap { newMipmapImage.put( srcImage.get() ); } } - + // and use this new image for mipmapping instead if( baseLevel <= level && level <= maxLevel ) { newMipmapImage.rewind(); @@ -833,10 +833,10 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); - + return( 0 ); } - + public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, int components, int width, int height, int format, int type, ByteBuffer data ) { int[] newwidth = new int[1]; @@ -850,22 +850,22 @@ public class BuildMipmap { int memReq; int maxsize; int cmpts; - - Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, + + Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, newheight ); - + levels = Mipmap.computeLog( newwidth[0] ); level = Mipmap.computeLog( newheight[0] ); if( level > levels ) { levels = level; } - + cmpts = Mipmap.elements_per_group( format, type ); - + otherImage = null; // No need to copy the user data if its packed correctly. // Make sure that later routines don't change that data. - + if( psm.getUnpackSkipRows() == 0 && psm.getUnpackSkipPixels() == 0 ) { newImage = data; newImage_width = width; @@ -878,7 +878,7 @@ public class BuildMipmap { int iter; int iter2; int i, j; - + try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) ); } catch( OutOfMemoryError err ) { @@ -896,7 +896,7 @@ public class BuildMipmap { rowsize = group_per_line * cmpts; elements_per_line = width * cmpts; start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * cmpts; - + for( i = 0; i < height; i++ ) { iter = start; data.position( iter ); @@ -906,13 +906,13 @@ public class BuildMipmap { start += rowsize; } } - + gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); - + for( level = 0; level <= levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { // use newImage for this level @@ -937,7 +937,7 @@ public class BuildMipmap { imageTemp = otherImage; otherImage = newImage; newImage = imageTemp; - + newImage_width = newwidth[0]; newImage_height = newheight[0]; newImage.rewind(); @@ -956,10 +956,10 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; - + return( 0 ); } - + public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, int depthPowerOf2, int format, int type, int userLevel, int baseLevel, @@ -977,19 +977,19 @@ public class BuildMipmap { int maxSize; int cmpts; int mark=-1; - + boolean myswapBytes; int groupsPerLine, elementSize, groupSize; int rowsPerImage, imageSize; int rowSize, padding; PixelStorageModes psm = new PixelStorageModes(); - + assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 && depth >= 1 ); assert( type != GL2.GL_BITMAP ); - + srcImage = dstImage = null; - + newWidth = widthPowerOf2; newHeight = heightPowerOf2; newDepth = depthPowerOf2; @@ -1002,9 +1002,9 @@ public class BuildMipmap { if( level > levels ) { levels = level; } - + levels += userLevel; - + Mipmap.retrieveStoreModes3D( gl, psm ); myswapBytes = psm.getUnpackSwapBytes(); cmpts = Mipmap.elements_per_group( format, type ); @@ -1013,42 +1013,42 @@ public class BuildMipmap { } else { groupsPerLine = width; } - + elementSize = Mipmap.bytes_per_element( type ); groupSize = elementSize * cmpts; if( elementSize == 1 ) { myswapBytes = false; } - + // 3dstuff if( psm.getUnpackImageHeight() > 0 ) { rowsPerImage = psm.getUnpackImageHeight(); } else { rowsPerImage = height; } - + rowSize = groupsPerLine * groupSize; padding = ( rowSize % psm.getUnpackAlignment() ); if( padding != 0 ) { rowSize += psm.getUnpackAlignment() - padding; } - + imageSize = rowsPerImage * rowSize; - + usersImage = ByteBuffer.wrap(data.array()); mark = psm.getUnpackSkipRows() * rowSize + psm.getUnpackSkipPixels() * groupSize + psm.getUnpackSkipImages() * imageSize; usersImage.position( mark ); - + gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 ); gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 ); - + level = userLevel; - + if( width == newWidth && height == newHeight && depth == newDepth ) { // use usersImage for level userlevel if( baseLevel <= level && level <= maxLevel ) { @@ -1068,7 +1068,7 @@ public class BuildMipmap { int nextWidth = newWidth / 2; int nextHeight = newHeight / 2; int nextDepth = newDepth / 2; - + // clamp to one if( nextWidth < 1 ) { nextWidth = 1; @@ -1116,13 +1116,13 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } - + if( dstImage != null ) { switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, - usersImage, dstImage, elementSize, + usersImage, dstImage, elementSize, groupSize, rowSize, imageSize, myswapBytes ); } else { HalveImage.halveImage_ubyte( cmpts, width, height, usersImage, @@ -1145,7 +1145,7 @@ public class BuildMipmap { usersImage, dstImage, elementSize, groupSize, rowSize, imageSize, myswapBytes ); } else { - HalveImage.halveImage_ushort( cmpts, width, height, usersImage, + HalveImage.halveImage_ushort( cmpts, width, height, usersImage, dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; @@ -1257,7 +1257,7 @@ public class BuildMipmap { if( newDepth < 1 ) { newDepth = 1; } - + myswapBytes = false; rowSize = newWidth * groupSize; imageSize = rowSize * newHeight; @@ -1302,7 +1302,7 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } - + // level userLevel + 1 is in srcImage; level userLevel already saved level = userLevel + 1; } else { @@ -1343,10 +1343,10 @@ public class BuildMipmap { gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } - + ScaleInternal.gluScaleImage3D( gl, format, width, height, depth, type, usersImage, newWidth, newHeight, newDepth, type, dstImage ); - + myswapBytes = false; rowSize = newWidth * groupSize; imageSize = rowSize * newHeight; @@ -1354,7 +1354,7 @@ public class BuildMipmap { tempImage = srcImage; srcImage = dstImage; dstImage = tempImage; - + if( levels != 0 ) { int nextWidth = newWidth / 2; int nextHeight = newHeight / 2; @@ -1409,7 +1409,7 @@ public class BuildMipmap { // level userLevel is in srcImage; nothing saved yet level = userLevel; } - + gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { usersImage.position( mark ); @@ -1541,11 +1541,11 @@ public class BuildMipmap { assert( false ); break; } - + tempImage = srcImage; srcImage = dstImage; dstImage = tempImage; - + if( newWidth > 1 ) { newWidth /= 2; rowSize /= 2; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java index a564269fb..0eee9bf32 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java index 10ea1d729..5269024b4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.ByteBuffer; * @author Administrator */ public class Extract1010102 implements Extract { - + /** Creates a new instance of Extract1010102 */ public Extract1010102() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { long uint = 0; - + if( isSwap ) { uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); } else { uint = 0x00000000FFFFFFFF & packedPixel.getInt(); } - + // 11111111,11000000,00000000,00000000 == 0xFFC00000 // 00000000,00111111,11110000,00000000 == 0x003F0000 // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - + extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) << 22) & 0xFFC00000 ); uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 12) & 0x003FF000 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java index 1234da5f8..6982931d3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.ByteBuffer; * @author Administrator */ public class Extract1555rev implements Extract { - + /** Creates a new instance of Extract1555rev */ public Extract1555rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - + extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 5) & 0x000003E0 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java index 226254f99..1c7db6218 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.ByteBuffer; * @author Administrator */ public class Extract2101010rev implements Extract { - + /** Creates a new instance of Extract2101010 */ public Extract2101010rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { long uint = 0; - + if( isSwap ) { uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); } else { uint = 0x00000000FFFFFFFF & packedPixel.getInt(); } - + // 11111111,11000000,00000000,00000000 == 0xFFC00000 // 00000000,00111111,11110000,00000000 == 0x003F0000 // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - + extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) ) & 0x000003FF ); uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 10) & 0x000FFC00 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java index 9fa2a3a54..672c86c32 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.ByteBuffer; * @author Administrator */ public class Extract233rev implements Extract { - + /** Creates a new instance of Extract223rev */ public Extract233rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c @@ -65,16 +65,16 @@ public class Extract233rev implements Extract { extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - + // due to limited precision, need to round before shoving byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) ) & 0x07 ); b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 3 ) & 0x38 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java index 92d141be5..6cdbc5cb0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.ByteBuffer; * @author Administrator */ public class Extract332 implements Extract { - + /** Creates a new instance of Extract332 */ public Extract332() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c @@ -65,16 +65,16 @@ public class Extract332 implements Extract { extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - + // due to limited precision, need to round before shoving byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) << 5 ) & 0xE0 ); b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 2 ) & 0x1C ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java index af99d154c..b36b9fb82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,41 +51,41 @@ import java.nio.*; * @author Administrator */ public class Extract4444 implements Extract { - + /** Creates a new instance of Extract4444 */ public Extract4444() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) << 12) & 0x0000F000 ); ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 8) & 0x00000F00 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java index e5bce60d8..b7a3ed55f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.*; * @author Administrator */ public class Extract4444rev implements Extract { - + /** Creates a new instance of Extract4444rev */ public Extract4444rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 00000000,00001111 == 0x000F // 00000000,11110000 == 0x00F0 // 00001111,00000000 == 0x0F00 // 11110000,00000000 == 0xF000 - + extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) ) & 0x0000000F ); ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 4) & 0x000000F0 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java index 5c383103e..4dc566b25 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.*; * @author Administrator */ public class Extract5551 implements Extract { - + /** Creates a new instance of Extract5551 */ public Extract5551() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 11111000,00000000 == 0xF800 // 00000111,11000000 == 0x07C0 // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - + extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; extractComponents[3] = (float)( ( ushort & 0xF000 ) ); } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 6) & 0x000007C0 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java index f6193dd2d..e198e46d4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,38 +51,38 @@ import java.nio.*; * @author Administrator */ public class Extract565 implements Extract { - + /** Creates a new instance of Extract565 */ public Extract565() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - + extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 ); ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java index 2e455adfa..fe19540ee 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,38 +51,38 @@ import java.nio.*; * @author Administrator */ public class Extract565rev implements Extract { - + /** Creates a new instance of Extract565rev */ public Extract565rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { int ushort = 0; - + if( isSwap ) { ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() ); } else { ushort = 0x0000FFFF & packedPixel.getShort(); } - + // 00000000,00011111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - + extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 00000000,00111111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); - + // due to limited precision, need to round before shoving int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F ); ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java index 137fa3c21..4602f2af9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.*; * @author Administrator */ public class Extract8888 implements Extract { - + /** Creates a new instance of Extract8888 */ public Extract8888() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { long uint = 0; - + if( isSwap ) { uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); } else { uint = 0x00000000FFFFFFFF & packedPixel.getInt(); } - + // 11111000,00000000 == 0xF800 // 00000111,11000000 == 0x07C0 // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - + extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving long uint = (((int)((shoveComponents[0] * 255) + 0.5f) << 24) & 0xFF000000 ); uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 16) & 0x00FF0000 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java index 2ac942c84..373cb102a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,42 +51,42 @@ import java.nio.*; * @author Administrator */ public class Extract8888rev implements Extract { - + /** Creates a new instance of Extract8888rev */ public Extract8888rev() { } - + public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { long uint = 0; - + if( isSwap ) { uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() ); } else { uint = 0x00000000FFFFFFFF & packedPixel.getInt(); } - + // 11111000,00000000 == 0xF800 // 00000111,11000000 == 0x07C0 // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - + extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; } - + public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - + assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f ); assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f ); assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f ); assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f ); - + // due to limited precision, need to round before shoving long uint = (((int)((shoveComponents[0] * 255) + 0.5f) ) & 0x000000FF ); uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 8) & 0x0000FF00 ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java index 52c2191b9..ac0f2f290 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.*; * @author Administrator */ public class ExtractFloat implements ExtractPrimitive { - + /** Creates a new instance of ExtractFloat */ public ExtractFloat() { } - + public double extract( boolean isSwap, ByteBuffer data ) { float f = 0; if( isSwap ) { @@ -66,7 +66,7 @@ public class ExtractFloat implements ExtractPrimitive { assert( f <= 1.0f ); return( f ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < 1.0); data.asFloatBuffer().put( index, (float)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java index 926096649..a44fb9508 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java index 2e1a9a0a6..399386e30 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,17 +51,17 @@ import java.nio.ByteBuffer; * @author Administrator */ public class ExtractSByte implements ExtractPrimitive { - + /** Creates a new instance of ExtractUByte */ public ExtractSByte() { } - + public double extract( boolean isSwap, ByteBuffer sbyte ) { byte b = sbyte.get(); assert( b <= 127 ); return( b ); } - + public void shove( double value, int index, ByteBuffer data ) { data.position( index ); data.put( (byte)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java index ca80747c4..be3fb3092 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.*; * @author Administrator */ public class ExtractSInt implements ExtractPrimitive { - + /** Creates a new instance of ExtractSInt */ public ExtractSInt() { } - + public double extract( boolean isSwap, ByteBuffer uint ) { int i = 0; if( isSwap ) { @@ -66,7 +66,7 @@ public class ExtractSInt implements ExtractPrimitive { assert( i <= 0x7FFFFFFF ); return( i ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < Integer.MAX_VALUE); IntBuffer ib = data.asIntBuffer(); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java index 979c3b449..1e123c9b4 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.*; * @author Administrator */ public class ExtractSShort implements ExtractPrimitive { - + /** Creates a new instance of ExtractSShort */ public ExtractSShort() { } - + public double extract( boolean isSwap, ByteBuffer ushort ) { short s = 0; if( isSwap ) { @@ -66,7 +66,7 @@ public class ExtractSShort implements ExtractPrimitive { assert( s <= 32767 ); return( s ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < 32768.0); ShortBuffer sb = data.asShortBuffer(); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java index 4d14212ab..26ca5cd40 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,17 +51,17 @@ import java.nio.ByteBuffer; * @author Administrator */ public class ExtractUByte implements ExtractPrimitive { - + /** Creates a new instance of ExtractUByte */ public ExtractUByte() { } - + public double extract( boolean isSwap, ByteBuffer ubyte ) { int i = 0x000000FF & ubyte.get(); assert( i <= 255 ); return( i ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < 256.0); data.position( index ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java index c088ca301..8c94c89fc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.*; * @author Administrator */ public class ExtractUInt implements ExtractPrimitive { - + /** Creates a new instance of ExtractUInt */ public ExtractUInt() { } - + public double extract( boolean isSwap, ByteBuffer uint ) { long i = 0; if( isSwap ) { @@ -66,7 +66,7 @@ public class ExtractUInt implements ExtractPrimitive { assert( i <= 0xFFFFFFFF ); return( i ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < 0xFFFFFFFF); IntBuffer ib = data.asIntBuffer(); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java index 81db60f0f..55115c6f7 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import java.nio.*; * @author Administrator */ public class ExtractUShort implements ExtractPrimitive { - + /** Creates a new instance of ExtracUShort */ public ExtractUShort() { } - + public double extract( boolean isSwap, ByteBuffer ushort ) { int i = 0; if( isSwap ) { @@ -66,7 +66,7 @@ public class ExtractUShort implements ExtractPrimitive { assert( i <= 65535 ); return( i ); } - + public void shove( double value, int index, ByteBuffer data ) { assert(0.0 <= value && value < 65536.0); ShortBuffer sb = data.asShortBuffer(); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 7549044ba..184c5fda8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -52,11 +52,11 @@ import java.nio.*; * @author Administrator */ public class HalveImage { - + private static final int BOX2 = 2; private static final int BOX4 = 4; private static final int BOX8 = 8; - + public static void halveImage( int components, int width, int height, ShortBuffer datain, ShortBuffer dataout ) { int i, j, k; @@ -64,11 +64,11 @@ public class HalveImage { int delta; int t = 0; short temp = 0; - + newwidth = width / 2; newheight = height /2; delta = width * components; - + // Piece of cake for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { @@ -91,7 +91,7 @@ public class HalveImage { t += delta; } } - + public static void halveImage_ubyte( int components, int width, int height, ByteBuffer datain, ByteBuffer dataout, int element_size, int ysize, int group_size ) { @@ -99,19 +99,19 @@ public class HalveImage { int newwidth, newheight; int s; int t; - + // Handle case where there is only 1 column/row if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); // can't be 1x1 halve1Dimage_ubyte( components, width, height, datain, dataout, element_size, ysize, group_size ); return; } - + newwidth = width / 2; newheight = height / 2; s = 0; t = 0; - + int temp = 0; // piece of cake for( i = 0; i < newheight; i++ ) { @@ -133,9 +133,9 @@ public class HalveImage { t += ysize; } } - + public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, + ByteBuffer datain, ByteBuffer dataout, int element_size, int ysize, int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; @@ -143,14 +143,14 @@ public class HalveImage { int dest = 0; int jj; int temp = 0; - + assert( width == 1 || height == 1 ); // Must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // widthxheight can't be 1x1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -161,7 +161,7 @@ public class HalveImage { temp /= 2; dataout.put( (byte)temp ); /* - dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + + dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + (0x000000FF & datain.setIndexInBytes( src + group_size ).getByte())) / 2 ) ); */ src += element_size; @@ -188,7 +188,7 @@ public class HalveImage { temp /= 2; dataout.put( (byte)temp ); /* - dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + + dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) + (0x000000FF & datain.setIndexInBytes(src + ysize).getByte()) ) / 2 ) ); */ src += element_size; @@ -202,7 +202,7 @@ public class HalveImage { assert( src == ysize * height ); assert( dest == components * element_size * halfWidth * halfHeight ); } - + public static void halveImage_byte( int components, int width, int height, ByteBuffer datain, ByteBuffer dataout, int element_size, int ysize, int group_size ) { @@ -211,7 +211,7 @@ public class HalveImage { int s = 0; int t = 0; byte temp = (byte)0; - + // handle case where there is only 1 column if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); @@ -219,10 +219,10 @@ public class HalveImage { ysize, group_size ); return; } - + newwidth = width / 2; newheight = height / 2; - + for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { @@ -244,7 +244,7 @@ public class HalveImage { t += ysize; } } - + public static void halve1Dimage_byte( int components, int width, int height, ByteBuffer datain, ByteBuffer dataout, int element_size, int ysize, int group_size ) { @@ -254,14 +254,14 @@ public class HalveImage { int dest = 0; int jj; byte temp = (byte)0; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // widthxheight can't be 1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -284,7 +284,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -303,7 +303,7 @@ public class HalveImage { } assert( dest == components * element_size * halfWidth * halfHeight ); } - + public static void halveImage_ushort( int components, int width, int height, ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -319,10 +319,10 @@ public class HalveImage { ysize, group_size, myswap_bytes ); return; } - + newwidth = width / 2; newheight = height / 2; - + // Piece of cake if( !myswap_bytes ) { for( i = 0; i < newheight; i++ ) { @@ -364,7 +364,7 @@ public class HalveImage { } } } - + public static void halve1Dimage_ushort( int components, int width, int height, ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -373,14 +373,14 @@ public class HalveImage { int src = 0; int dest = 0; int jj; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // widthxheight can't be 1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { @@ -410,7 +410,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -437,7 +437,7 @@ public class HalveImage { } assert( dest == components * element_size * halfWidth * halfHeight ); } - + public static void halveImage_short( int components, int width, int height, ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -453,10 +453,10 @@ public class HalveImage { ysize, group_size, myswap_bytes ); return; } - + newwidth = width / 2; newheight = height / 2; - + // Piece of cake if( !myswap_bytes ) { for( i = 0; i < newheight; i++ ) { @@ -504,7 +504,7 @@ public class HalveImage { } } } - + public static void halve1Dimage_short( int components, int width, int height, ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -513,14 +513,14 @@ public class HalveImage { int src = 0; int dest = 0; int jj; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // can't be 1x1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -550,7 +550,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -577,7 +577,7 @@ public class HalveImage { } assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - + public static void halveImage_uint( int components, int width, int height, ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -586,7 +586,7 @@ public class HalveImage { int s = 0; int t = 0; double temp = 0; - + // handle case where there is only 1 column/row if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); // can't be 1x1 @@ -594,10 +594,10 @@ public class HalveImage { ysize, group_size, myswap_bytes ); return; } - + newwidth = width / 2; newheight = height / 2; - + // Piece of cake if( !myswap_bytes ) { for( i = 0; i < newheight; i++ ) { @@ -643,7 +643,7 @@ public class HalveImage { } } } - + public static void halve1Dimage_uint( int components, int width, int height, ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -652,14 +652,14 @@ public class HalveImage { int src = 0; int dest = 0; int jj; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // widthxheight can't be 1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { @@ -689,7 +689,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -716,7 +716,7 @@ public class HalveImage { } assert( dest == components * element_size * halfWidth * halfHeight ); } - + public static void halveImage_int( int components, int width, int height, ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -725,7 +725,7 @@ public class HalveImage { int s = 0; int t = 0; int temp = 0; - + // handle case where there is only 1 column/row if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); // can't be 1x1 @@ -733,10 +733,10 @@ public class HalveImage { ysize, group_size, myswap_bytes ); return; } - + newwidth = width / 2; newheight = height / 2; - + // Piece of cake if( !myswap_bytes ) { for( i = 0; i < newheight; i++ ) { @@ -785,7 +785,7 @@ public class HalveImage { } } } - + public static void halve1Dimage_int( int components, int width, int height, ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -794,14 +794,14 @@ public class HalveImage { int src = 0; int dest = 0; int jj; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // can't be 1x1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -831,7 +831,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -858,7 +858,7 @@ public class HalveImage { } assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - + public static void halveImage_float( int components, int width, int height, ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -874,10 +874,10 @@ public class HalveImage { ysize, group_size, myswap_bytes ); return; } - + newwidth = width / 2; newheight = height / 2; - + // Piece of cake if( !myswap_bytes ) { for( i = 0; i < newheight; i++ ) { @@ -920,7 +920,7 @@ public class HalveImage { } } } - + public static void halve1Dimage_float( int components, int width, int height, ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { @@ -929,14 +929,14 @@ public class HalveImage { int src = 0; int dest = 0; int jj; - + assert( width == 1 || height == 1 ); // must be 1D assert( width != height ); // can't be square - + if( height == 1 ) { // 1 row assert( width != 1 ); // can't be 1x1 halfHeight = 1; - + for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -966,7 +966,7 @@ public class HalveImage { halfWidth = 1; // one vertical column with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { @@ -993,9 +993,9 @@ public class HalveImage { } assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, + + public static void halveImagePackedPixel( int components, Extract extract, int width, + int height, ByteBuffer datain, ByteBuffer dataout, int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); @@ -1004,19 +1004,19 @@ public class HalveImage { return; } int ii, jj; - + int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; - + for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { float totals[] = new float[4]; float extractTotals[][] = new float[BOX4][4]; int cc; - + datain.position( src ); extract.extract( isSwap, datain, extractTotals[0] ); datain.position( src + pixelSizeInBytes ); @@ -1045,7 +1045,7 @@ public class HalveImage { assert( src == rowSizeInBytes * height ); assert( outIndex == halfWidth * halfHeight ); } - + public static void halve1DimagePackedPixel( int components, Extract extract, int width, int height, ByteBuffer datain, ByteBuffer dataout, int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { @@ -1053,23 +1053,23 @@ public class HalveImage { int halfHeight = height / 2; int src = 0; int jj; - + assert( width == 1 || height == 1 ); assert( width != height ); - + if( height == 1 ) { int outIndex = 0; - + assert( width != 1 ); halfHeight = 1; - + // one horizontal row with possible pad bytes - + for( jj = 0; jj < halfWidth; jj++ ) { float[] totals = new float[4]; float[][] extractTotals = new float[BOX2][4]; int cc; - + datain.position( src ); extract.extract( isSwap, datain, extractTotals[0] ); datain.position( src + pixelSizeInBytes ); @@ -1090,17 +1090,17 @@ public class HalveImage { } int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; - + assert( src == rowSizeInBytes ); assert( outIndex == halfWidth * halfHeight ); } else if( width == 1 ) { int outIndex = 0; - + assert( height != 1 ); halfWidth = 1; // one vertical volumn with possible pad bytes per row // average two at a time - + for( jj = 0; jj < halfHeight; jj++ ) { float[] totals = new float[4]; float[][] extractTotals = new float[BOX2][4]; @@ -1128,7 +1128,7 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } } - + public static void halveImagePackedPixelSlice( int components, Extract extract, int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, @@ -1140,26 +1140,26 @@ public class HalveImage { int src = 0; int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; - + assert( (width == 1 || height == 1) && depth >= 2 ); - + if( width == height ) { assert( width == 1 && height == 1 ); assert( depth >= 2 ); - + for( ii = 0; ii < halfDepth; ii++ ) { float totals[] = new float[4]; float extractTotals[][] = new float[BOX2][4]; int cc; - + dataIn.position( src ); extract.extract( isSwap, dataIn, extractTotals[0] ); dataIn.position( src + imageSizeInBytes ); extract.extract( isSwap, dataIn, extractTotals[1] ); - + for( cc = 0; cc < components; cc++ ) { int kk; - + // average only 2 pixels since a column totals[cc]= 0.0f; for( kk = 0; kk < BOX2; kk++ ) { @@ -1167,7 +1167,7 @@ public class HalveImage { } totals[cc] /= BOX2; } // for cc - + extract.shove( totals, outIndex, dataOut ); outIndex++; // skip over to next group of 2 @@ -1175,13 +1175,13 @@ public class HalveImage { } // for ii } else if( height == 1 ) { assert( width != 1 ); - + for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { float totals[] = new float[4]; float extractTotals[][] = new float[BOX4][4]; int cc; - + dataIn.position( src ); extract.extract( isSwap, dataIn, extractTotals[0] ); dataIn.position( src + pixelSizeInBytes ); @@ -1190,10 +1190,10 @@ public class HalveImage { extract.extract( isSwap, dataIn, extractTotals[2] ); dataIn.position( src + pixelSizeInBytes + imageSizeInBytes ); extract.extract( isSwap, dataIn, extractTotals[3] ); - + for( cc = 0; cc < components; cc++ ) { int kk; - + // grab 4 pixels to average totals[cc] = 0.0f; for( kk = 0; kk < BOX4; kk++ ) { @@ -1209,13 +1209,13 @@ public class HalveImage { } } else if( width == 1 ) { assert( height != 1 ); - + for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { float totals[] = new float[4]; float extractTotals[][] = new float[BOX4][4]; int cc; - + dataIn.position( src ); extract.extract( isSwap, dataIn, extractTotals[0] ); dataIn.position( src + rowSizeInBytes ); @@ -1224,10 +1224,10 @@ public class HalveImage { extract.extract( isSwap, dataIn, extractTotals[2] ); dataIn.position( src + rowSizeInBytes + imageSizeInBytes ); extract.extract( isSwap, dataIn, extractTotals[3] ); - + for( cc = 0; cc < components; cc++ ) { int kk; - + // grab 4 pixels to average totals[cc] = 0.0f; for( kk = 0; kk < BOX4; kk++ ) { @@ -1243,7 +1243,7 @@ public class HalveImage { } } } - + public static void halveImageSlice( int components, ExtractPrimitive extract, int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, @@ -1255,25 +1255,25 @@ public class HalveImage { int src = 0; int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; - + assert( (width == 1 || height == 1) && depth >= 2 ); - + if( width == height ) { assert( width == 1 && height == 1 ); assert( depth >= 2 ); - + for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { double[] totals = new double[4]; double[][] extractTotals = new double[BOX2][4]; int kk; - + dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + imageSizeInBytes ); extractTotals[1][cc] = extract.extract( isSwap, dataIn ); - + // average 2 pixels since only a column totals[cc] = 0.0f; // totals[red] = extractTotals[0][red] + extractTotals[1][red]; @@ -1282,7 +1282,7 @@ public class HalveImage { totals[cc] += extractTotals[kk][cc]; } totals[cc] /= (double)BOX2; - + extract.shove( totals[cc], outIndex, dataOut ); outIndex++; src += elementSizeInBytes; @@ -1290,12 +1290,12 @@ public class HalveImage { // skip over next group of 2 src += rowSizeInBytes; } // for ii - + assert( src == rowSizeInBytes * height * depth ); assert( outIndex == halfDepth * components ); } else if( height == 1 ) { assert( width != 1 ); - + for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { int cc; @@ -1303,7 +1303,7 @@ public class HalveImage { int kk; double totals[] = new double[4]; double extractTotals[][] = new double[BOX4][4]; - + dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + groupSizeInBytes ); @@ -1312,7 +1312,7 @@ public class HalveImage { extractTotals[2][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); extractTotals[3][cc] = extract.extract( isSwap, dataIn ); - + // grab 4 pixels to average totals[cc] = 0.0f; // totals[red] = extractTotals[0][red] + extractTotals[1][red] + @@ -1322,7 +1322,7 @@ public class HalveImage { totals[cc] += extractTotals[kk][cc]; } totals[cc] /= (double)BOX4; - + extract.shove( totals[cc], outIndex, dataOut ); outIndex++; src += elementSizeInBytes; @@ -1337,7 +1337,7 @@ public class HalveImage { assert( outIndex == halfWidth * halfDepth * components ); } else if( width == 1 ) { assert( height != 1 ); - + for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfHeight; jj++ ) { int cc; @@ -1345,7 +1345,7 @@ public class HalveImage { int kk; double totals[] = new double[4]; double extractTotals[][] = new double[BOX4][4]; - + dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + rowSizeInBytes ); @@ -1354,8 +1354,8 @@ public class HalveImage { extractTotals[2][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + imageSizeInBytes + groupSizeInBytes ); extractTotals[3][cc] = extract.extract( isSwap, dataIn ); - - + + // grab 4 pixels to average totals[cc] = 0.0f; // totals[red] = extractTotals[0][red] + extractTotals[1][red] + @@ -1365,7 +1365,7 @@ public class HalveImage { totals[cc] += extractTotals[kk][cc]; } totals[cc] /= (double)BOX4; - + extract.shove( totals[cc], outIndex, dataOut ); outIndex++; src += elementSizeInBytes; @@ -1380,32 +1380,32 @@ public class HalveImage { assert( outIndex == halfWidth * halfDepth * components ); } } - + public static void halveImage3D( int components, ExtractPrimitive extract, int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, int imageSizeInBytes, boolean isSwap ) { assert( depth > 1 ); - + // horizontal/vertical/onecolumn slice viewed from top if( width == 1 || height == 1 ) { assert( 1 <= depth ); - + halveImageSlice( components, extract, width, height, depth, dataIn, dataOut, elementSizeInBytes, groupSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap ); return; } - + int ii, jj, dd; - + int halfWidth = width / 2; int halfHeight = height / 2; int halfDepth = depth / 2; int src = 0; int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; - + for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { @@ -1414,7 +1414,7 @@ public class HalveImage { int kk; double totals[] = new double[4]; double extractTotals[][] = new double[BOX8][4]; - + dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + groupSizeInBytes ); @@ -1431,17 +1431,17 @@ public class HalveImage { extractTotals[6][cc] = extract.extract( isSwap, dataIn ); dataIn.position( src + rowSizeInBytes + imageSizeInBytes + groupSizeInBytes ); extractTotals[7][cc] = extract.extract( isSwap, dataIn ); - + totals[cc] = 0.0f; - + for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } totals[cc] /= (double)BOX8; - + extract.shove( totals[cc], outIndex, dataOut ); outIndex++; - + src += elementSizeInBytes; } // for cc // skip over to next square of 4 @@ -1456,40 +1456,40 @@ public class HalveImage { assert( src == rowSizeInBytes * height * depth ); assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - + public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, + int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, int imageSizeInBytes, boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); - + halveImagePackedPixel( components, extract, width, height, dataIn, dataOut, pixelSizeInBytes, rowSizeInBytes, isSwap ); return; } else if( width == 1 || height == 1 ) { // a horizontal or vertical slice viewed from top assert( 1 <= depth ); - + halveImagePackedPixelSlice( components, extract, width, height, depth, dataIn, dataOut, pixelSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap ); return; } int ii, jj, dd; - + int halfWidth = width / 2; int halfHeight = height / 2; int halfDepth = depth / 2; int src = 0; int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; - + for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { float totals[] = new float[4]; // 4 is max components float extractTotals[][] = new float[BOX8][4]; int cc; - + dataIn.position( src ); extract.extract( isSwap, dataIn, extractTotals[0] ); dataIn.position( src + pixelSizeInBytes ); @@ -1506,7 +1506,7 @@ public class HalveImage { extract.extract( isSwap, dataIn, extractTotals[6] ); dataIn.position( src + rowSizeInBytes + pixelSizeInBytes + imageSizeInBytes ); extract.extract( isSwap, dataIn, extractTotals[7] ); - + for( cc = 0; cc < components; cc++ ) { int kk; // grab 8 pixels to average diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index b610ce86b..18f814dde 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -53,18 +53,18 @@ import java.nio.*; * @author Administrator */ public class Image { - + /** Creates a new instance of Image */ public Image() { } - + public static short getShortFromByteArray( byte[] array, int index ) { short s; s = (short)(array[index] << 8 ); s |= (short)(0x00FF & array[index+1]); return( s ); } - + public static int getIntFromByteArray( byte[] array, int index ) { int i; i = ( array[index] << 24 ) & 0xFF000000; @@ -73,12 +73,12 @@ public class Image { i |= ( array[index+3] ) & 0x000000FF; return( i ); } - + public static float getFloatFromByteArray( byte[] array, int index ) { int i = getIntFromByteArray( array, index ); return( Float.intBitsToFloat(i) ); } - + /* * Extract array from user's data applying all pixel store modes. * The internal format used is an array of unsigned shorts. @@ -98,7 +98,7 @@ public class Image { int iter2; int i, j, k; boolean myswap_bytes; - + // Create a Extract interface object Extract extract = null; switch( type ) { @@ -139,7 +139,7 @@ public class Image { extract = new Extract2101010rev(); break; } - + myswap_bytes = psm.getUnpackSwapBytes(); components = Mipmap.elements_per_group( format, type ); if( psm.getUnpackRowLength() > 0 ) { @@ -147,12 +147,12 @@ public class Image { } else { groups_per_line = width; } - + // All formats except GL_BITMAP fall out trivially if( type == GL2.GL_BITMAP ) { int bit_offset; int current_bit; - + rowsize = ( groups_per_line * components + 7 ) / 8; padding = ( rowsize % psm.getUnpackAlignment() ); if( padding != 0 ) { @@ -200,7 +200,7 @@ public class Image { if( element_size == 1 ) { myswap_bytes = false; } - + rowsize = groups_per_line * group_size; padding = ( rowsize % psm.getUnpackAlignment() ); if( padding != 0 ) { @@ -208,7 +208,7 @@ public class Image { } start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; elements_per_line = width * components; - + iter2 = 0; for( i = 0; i < height; i++ ) { iter = start; @@ -364,7 +364,7 @@ public class Image { // want iter pointing at start, not within, row for assertion purposes iter = start; } // for i - + // iterators should be one byte past end if( !Mipmap.isTypePackedPixel( type ) ) { assert( iter2 == ( width * height * components ) ); @@ -374,16 +374,16 @@ public class Image { assert( iter == ( rowsize * height + psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ) ); } } - + /* * Insert array into user's data applying all pixel store modes. * Theinternal format is an array of unsigned shorts. * empty_image() because it is the opposet of fill_image(). */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, + public static void empty_image( PixelStorageModes psm, int width, int height, + int format, int type, boolean index_format, ShortBuffer oldimage, ByteBuffer userdata ) { - + int components; int element_size; int rowsize; @@ -396,7 +396,7 @@ public class Image { int iter2; int i, j, k; boolean myswap_bytes; - + // Create a Extract interface object Extract extract = null; switch( type ) { @@ -437,7 +437,7 @@ public class Image { extract = new Extract2101010rev(); break; } - + myswap_bytes = psm.getPackSwapBytes(); components = Mipmap.elements_per_group( format, type ); if( psm.getPackRowLength() > 0 ) { @@ -445,12 +445,12 @@ public class Image { } else { groups_per_line = width; } - + // all formats except GL_BITMAP fall out trivially if( type == GL2.GL_BITMAP ) { int bit_offset; int current_bit; - + rowsize = ( groups_per_line * components + 7 ) / 8; padding = ( rowsize % psm.getPackAlignment() ); if( padding != 0 ) { @@ -472,7 +472,7 @@ public class Image { current_bit = 0; } } - + if( current_bit != 0 ) { if( psm.getPackLsbFirst() ) { userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 1 << bit_offset ) ) ) ); @@ -488,7 +488,7 @@ public class Image { userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 7 - bit_offset ) ) ) ); } } - + bit_offset++; if( bit_offset == 8 ) { bit_offset = 0; @@ -500,13 +500,13 @@ public class Image { } } else { float shoveComponents[] = new float[4]; - + element_size = Mipmap.bytes_per_element( type ); group_size = element_size * components; if( element_size == 1 ) { myswap_bytes = false; } - + rowsize = groups_per_line * group_size; padding = ( rowsize % psm.getPackAlignment() ); if( padding != 0 ) { @@ -514,13 +514,13 @@ public class Image { } start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size; elements_per_line = width * components; - + iter2 = 0; for( i = 0; i < height; i++ ) { iter = start; for( j = 0; j < elements_per_line; j++ ) { Type_Widget widget = new Type_Widget(); - + switch( type ) { case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { @@ -799,7 +799,7 @@ public class Image { assert( iter == rowsize * height + psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size ); } } - + public static void fillImage3D( PixelStorageModes psm, int width, int height, int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, ShortBuffer newImage ) { @@ -819,7 +819,7 @@ public class Image { int ww, hh, dd, k; Type_Widget widget = new Type_Widget(); float extractComponents[] = new float[4]; - + // Create a Extract interface object Extract extract = null; switch( type ) { @@ -860,7 +860,7 @@ public class Image { extract = new Extract2101010rev(); break; } - + myswapBytes = psm.getUnpackSwapBytes(); components = Mipmap.elements_per_group( format, type ); if( psm.getUnpackRowLength() > 0 ) { @@ -873,7 +873,7 @@ public class Image { if( elementSize == 1 ) { myswapBytes = false; } - + // 3dstuff begin if( psm.getUnpackImageHeight() > 0 ) { rowsPerImage = psm.getUnpackImageHeight(); @@ -881,27 +881,27 @@ public class Image { rowsPerImage = height; } // 3dstuff end - + rowSize = groupsPerLine * groupSize; padding = rowSize % psm.getUnpackAlignment(); if( padding != 0 ) { rowSize += psm.getUnpackAlignment() - padding; } - + imageSize = rowsPerImage * rowSize; // 3dstuff - - start = psm.getUnpackSkipRows() * rowSize + - psm.getUnpackSkipPixels() * groupSize + + + start = psm.getUnpackSkipRows() * rowSize + + psm.getUnpackSkipPixels() * groupSize + psm.getUnpackSkipImages() * imageSize; elementsPerLine = width * components; - + iter2 = 0; for( dd = 0; dd < depth; dd++ ) { rowStart = start; for( hh = 0; hh < height; hh++ ) { iter = rowStart; for( ww = 0; ww < elementsPerLine; ww++ ) { - + switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): if( indexFormat ) { @@ -1063,18 +1063,18 @@ public class Image { } // for hh start += imageSize; }// for dd - + // iterators should be one byte past end if( !Mipmap.isTypePackedPixel( type ) ) { assert( iter2 == width * height * depth * components ); } else { assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); } - assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize + + assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize + psm.getUnpackSkipPixels() * groupSize + psm.getUnpackSkipImages() * imageSize ); } - + public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { boolean myswapBytes; @@ -1092,7 +1092,7 @@ public class Image { int imageSize; Type_Widget widget = new Type_Widget(); float[] shoveComponents = new float[4]; - + // Create a Extract interface object Extract extract = null; switch( type ) { @@ -1133,9 +1133,9 @@ public class Image { extract = new Extract2101010rev(); break; } - + iter = 0; - + myswapBytes = psm.getPackSwapBytes(); components = Mipmap.elements_per_group( format, type ); if( psm.getPackRowLength() > 0 ) { @@ -1143,44 +1143,44 @@ public class Image { } else { groupsPerLine = width; } - + elementSize = Mipmap.bytes_per_element( type ); groupSize = elementSize * components; if( elementSize == 1 ) { myswapBytes = false; } - + // 3dstuff begin if( psm.getPackImageHeight() > 0 ) { rowsPerImage = psm.getPackImageHeight(); } else { rowsPerImage = height; } - + // 3dstuff end - + rowSize = groupsPerLine * groupSize; padding = rowSize % psm.getPackAlignment(); if( padding != 0 ) { rowSize += psm.getPackAlignment() - padding; } - + imageSize = rowsPerImage * rowSize; - + start = psm.getPackSkipRows() * rowSize + psm.getPackSkipPixels() * groupSize + psm.getPackSkipImages() * imageSize; elementsPerLine = width * components; - + iter2 = 0; for( dd = 0; dd < depth; dd++ ) { rowStart = start; - + for( ii = 0; ii < height; ii++ ) { iter = rowStart; - + for( jj = 0; jj < elementsPerLine; jj++ ) { - + switch( type ) { case( GL2.GL_UNSIGNED_BYTE ): if( indexFormat ) { @@ -1392,20 +1392,20 @@ public class Image { default: assert( false ); } - + iter += elementSize; } // for jj rowStart += rowSize; } // for ii start += imageSize; } // for dd - + if( !Mipmap.isTypePackedPixel( type ) ) { assert( iter2 == width * height * depth * components ); } else { assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) ); } - assert( iter == rowSize * height * depth + + assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize + psm.getUnpackSkipPixels() * groupSize + psm.getUnpackSkipImages() * imageSize ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index b74d0a6b8..938873ec5 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -57,11 +57,11 @@ import com.jogamp.common.nio.Buffers; * @author Administrator */ public class Mipmap { - + /** Creates a new instance of Mipmap */ public Mipmap() { } - + public static int computeLog( int value ) { int i = 0; // Error @@ -79,7 +79,7 @@ public class Mipmap { i++; } } - + /* Compute the nearest power of 2 number. This algorithm is a little strange * but it works quite well. */ @@ -99,7 +99,7 @@ public class Mipmap { i *= 2; } } - + public static short GLU_SWAP_2_BYTES( short s ) { byte b = 0; b = (byte)( s >>> 8 ); @@ -107,7 +107,7 @@ public class Mipmap { s = (short)( s | (0x00FF & b) ); return( s ); } - + public static int GLU_SWAP_4_BYTES( int i ) { int t = i << 24; t |= 0x00FF0000 & ( i << 8 ); @@ -115,13 +115,13 @@ public class Mipmap { t |= 0x000000FF & ( i >>> 24 ); return( t ); } - + public static float GLU_SWAP_4_BYTES( float f ) { int i = Float.floatToRawIntBits( f ); float temp = Float.intBitsToFloat( i ); return( temp ); } - + public static int checkMipmapArgs( int internalFormat, int format, int type ) { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); @@ -134,7 +134,7 @@ public class Mipmap { } return( 0 ); } - + public static boolean legalFormat( int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): @@ -155,7 +155,7 @@ public class Mipmap { return( false ); } } - + public static boolean legalType( int type ) { switch( type ) { case( GL2.GL_BITMAP ): @@ -183,10 +183,10 @@ public class Mipmap { return( false ); } } - + public static boolean isTypePackedPixel( int type ) { assert( legalType( type ) ); - + if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || @@ -203,20 +203,20 @@ public class Mipmap { } return( false ); } - + public static boolean isLegalFormatForPackedPixelType( int format, int type ) { // if not a packed pixel type then return true if( isTypePackedPixel( type ) ) { return( true ); } - + // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) & format != GL2GL3.GL_RGB ) { return( false ); } - + // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || @@ -232,7 +232,7 @@ public class Mipmap { } return( true ); } - + public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, int totalLevels ) { if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || @@ -241,7 +241,7 @@ public class Mipmap { } return( true ); } - + /* Given user requested textures size, determine if it fits. If it doesn't then * halve both sides and make the determination again until it does fit ( for * IR only ). @@ -257,7 +257,7 @@ public class Mipmap { int heightPowerOf2 = nearestPower( height ); int[] proxyWidth = new int[1]; boolean noProxyTextures = false; - + // Some drivers (in particular, ATI's) seem to set a GL error // when proxy textures are used even though this is in violation // of the spec. Guard against this and interactions with the @@ -268,20 +268,20 @@ public class Mipmap { int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); int proxyTarget; - + assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); - + // does width x height at level 1 & all their mipmaps fit? if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); - } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, @@ -289,7 +289,7 @@ public class Mipmap { } else { assert( target == GL2GL3.GL_TEXTURE_1D || target == GL2GL3.GL_PROXY_TEXTURE_1D ); proxyTarget = GL2GL3.GL_PROXY_TEXTURE_1D; - gl.getGL2GL3().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, + gl.getGL2GL3().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, 0, format, type, null ); } if(gl.isGL2GL3()) { @@ -336,15 +336,15 @@ public class Mipmap { newHeight[0] = maxsize[0]; } } - - public static void closestFit3D( GL gl, int target, int width, int height, int depth, + + public static void closestFit3D( GL gl, int target, int width, int height, int depth, int internalFormat, int format, int type, int[] newWidth, int[] newHeight, int[] newDepth ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); int depthPowerOf2 = nearestPower( depth ); int[] proxyWidth = new int[1]; - + do { // compute level 1 width & height & depth, clamping each at 1 int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; @@ -354,7 +354,7 @@ public class Mipmap { assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); assert( depthAtLevelOne > 0 ); - + // does width x height x depth at level 1 & all their mipmaps fit? if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D; @@ -378,16 +378,16 @@ public class Mipmap { } } while( proxyWidth[0] == 0 ); // loop must terminate - + // return the width & height at level 0 that fits newWidth[0] = widthPowerOf2; newHeight[0] = heightPowerOf2; newDepth[0] = depthPowerOf2; } - + public static int elements_per_group( int format, int type ) { // Return the number of elements per grtoup of a specified gromat - + // If the type is packedpixels then answer is 1 if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || @@ -403,7 +403,7 @@ public class Mipmap { type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( 1 ); } - + // Types are not packed pixels so get elements per group switch( format ) { case( GL2GL3.GL_RGB ): @@ -418,10 +418,10 @@ public class Mipmap { return( 1 ); } } - + public static int bytes_per_element( int type ) { // return the number of bytes per element, based on the element type - + switch( type ) { case( GL2.GL_BITMAP ): case( GL2GL3.GL_BYTE ): @@ -450,17 +450,17 @@ public class Mipmap { return( 4 ); } } - + public static boolean is_index( int format ) { return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); } - + /* Compute memory required for internal packed array of data of given type and format. */ - + public static int image_size( int width, int height, int format, int type ) { int bytes_per_row; int components; - + assert( width > 0 ); assert( height > 0 ); components = elements_per_group( format, type ); @@ -471,17 +471,17 @@ public class Mipmap { } return( bytes_per_row * height * components ); } - + public static int imageSize3D( int width, int height, int depth, int format, int type ) { int components = elements_per_group( format, type ); int bytes_per_row = bytes_per_element( type ) * width; - + assert( width > 0 && height > 0 && depth > 0 ); assert( type != GL2.GL_BITMAP ); - + return( bytes_per_row * height * depth * components ); } - + public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { int[] a = new int[1]; gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); @@ -496,7 +496,7 @@ public class Mipmap { psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - + gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); @@ -510,7 +510,7 @@ public class Mipmap { gl.glGetIntegerv( GL2GL3.GL_PACK_SWAP_BYTES, a, 0); psm.setPackSwapBytes( ( a[0] == 1 ) ); } - + public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { int[] a = new int[1]; gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); @@ -529,7 +529,7 @@ public class Mipmap { psm.setUnpackSkipImages( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - + gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); @@ -547,9 +547,9 @@ public class Mipmap { gl.glGetIntegerv( GL2GL3.GL_PACK_IMAGE_HEIGHT, a, 0 ); psm.setPackImageHeight( a[0] ); } - - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, + + public static int gluScaleImage( GL gl, int format, int widthin, int heightin, + int typein, ByteBuffer datain, int widthout, int heightout, int typeout, ByteBuffer dataout ) { int datainPos = datain.position(); int dataoutPos = dataout.position(); @@ -559,7 +559,7 @@ public class Mipmap { ByteBuffer beforeimage; ByteBuffer afterimage; PixelStorageModes psm = new PixelStorageModes(); - + if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { return( 0 ); } @@ -580,20 +580,20 @@ public class Mipmap { if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } - + retrieveStoreModes( gl, psm ); Image.fill_image( psm, widthin, heightin, format, typein, is_index( format ), datain, beforeimage.asShortBuffer() ); components = elements_per_group( format, 0 ); ScaleInternal.scale_internal( components, widthin, heightin, beforeimage.asShortBuffer(), widthout, heightout, afterimage.asShortBuffer() ); Image.empty_image( psm, widthout, heightout, format, typeout, is_index( format ), afterimage.asShortBuffer(), dataout ); - + return( 0 ); } finally { datain.position(datainPos); dataout.position(dataoutPos); } } - + public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, ByteBuffer data ) { @@ -601,30 +601,30 @@ public class Mipmap { try { int levels; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - + levels = computeLog( width ); - + levels += userLevel; if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { return( GLU.GLU_INVALID_VALUE ); } - + return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, width, width, format, type, userLevel, baseLevel, maxLevel, data ) ); } finally { data.position(dataPos); } } - + public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, int format, int type, ByteBuffer data ) { int dataPos = data.position(); @@ -633,54 +633,54 @@ public class Mipmap { int[] widthPowerOf2 = new int[1]; int levels; int[] dummy = new int[1]; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - + closestFit( gl, target, width, 1, internalFormat, format, type, widthPowerOf2, dummy ); levels = computeLog( widthPowerOf2[0] ); - - return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, + + return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, width, widthPowerOf2[0], format, type, 0, 0, levels, data ) ); } finally { data.position(dataPos); } } - + public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, Object data ) { int dataPos = 0; int level, levels; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 || height < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - + levels = computeLog( width ); level = computeLog( height ); if( level > levels ) { levels = level; } - + levels += userLevel; if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { return( GLU.GLU_INVALID_VALUE ); } - + //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); ByteBuffer buffer = null; if( data instanceof ByteBuffer ) { @@ -706,7 +706,7 @@ public class Mipmap { FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } - + try { return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, width, height, width, height, format, type, userLevel, baseLevel, @@ -716,7 +716,7 @@ public class Mipmap { } } - + public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, int width, int height, int format, int type, Object data ) { int dataPos = 0; @@ -724,25 +724,25 @@ public class Mipmap { int[] widthPowerOf2 = new int[1]; int[] heightPowerOf2 = new int[1]; int level, levels; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 || height < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - - closestFit( gl, target, width, height, internalFormat, format, type, + + closestFit( gl, target, width, height, internalFormat, format, type, widthPowerOf2, heightPowerOf2 ); - + levels = computeLog( widthPowerOf2[0] ); level = computeLog( heightPowerOf2[0] ); if( level > levels ) { levels = level; } - + //PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data ); ByteBuffer buffer = null; if( data instanceof ByteBuffer ) { @@ -768,17 +768,17 @@ public class Mipmap { FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } - + try { - return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, - width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0, + return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat, + width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0, 0, levels, buffer ) ); } finally { buffer.position(dataPos); } } - - + + public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, int width, int height, int depth, int format, int type, ByteBuffer data ) { int dataPos = data.position(); @@ -788,23 +788,23 @@ public class Mipmap { int[] heightPowerOf2 = new int[1]; int[] depthPowerOf2 = new int[1]; int level, levels; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 || height < 1 || depth < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - + if( type == GL2.GL_BITMAP ) { return( GLU.GLU_INVALID_ENUM ); } - + closestFit3D( gl, target, width, height, depth, internalFormat, format, type, widthPowerOf2, heightPowerOf2, depthPowerOf2 ); - + levels = computeLog( widthPowerOf2[0] ); level = computeLog( heightPowerOf2[0] ); if( level > levels ) { @@ -814,7 +814,7 @@ public class Mipmap { if( level > levels ) { levels = level; } - + return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, height, depth, widthPowerOf2[0], heightPowerOf2[0], depthPowerOf2[0], format, type, 0, 0, levels, data ) ); @@ -822,27 +822,27 @@ public class Mipmap { data.position(dataPos); } } - + public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, int width, int height, int depth, int format, int type, int userLevel, int baseLevel, int maxLevel, ByteBuffer data ) { int dataPos = data.position(); try { int level, levels; - + int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } - + if( width < 1 || height < 1 || depth < 1 ) { return( GLU.GLU_INVALID_VALUE ); } - + if( type == GL2.GL_BITMAP ) { return( GLU.GLU_INVALID_ENUM ); } - + levels = computeLog( width ); level = computeLog( height ); if( level > levels ) { @@ -852,12 +852,12 @@ public class Mipmap { if( level > levels ) { levels = level; } - + levels += userLevel; if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) { return( GLU.GLU_INVALID_VALUE ); } - + return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width, height, depth, width, height, depth, format, type, userLevel, baseLevel, maxLevel, data ) ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java index 0b1af8323..7eb98db35 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -129,7 +129,7 @@ public class PixelStorageModes { * Holds value of property unpackImageHeight. */ private int unpackImageHeight; - + /** Creates a new instance of PixelStorageModes */ public PixelStorageModes() { } @@ -421,6 +421,6 @@ public class PixelStorageModes { this.unpackImageHeight = unpackImageHeight; } - - + + } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 9c95ae304..9aca1fb03 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -55,9 +55,9 @@ import com.jogamp.common.nio.Buffers; * @author Administrator */ public class ScaleInternal { - + public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); - + public static void scale_internal( int components, int widthin, int heightin, ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { float x, lowx, highx, convx, halfconvx; @@ -69,7 +69,7 @@ public class ScaleInternal { float area; int i, j, k, yint, xint, xindex, yindex; int temp; - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { HalveImage.halveImage( components, widthin, heightin, datain, dataout ); return; @@ -101,7 +101,7 @@ public class ScaleInternal { // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; area = 0.0f; - + y = lowy; yint = (int)Math.floor( y ); while( y < highy ) { @@ -111,10 +111,10 @@ public class ScaleInternal { } else { ypercent = yint + 1 - y; } - + x = lowx; xint = (int)Math.floor( x ); - + while( x < highx ) { xindex = ( xint + widthin ) % widthin; if( highx < xint + 1 ) { @@ -122,21 +122,21 @@ public class ScaleInternal { } else { xpercent = xint + 1 - x; } - + percent = xpercent * ypercent; area += percent; temp = ( xindex + ( yindex * widthin) ) * components; for( k = 0; k < components; k++ ) { - totals[k] += datain.get( temp + k ) * percent; + totals[k] += datain.get( temp + k ) * percent; } - + xint++; x = xint; } yint++; y = yint; } - + temp = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { // totals[] should be rounded in the case of enlarging an RGB @@ -146,9 +146,9 @@ public class ScaleInternal { } } } - + public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, + ByteBuffer datain, int widthout, int heightout, ByteBuffer dataout, int element_size, int ysize, int group_size ) { float x, convx; float y, convy; @@ -157,11 +157,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -169,9 +169,9 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout, element_size, ysize, group_size ); return; } @@ -181,14 +181,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -204,19 +204,19 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -239,7 +239,7 @@ public class ScaleInternal { datain.position( temp_index ); totals[k] += ( 0x000000FF & datain.get() ) * percent; } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -261,7 +261,7 @@ public class ScaleInternal { datain.position( temp_index ); totals[k] += ( 0x000000FF & datain.get() ) * percent; } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -339,7 +339,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -371,9 +371,9 @@ public class ScaleInternal { } } } - + public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, + ByteBuffer datain, int widthout, int heightout, ByteBuffer dataout, int element_size, int ysize, int group_size ) { float x, convx; @@ -383,11 +383,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -395,9 +395,9 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout, element_size, ysize, group_size ); return; } @@ -407,14 +407,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -430,18 +430,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -464,7 +464,7 @@ public class ScaleInternal { datain.position( temp_index ); totals[k] += datain.get() * percent; } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -486,7 +486,7 @@ public class ScaleInternal { datain.position( temp_index ); totals[k] += datain.get() * percent; } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -550,7 +550,7 @@ public class ScaleInternal { totals[k] += datain.get() * percent; } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -564,7 +564,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -596,10 +596,10 @@ public class ScaleInternal { } } } - + public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, + ByteBuffer datain, int widthout, int heightout, + ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { float x, convx; float y, convy; @@ -608,11 +608,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -620,9 +620,9 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout, element_size, ysize, group_size, myswap_bytes ); return; } @@ -632,14 +632,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -655,18 +655,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -701,7 +701,7 @@ public class ScaleInternal { totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; } } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -735,7 +735,7 @@ public class ScaleInternal { totals[k] += ( 0x0000FFFF & datain.getShort()) * percent; } } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -834,7 +834,7 @@ public class ScaleInternal { } } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -852,7 +852,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -884,10 +884,10 @@ public class ScaleInternal { } } } - + public static void scale_internal_short( int components, int widthin, int heightin, ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, + ShortBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { float x, convx; float y, convy; @@ -896,11 +896,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -908,11 +908,11 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + int swapbuf; // unsigned buffer - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_short( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_short( components, widthin, heightin, datain, dataout, element_size, ysize, group_size, myswap_bytes ); return; } @@ -922,14 +922,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -945,18 +945,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -994,7 +994,7 @@ public class ScaleInternal { totals[k] += datain.getShort() * percent; } } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -1031,7 +1031,7 @@ public class ScaleInternal { totals[k] += datain.getShort() * percent; } } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -1137,7 +1137,7 @@ public class ScaleInternal { } } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -1156,7 +1156,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -1188,10 +1188,10 @@ public class ScaleInternal { } } } - + public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, + ByteBuffer datain, int widthout, int heightout, + IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { float x, convx; float y, convy; @@ -1200,11 +1200,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -1212,9 +1212,9 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout, element_size, ysize, group_size, myswap_bytes ); return; } @@ -1224,14 +1224,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -1247,18 +1247,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -1293,7 +1293,7 @@ public class ScaleInternal { totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; } } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -1327,7 +1327,7 @@ public class ScaleInternal { totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent; } } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -1427,7 +1427,7 @@ public class ScaleInternal { } } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -1445,7 +1445,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; float value = 0.0f; for( k = 0; k < components; k++ ) { @@ -1483,10 +1483,10 @@ public class ScaleInternal { } } } - + public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, + ByteBuffer datain, int widthout, int heightout, + IntBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { float x, convx; float y, convy; @@ -1495,11 +1495,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -1507,11 +1507,11 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + long swapbuf; // unsigned buffer - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_int( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_int( components, widthin, heightin, datain, dataout, element_size, ysize, group_size, myswap_bytes ); return; } @@ -1521,14 +1521,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -1544,18 +1544,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -1593,7 +1593,7 @@ public class ScaleInternal { totals[k] += datain.getInt() * percent; } } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -1630,7 +1630,7 @@ public class ScaleInternal { totals[k] += datain.getInt() * percent; } } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -1736,7 +1736,7 @@ public class ScaleInternal { } } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -1755,7 +1755,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -1787,10 +1787,10 @@ public class ScaleInternal { } } } - + public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, + ByteBuffer datain, int widthout, int heightout, + FloatBuffer dataout, int element_size, int ysize, int group_size, boolean myswap_bytes ) { float x, convx; float y, convy; @@ -1799,11 +1799,11 @@ public class ScaleInternal { float[] totals = new float[4]; float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outindex; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -1811,11 +1811,11 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + float swapbuf; // unsigned buffer - + if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) { - HalveImage.halveImage_float( components, widthin, heightin, datain, dataout, + HalveImage.halveImage_float( components, widthin, heightin, datain, dataout, element_size, ysize, group_size, myswap_bytes ); return; } @@ -1825,14 +1825,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convy_float; - + for( i = 0; i < heightout; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightin) @@ -1848,18 +1848,18 @@ public class ScaleInternal { highx_int = convx_int; highx_float = convx_float; } - + for( j = 0; j < widthout; j++ ) { - + // Ok, now apply box filter to box that goes from (lowx, lowy) // to (highx, highy) on input data into this pixel on output // data. totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // caulate the value for pixels in the 1st row xindex = lowx_int * group_size; if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * ysize; percent = y_percent * ( 1 - lowx_float ); @@ -1897,7 +1897,7 @@ public class ScaleInternal { totals[k] += datain.getFloat() * percent; } } - + // calculate the value for pixels in the last row y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); @@ -1934,7 +1934,7 @@ public class ScaleInternal { totals[k] += datain.getFloat() * percent; } } - + // calculate the value for the pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += ysize; @@ -2040,7 +2040,7 @@ public class ScaleInternal { } } } - + // this is for the pixels in the body temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -2059,7 +2059,7 @@ public class ScaleInternal { } temp0 += ysize; } - + outindex = ( j + ( i * widthout ) ) * components; for( k = 0; k < components; k++ ) { dataout.position( outindex + k ); @@ -2091,28 +2091,28 @@ public class ScaleInternal { } } } - - public static void scaleInternalPackedPixel( int components, Extract extract, + + public static void scaleInternalPackedPixel( int components, Extract extract, int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { float x, convx; float y, convy; float percent; - + // max components in a format is 4, so float[] totals = new float[4]; float[] extractTotals = new float[4]; float[] extractMoreTotals = new float[4]; float[] shoveTotals = new float[4]; - + float area; int i, j, k, xindex; - + int temp, temp0; int temp_index; int outIndex = 0; - + int lowx_int, highx_int, lowy_int, highy_int; float x_percent, y_percent; float lowx_float, highx_float, lowy_float, highy_float; @@ -2120,7 +2120,7 @@ public class ScaleInternal { int convy_int, convx_int; int l, m; int left, right; - + if( widthIn == widthOut * 2 && heightIn == heightOut * 2 ) { HalveImage.halveImagePackedPixel( components, extract, widthIn, heightIn, dataIn, dataOut, pixelSizeInBytes, rowSizeInBytes, isSwap ); @@ -2132,14 +2132,14 @@ public class ScaleInternal { convy_float = convy - convy_int; convx_int = (int)Math.floor( convx ); convx_float = convx - convx_int; - + area = convx * convy; - + lowy_int = 0; lowy_float = 0.0f; highy_int = convy_int; highy_float = convx_float; - + for( i = 0; i < heightOut; i++ ) { // Clamp here to be sure we don't read beyond input buffer. if (highy_int >= heightIn) @@ -2148,16 +2148,16 @@ public class ScaleInternal { lowx_float = 0.0f; highx_int = convx_int; highx_float = convx_float; - + for( j = 0; j < widthOut; j++ ) { // ok now apply box filter to box that goes from( lowx, lowy ) // to ( highx, highy ) on input data into this pixel on output data totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; - + // calculate that value for pixels in the 1st row xindex = lowx_int * pixelSizeInBytes; if( (highy_int > lowy_int) && (highx_int > lowx_int) ) { - + y_percent = 1 - lowy_float; temp = xindex + lowy_int * rowSizeInBytes; percent = y_percent * ( 1 - lowx_float ); @@ -2184,7 +2184,7 @@ public class ScaleInternal { totals[k] += extractTotals[k] * percent; } // calculate the value for pixels in the last row - + y_percent = highy_float; percent = y_percent * ( 1 - lowx_float ); temp = xindex + highy_int * rowSizeInBytes; @@ -2207,7 +2207,7 @@ public class ScaleInternal { for( k = 0; k < components; k++ ) { totals[k] += extractTotals[k] * percent; } - + // calculate the value for pixels in the 1st and last column for( m = lowy_int + 1; m < highy_int; m++ ) { left += rowSizeInBytes; @@ -2277,7 +2277,7 @@ public class ScaleInternal { totals[k] += extractTotals[k] * percent; } } - + // this is for the pixels in the body temp0 = xindex + pixelSizeInBytes + ( lowy_int + 1 ) * rowSizeInBytes; for( m = lowy_int + 1; m < highy_int; m++ ) { @@ -2292,7 +2292,7 @@ public class ScaleInternal { } temp0 += rowSizeInBytes; } - + outIndex = ( j + ( i * widthOut ) ); for( k = 0; k < components; k++ ) { shoveTotals[k] = totals[k] / area; @@ -2325,7 +2325,7 @@ public class ScaleInternal { } assert( outIndex == ( widthOut * heightOut - 1) ); } - + public static void scaleInternal3D( int components, int widthIn, int heightIn, int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, int depthOut, ShortBuffer dataOut ) { @@ -2339,9 +2339,9 @@ public class ScaleInternal { float volume; int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; int temp; - + lowy = highy = lowx = highx = 0.0f; - + convz = (float)depthIn / depthOut; convy = (float)heightIn / heightOut; convx = (float)widthIn / widthOut; @@ -2375,13 +2375,13 @@ public class ScaleInternal { highz = x + 0.5f; lowz = x - 0.5f; } - + // Ok, now apply box filter to box that goes from ( lowx, lowy, lowz ) // to ( highx, highy, highz ) on input data into this pixel on output data - + totals[0] = totals[1] = totals[2] = totals[3] = 0.0f; volume = 0.0f; - + z = lowz; zint = (int)(Math.floor( z ) ); while( z < highz ) { @@ -2391,7 +2391,7 @@ public class ScaleInternal { } else { zpercent = zint + 1 - z; } - + y = lowy; yint = (int)(Math.floor( y ) ); while( y < highy ) { @@ -2401,10 +2401,10 @@ public class ScaleInternal { } else { ypercent = yint + 1 - y; } - + x = lowx; xint = (int)(Math.floor( x ) ); - + while( x < highx ) { xindex = (xint + widthIn ) % widthIn; if( highx < xint + 1 ) { @@ -2412,10 +2412,10 @@ public class ScaleInternal { } else { xpercent = xint + 1 - x; } - + percent = xpercent * ypercent * zpercent; volume += percent; - + temp = (xindex + ( yindex *widthIn) + (zindex * widthIn *heightIn)) * components; for( k = 0; k < components; k++ ) { assert( 0 <= (temp+k) && (temp+k) < (widthIn * heightIn * depthIn * components) ); @@ -2430,7 +2430,7 @@ public class ScaleInternal { zint++; z = zint; } // while z - + temp = ( j + ( i * widthOut ) + (d * widthOut * heightOut ) ) * components; for( k = 0; k < components; k++ ) { // totals should be rounded in the case of enlarging an rgb ramp when the type is 332 or 4444 @@ -2441,48 +2441,48 @@ public class ScaleInternal { } } } - - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, + + public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, + int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, int depthOut, int typeOut, ByteBuffer dataOut ) { int components; ShortBuffer beforeImage, afterImage; PixelStorageModes psm = new PixelStorageModes(); - + if( widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0 ) { return( 0 ); } - + if( widthIn < 0 || heightIn < 0 || depthIn < 0 || widthOut < 0 || heightOut < 0 || depthOut < 0 ) { return( GLU.GLU_INVALID_VALUE ); } - - if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) || + + if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) || !Mipmap.legalType(typeOut) || typeIn == GL2.GL_BITMAP || typeOut == GL2.GL_BITMAP ) { return( GLU.GLU_INVALID_ENUM ); } - + if( !Mipmap.isLegalFormatForPackedPixelType( format, typeIn ) ) { return( GLU.GLU_INVALID_OPERATION ); } - + if( !Mipmap.isLegalFormatForPackedPixelType( format, typeOut ) ) { return( GLU.GLU_INVALID_OPERATION ); } - + try { - beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, + beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, + afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); } catch( OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } Mipmap.retrieveStoreModes3D( gl, psm ); - + Image.fillImage3D( psm, widthIn, heightIn, depthIn, format, typeIn, Mipmap.is_index( format ), dataIn, beforeImage ); components = Mipmap.elements_per_group( format, 0 ); @@ -2490,7 +2490,7 @@ public class ScaleInternal { beforeImage, widthOut, heightOut, depthOut, afterImage ); Image.emptyImage3D( psm, widthOut, heightOut, depthOut, format, typeOut, Mipmap.is_index( format ), afterImage, dataOut ); - + return( 0 ); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java index 38113f601..dc401880d 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,176 +51,176 @@ import java.nio.*; * @author Administrator */ public class Type_Widget { - + ByteBuffer buffer; - + /** Creates a new instance of Type_Widget */ public Type_Widget() { // can't make this direct, because JVM doesn't allocate small direct buffers efficiently // see https://jogamp.org/bugzilla/show_bug.cgi?id=463 for details buffer = ByteBuffer.allocate( 4 ); } - + public void setUB0( byte b ) { buffer.position( 0 ); buffer.put( b ); } - + public byte getUB0() { buffer.position( 0 ); return( buffer.get() ); } - + public void setUB1( byte b ) { buffer.position( 1 ); buffer.put( b ); } - + public byte getUB1() { buffer.position( 1 ); return( buffer.get() ); } - + public void setUB2( byte b ) { buffer.position( 2 ); buffer.put( b ); } - + public byte getUB2() { buffer.position( 2 ); return( buffer.get() ); } - + public void setUB3( byte b ) { buffer.position( 3 ); buffer.put( b ); } - + public byte getUB3() { buffer.position( 3 ); return( buffer.get() ); } - + public void setUS0( short s ) { buffer.position( 0 ); buffer.putShort( s ); } - + public short getUS0() { buffer.position( 0 ); return( buffer.getShort() ); } - + public void setUS1( short s ) { buffer.position( 2 ); buffer.putShort( s ); } - + public short getUS1() { buffer.position( 2 ); return( buffer.getShort() ); } - + public void setUI( int i ) { buffer.position( 0 ); buffer.putInt( i ); } - + public int getUI() { buffer.position( 0 ); return( buffer.getInt() ); } - + public void setB0( byte b ) { buffer.position( 0 ); buffer.put( b ); } - + public byte getB0() { buffer.position( 0 ); return( buffer.get() ); } - + public void setB1( byte b ) { buffer.position( 1 ); buffer.put( b ); } - + public byte getB1() { buffer.position( 1 ); return( buffer.get() ); } - + public void setB2( byte b ) { buffer.position( 2 ); buffer.put( b ); } - + public byte getB2() { buffer.position( 2 ); return( buffer.get() ); } - + public void setB3( byte b ) { buffer.position( 3 ); buffer.put( b ); } - + public byte getB3() { buffer.position( 3 ); return( buffer.get() ); } - + public void setS0( short s ) { buffer.position( 0 ); buffer.putShort( s ); } - + public short getS0() { buffer.position( 0 ); return( buffer.getShort() ); } - + public void setS1( short s ) { buffer.position( 2 ); buffer.putShort( s ); } - + public short getS1() { buffer.position( 2 ); return( buffer.getShort() ); } - + public void setI( int i ) { buffer.position( 0 ); buffer.putInt( i ); } - + public int getI() { buffer.position( 0 ); return( buffer.getInt() ); } - + public void setF( float f ) { buffer.position( 0 ); buffer.putFloat( f ); } - + public float getF() { buffer.position( 0 ); return( buffer.getFloat() ); } - + public ByteBuffer getBuffer() { buffer.rewind(); return( buffer ); } - + public static void main( String args[] ) { Type_Widget t = new Type_Widget(); t.setI( 1000000 ); - + System.out.println("int: " + Integer.toHexString( t.getI() ) ); - + } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java index 422f8d4df..df2b9a147 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java @@ -72,7 +72,7 @@ public class Arc { /** * Makes new arc at specified side - * + * * @param side * which side doeas this arc form */ @@ -86,7 +86,7 @@ public class Arc { /** * Sets side the arc is at - * + * * @param side * arc side */ @@ -104,7 +104,7 @@ public class Arc { type &= ~(0x7 << 8); } - // this one replaces enum arc_side + // this one replaces enum arc_side /** * Side not specified */ @@ -147,7 +147,7 @@ public class Arc { /** * Appends arc to the list - * + * * @param jarc * arc to be append * @return this @@ -169,7 +169,7 @@ public class Arc { /** * Unused - * + * * @return true */ public boolean check() { @@ -187,7 +187,7 @@ public class Arc { /** * Returns tail of linked list coords - * + * * @return tail coords */ public float[] tail() { @@ -197,7 +197,7 @@ public class Arc { /** * Returns head of linked list coords - * + * * @return head coords */ public float[] head() { @@ -207,7 +207,7 @@ public class Arc { /** * Returns whether arc is marked with arc_tag - * + * * @return is arc marked with arc_tag */ public boolean ismarked() { @@ -241,7 +241,7 @@ public class Arc { /** * Returns whether arc is marked tail - * + * * @return is tail */ public boolean getitail() { diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java index f4ad70193..c299b10af 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java @@ -44,7 +44,7 @@ public class ArcSdirSorter { /** * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider - */ + */ public ArcSdirSorter(Subdivider subdivider) { //TODO // System.out.println("TODO arcsdirsorter.constructor"); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java index be72c53d2..1a584c396 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java @@ -43,7 +43,7 @@ public class ArcTdirSorter { /** * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider - */ + */ public ArcTdirSorter(Subdivider subdivider) { // TODO Auto-generated constructor stub // System.out.println("TODO arcTsorter.konstruktor"); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java index 610a19556..3e974247b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java @@ -67,7 +67,7 @@ public abstract class Backend { protected SurfaceEvaluator surfaceEvaluator; /** - * Makes new backend + * Makes new backend */ public Backend() { // curveEvaluator = new OpenGLCurveEvaluator(); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java index df8b16ab5..17437ef01 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java @@ -143,7 +143,7 @@ public class Bin { /** * Returns next arc in linked list * @return next arc - * + * */ private Arc nextarc() { // DONE diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java index f45571dac..f84640d28 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java @@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs; /** * Class holding break point parameters - * + * * @author Tomas Hrasky - * + * */ public class Breakpt { diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java index aaa8cb5f2..b67764c30 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java @@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs; /** * Class replacing C language pointer - * + * * @author Tomas Hrasky - * + * */ public class CArrayOfArcs { /** @@ -24,7 +24,7 @@ public class CArrayOfArcs { /** * Makes new CArray - * + * * @param array * underlaying array * @param pointer @@ -38,7 +38,7 @@ public class CArrayOfArcs { /** * Makes new CArray from other CArray - * + * * @param carray * reference array */ @@ -50,7 +50,7 @@ public class CArrayOfArcs { /** * Makes new CArray with pointer set to 0 - * + * * @param ctlarray * underlaying array */ @@ -61,7 +61,7 @@ public class CArrayOfArcs { /** * Returns element at pointer - * + * * @return element at pointer */ public Arc get() { @@ -78,7 +78,7 @@ public class CArrayOfArcs { /** * Sets element at pointer - * + * * @param f * desired value */ @@ -89,7 +89,7 @@ public class CArrayOfArcs { /** * Returns array element at specified index - * + * * @param i * array index * @return element at index @@ -100,7 +100,7 @@ public class CArrayOfArcs { /** * Returns array element at specified index relatively to pointer - * + * * @param i * relative index * @return element at relative index @@ -111,7 +111,7 @@ public class CArrayOfArcs { /** * Sets value of element at specified index relatively to pointer - * + * * @param i * relative index * @param value @@ -123,7 +123,7 @@ public class CArrayOfArcs { /** * Lessens pointer by value - * + * * @param i * lessen by */ @@ -134,7 +134,7 @@ public class CArrayOfArcs { /** * Returns pointer value - * + * * @return pointer value */ public int getPointer() { @@ -143,7 +143,7 @@ public class CArrayOfArcs { /** * Sets ponter value - * + * * @param pointer * pointer value to be set */ @@ -156,7 +156,7 @@ public class CArrayOfArcs { /** * Raises pointer by value - * + * * @param i * raise by */ @@ -175,7 +175,7 @@ public class CArrayOfArcs { /** * Returns underlaying array - * + * * @return underlaying array */ public Arc[] getArray() { @@ -184,7 +184,7 @@ public class CArrayOfArcs { /** * Sets underlaying array - * + * * @param array * underlaying array */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java index 5112b07fc..b5f588960 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java @@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs; /** * Class replacing C language pointer - * + * * @author Tomas Hrasky - * + * */ public class CArrayOfBreakpts { /** @@ -19,7 +19,7 @@ public class CArrayOfBreakpts { /** * Makes new CArray - * + * * @param array * underlaying array * @param pointer @@ -32,7 +32,7 @@ public class CArrayOfBreakpts { /** * Makes new CArray from other CArray - * + * * @param carray * reference array */ @@ -43,7 +43,7 @@ public class CArrayOfBreakpts { /** * Returns element at pointer - * + * * @return element at pointer */ public Breakpt get() { @@ -59,7 +59,7 @@ public class CArrayOfBreakpts { /** * Sets element at pointer - * + * * @param f * desired value */ @@ -70,7 +70,7 @@ public class CArrayOfBreakpts { /** * Returns array element at specified index - * + * * @param i * array index * @return element at index @@ -81,7 +81,7 @@ public class CArrayOfBreakpts { /** * Lessens pointer by value - * + * * @param i * lessen by */ @@ -92,7 +92,7 @@ public class CArrayOfBreakpts { /** * Returns pointer value - * + * * @return pointer value */ public int getPointer() { @@ -101,7 +101,7 @@ public class CArrayOfBreakpts { /** * Sets ponter value - * + * * @param pointer * pointer value to be set */ @@ -111,7 +111,7 @@ public class CArrayOfBreakpts { /** * Raises pointer by value - * + * * @param i * raise by */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java index 39ef841ec..d9e4d0ff1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java @@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs; /** * Class replacing C language pointer - * + * * @author Tomas Hrasky - * + * */ public class CArrayOfFloats { @@ -25,7 +25,7 @@ public class CArrayOfFloats { /** * Makes new CArray - * + * * @param array * underlaying array * @param pointer @@ -39,7 +39,7 @@ public class CArrayOfFloats { /** * Makes new CArray from other CArray - * + * * @param carray * reference array */ @@ -51,7 +51,7 @@ public class CArrayOfFloats { /** * Makes new CArray with pointer set to 0 - * + * * @param ctlarray * underlaying array */ @@ -62,7 +62,7 @@ public class CArrayOfFloats { /** * Returns element at pointer - * + * * @return element at pointer */ public float get() { @@ -79,7 +79,7 @@ public class CArrayOfFloats { /** * Sets element at pointer - * + * * @param f * desired value */ @@ -90,7 +90,7 @@ public class CArrayOfFloats { /** * Returns array element at specified index - * + * * @param i * array index * @return element at index @@ -101,7 +101,7 @@ public class CArrayOfFloats { /** * Returns array element at specified index relatively to pointer - * + * * @param i * relative index * @return element at relative index @@ -112,7 +112,7 @@ public class CArrayOfFloats { /** * Sets value of element at specified index relatively to pointer - * + * * @param i * relative index * @param value @@ -124,7 +124,7 @@ public class CArrayOfFloats { /** * Lessens pointer by value - * + * * @param i * lessen by */ @@ -135,7 +135,7 @@ public class CArrayOfFloats { /** * Returns pointer value - * + * * @return pointer value */ public int getPointer() { @@ -144,7 +144,7 @@ public class CArrayOfFloats { /** * Sets ponter value - * + * * @param pointer * pointer value to be set */ @@ -157,7 +157,7 @@ public class CArrayOfFloats { /** * Raises pointer by value - * + * * @param i * raise by */ @@ -176,7 +176,7 @@ public class CArrayOfFloats { /** * Returns underlaying array - * + * * @return underlaying array */ public float[] getArray() { @@ -185,7 +185,7 @@ public class CArrayOfFloats { /** * Sets underlaying array - * + * * @param array * underlaying array */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java index 4b21f2d50..e7bbac16a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java @@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs; /** * Class replacing C language pointer - * + * * @author Tomas Hrasky - * + * */ public class CArrayOfQuiltspecs { /** @@ -19,7 +19,7 @@ public class CArrayOfQuiltspecs { /** * Makes new CArray - * + * * @param array * underlaying array * @param pointer @@ -32,7 +32,7 @@ public class CArrayOfQuiltspecs { /** * Makes new CArray from other CArray - * + * * @param carray * reference array */ @@ -43,7 +43,7 @@ public class CArrayOfQuiltspecs { /** * Makes new CArray with pointer set to 0 - * + * * @param array * underlaying array */ @@ -54,7 +54,7 @@ public class CArrayOfQuiltspecs { /** * Returns element at pointer - * + * * @return element at pointer */ public Quiltspec get() { @@ -70,7 +70,7 @@ public class CArrayOfQuiltspecs { /** * Sets element at pointer - * + * * @param f * desired value */ @@ -81,7 +81,7 @@ public class CArrayOfQuiltspecs { /** * Returns array element at specified index - * + * * @param i * array index * @return element at index @@ -92,7 +92,7 @@ public class CArrayOfQuiltspecs { /** * Lessens pointer by value - * + * * @param i * lessen by */ @@ -103,7 +103,7 @@ public class CArrayOfQuiltspecs { /** * Returns pointer value - * + * * @return pointer value */ public int getPointer() { @@ -112,7 +112,7 @@ public class CArrayOfQuiltspecs { /** * Sets ponter value - * + * * @param pointer * pointer value to be set */ @@ -122,7 +122,7 @@ public class CArrayOfQuiltspecs { /** * Raises pointer by value - * + * * @param i * raise by */ @@ -141,7 +141,7 @@ public class CArrayOfQuiltspecs { /** * Returns underlaying array - * + * * @return underlaying array */ public Quiltspec[] getArray() { @@ -150,7 +150,7 @@ public class CArrayOfQuiltspecs { /** * Sets underlaying array - * + * * @param array * underlaying array */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java index 786781723..ea3a3d14e 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java @@ -103,7 +103,7 @@ public class Curve { /** * Makes new Curve - * + * * @param geo * @param pta * @param ptb @@ -143,7 +143,7 @@ public class Curve { range[0] = qs.get().breakpoints[qs.get().index]; range[1] = qs.get().breakpoints[qs.get().index + 1]; range[2] = range[1] - range[0]; - // TODO it is necessary to solve problem with "this" pointer here + // TODO it is necessary to solve problem with "this" pointer here if (range[0] != pta[0]) { // System.out.println("TODO curve.Curve-range0"); // Curve lower=new Curve(this,pta,0); @@ -229,7 +229,7 @@ public class Curve { /** * Tells whether curve needs subdivision - * + * * @return curve needs subdivison */ public boolean needsSamplingSubdivision() { diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java index 6983691d9..f9c4c2d6f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java @@ -45,12 +45,12 @@ public class Flist { /** * Data elements end index - * + * */ public int end; /** - *Data elements start index + *Data elements start index */ public int start; @@ -80,7 +80,7 @@ public class Flist { } /** - * Removes duplicate array elemnts + * Removes duplicate array elemnts */ public void filter() { // INFO the aim of this method is to remove duplicates from array diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java index 114832a1c..1dcf393a9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java @@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs; /** * Knot vector specification - * + * * @author Tomas Hrasky - * + * */ public class Knotspec { @@ -314,7 +314,7 @@ public class Knotspec { /** * Copies control points - * + * * @param _inpt * input control points * @param _outpt @@ -346,7 +346,7 @@ public class Knotspec { /** * Copies one control point to other - * + * * @param topt * source control point * @param frompt @@ -374,7 +374,7 @@ public class Knotspec { /** * Inserts a knot - * + * * @param _p * inserted knot */ @@ -402,7 +402,7 @@ public class Knotspec { } } - } else {//code for curve + } else {//code for curve if (this.equals(kspectotrans)) { insert(p); } else { @@ -428,7 +428,7 @@ public class Knotspec { /** * Inserts a knot and computes new control points - * + * * @param p * inserted knot */ @@ -490,7 +490,7 @@ public class Knotspec { /** * Copies one control point to another - * + * * @param topt * source ctrl point * @param frompt @@ -519,7 +519,7 @@ public class Knotspec { /** * Computes new control point - * + * * @param x * first point * @param y @@ -549,7 +549,7 @@ public class Knotspec { * z.getRelative(0))); break; default: - //no need of default - see previous method and its case statement + //no need of default - see previous method and its case statement // System.out.println("TODO pt_oo_sum default"); break; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java index aac4dfc52..571f44f06 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java @@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs; /** * Knot vector used in curve specification - * + * * @author Tomas Hrasky - * + * */ public class Knotvector { @@ -75,7 +75,7 @@ public class Knotvector { /** * Makes new knotvector - * + * * @param nknots * number of knots * @param stride @@ -92,7 +92,7 @@ public class Knotvector { /** * Initializes knotvector - * + * * @param nknots * number of knots * @param stride @@ -116,7 +116,7 @@ public class Knotvector { /** * Validates knot vector parameters - * + * * @return knot vector validity */ public int validate() { @@ -154,7 +154,7 @@ public class Knotvector { /** * Show specified message - * + * * @param msg * message to be shown */ @@ -166,7 +166,7 @@ public class Knotvector { /** * Compares two knots for equality - * + * * @param a * first knot * @param b diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java index bd5d2db98..86638a827 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java @@ -112,7 +112,7 @@ public class Mapdesc { float clampfactor; /** - * Value of N_MINSAVINGS property + * Value of N_MINSAVINGS property */ private float minsavings; @@ -162,7 +162,7 @@ public class Mapdesc { private float[] bboxsize; /** - * Makes new mapdesc + * Makes new mapdesc * @param type map type * @param rational is rational * @param ncoords number of control points coords @@ -318,7 +318,7 @@ public class Mapdesc { } /** - * Tells whether map is culling + * Tells whether map is culling * @return is map culling */ public boolean isCulling() { @@ -327,7 +327,7 @@ public class Mapdesc { } /** - * Tells whether map is constantly sampling + * Tells whether map is constantly sampling * @return is map constant sampling */ public boolean isConstantSampling() { @@ -335,7 +335,7 @@ public class Mapdesc { } /** - * Tells whether map is domain sampling + * Tells whether map is domain sampling * @return is map domain sampling */ public boolean isDomainSampling() { @@ -343,7 +343,7 @@ public class Mapdesc { } /** - * Returns property of specified tag value + * Returns property of specified tag value * @param tag property tag * @return property value */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java index 05c89ebcf..a686da696 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java @@ -68,7 +68,7 @@ public class O_nurbscurve { /** * Makes new O_nurbscurve - * @param realType type of curve + * @param realType type of curve */ public O_nurbscurve(int realType) { // DONE diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java index f1e499a28..8c2922565 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java @@ -52,7 +52,7 @@ public class Patchlist { private Patch patch; /** - * Makes new list of patches + * Makes new list of patches * @param quilts list of quilts * @param pta low border * @param ptb high border diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java index 25b4dc441..79f36ce43 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java @@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs; /** * Class representing property - * + * * @author Tomas Hrasky - * + * */ public class Property { @@ -59,7 +59,7 @@ public class Property { /** * Makes new property with given parameters - * + * * @param type * property type * @param tag diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java index 4729e2421..7c636122f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java @@ -35,7 +35,7 @@ package jogamp.opengl.glu.nurbs; */ /** - * Class holding rendering params + * Class holding rendering params * @author Tomas Hrasky * */ diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java index 37774f811..4d8296cca 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java @@ -41,7 +41,7 @@ package jogamp.opengl.glu.nurbs; */ public class Subdivider { /** - * Cull type + * Cull type */ public static final int CULL_TRIVIAL_REJECT = 0; @@ -76,7 +76,7 @@ public class Subdivider { private int subdivisions; /** - * U step when using domain distance sampling + * U step when using domain distance sampling */ private float domain_distance_u_rate; @@ -375,7 +375,7 @@ public class Subdivider { } /** - * Sample + * Sample * @param source * @param patchlist * @param subdivisions diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java index e88d69709..1025afb7c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java @@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs; /** * Holds vertex used in trim - * + * * @author Tomas Hrasky - * + * */ public class TrimVertex { diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java index 3d669d9bb..9c8523e51 100644 --- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java +++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java @@ -6,15 +6,15 @@ * this file except in compliance with the License. You may obtain a copy * of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 * Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - * + * * http://oss.sgi.com/projects/FreeB - * + * * Note that, as provided in the License, the Software is distributed on an * "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS * DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND * CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A * PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - * + * * NOTE: The Original Code (as defined below) has been licensed to Sun * Microsystems, Inc. ("Sun") under the SGI Free Software License B * (Version 1.1), shown above ("SGI License"). Pursuant to Section @@ -30,7 +30,7 @@ * Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. * Copyright in any portions created by third parties is as indicated * elsewhere herein. All Rights Reserved. - * + * * Additional Notice Provisions: The application programming interfaces * established by SGI in conjunction with the Original Code are The * OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -51,11 +51,11 @@ import javax.media.opengl.glu.GLU; * @author Administrator */ public class Registry { - + /** Creates a new instance of Registry */ public Registry() { } - + public static String gluGetString(int name) { if( name == GLU.GLU_VERSION ) { return( "1.3" ); @@ -64,7 +64,7 @@ public class Registry { } return( null ); } - + public static boolean gluCheckExtension( String extName, String extString ) { if( extName == null || extString == null ) { return( false ); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 0828d1dc3..5cc4003fe 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -80,7 +80,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; public class MacOSXCGLContext extends GLContextImpl -{ +{ // Abstract interface for implementation of this context (either // NSOpenGL-based or CGL-based) protected interface GLBackendImpl { @@ -140,13 +140,13 @@ public class MacOSXCGLContext extends GLContextImpl } private static final String shaderBasename = "texture01_xxx"; - + private static ShaderProgram createCALayerShader(GL3ES3 gl) { // Create & Link the shader program final ShaderProgram sp = new ShaderProgram(); - final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, + final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, "../../shader", "../../shader/bin", shaderBasename, true); - final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class, + final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class, "../../shader", "../../shader/bin", shaderBasename, true); vp.defaultShaderCustomization(gl, true, true); fp.defaultShaderCustomization(gl, true, true); @@ -162,7 +162,7 @@ public class MacOSXCGLContext extends GLContextImpl pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); - pmvMatrix.glLoadIdentity(); + pmvMatrix.glLoadIdentity(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv pmvMatrixUniform.setLocation(gl, sp.program()); gl.glUniform(pmvMatrixUniform); @@ -170,8 +170,8 @@ public class MacOSXCGLContext extends GLContextImpl sp.useProgram(gl, false); return sp; } - - + + private boolean haveSetOpenGLMode = false; private GLBackendType openGLMode = GLBackendType.NSOPENGL; @@ -185,7 +185,7 @@ public class MacOSXCGLContext extends GLContextImpl private long updateHandle = 0; private int lastWidth, lastHeight; - + protected MacOSXCGLContext(GLDrawableImpl drawable, GLContext shareWith) { super(drawable, shareWith); @@ -303,7 +303,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override protected void makeCurrentImpl() throws GLException { /** FIXME: won't work w/ special drawables (like FBO) - check for CGL mode regressions! - * + * if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) { setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode()); } */ @@ -327,7 +327,7 @@ public class MacOSXCGLContext extends GLContextImpl throw new GLException("Error destroying OpenGL Context: "+this); } } - + private final long getUpdateHandle() { if( 0 == updateHandle ) { lastWidth = -1; @@ -340,7 +340,7 @@ public class MacOSXCGLContext extends GLContextImpl } else { incompleteView = false; } - if(!incompleteView) { + if(!incompleteView) { updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); if(0 == updateHandle) { throw new InternalError("XXX2"); @@ -350,14 +350,14 @@ public class MacOSXCGLContext extends GLContextImpl } return updateHandle; } - + private final void releaseUpdateHandle() { if ( 0 != updateHandle ) { CGL.updateContextUnregister(updateHandle); updateHandle = 0; - } + } } - + @Override protected void drawableUpdatedNotify() throws GLException { if( drawable.getChosenGLCapabilities().isOnscreen() ) { @@ -376,7 +376,7 @@ public class MacOSXCGLContext extends GLContextImpl } } } - + @Override protected void associateDrawable(boolean bound) { // context stuff depends on drawable stuff @@ -390,12 +390,12 @@ public class MacOSXCGLContext extends GLContextImpl super.associateDrawable(false); // 2) free drawable stuff } } - + /* pp */ void detachPBuffer() { impl.detachPBuffer(); } - + @Override protected void copyImpl(GLContext source, int mask) throws GLException { if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) { @@ -429,7 +429,7 @@ public class MacOSXCGLContext extends GLContextImpl // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } - + @Override protected final void updateGLXProcAddressTable() { final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration(); @@ -520,11 +520,11 @@ public class MacOSXCGLContext extends GLContextImpl private int lastWidth=0, lastHeight=0; // allowing to detect size change private boolean needsSetContextPBuffer = false; private ShaderProgram gl3ShaderProgram = null; - + @Override public boolean isNSContext() { return true; } - + /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */ private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) { final long nsViewHandle; @@ -558,11 +558,11 @@ public class MacOSXCGLContext extends GLContextImpl needsSetContextPBuffer = isPBuffer[0]; return nsViewHandle; } - + @Override public long create(long share, int ctp, int major, int minor) { long ctx = 0; - final NativeSurface surface = drawable.getNativeSurface(); + final NativeSurface surface = drawable.getNativeSurface(); final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration(); final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final long nsViewHandle; @@ -606,7 +606,7 @@ public class MacOSXCGLContext extends GLContextImpl if( !_fixedCaps.isPBuffer() && isPBuffer ) { throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable); } - // determine on-/offscreen caps, since pformat is ambiguous + // determine on-/offscreen caps, since pformat is ambiguous _fixedCaps.setPBuffer( isPBuffer ); // exclusive _fixedCaps.setBitmap( false ); // n/a in our OSX impl. _fixedCaps.setOnscreen( !isFBO && !isPBuffer ); @@ -632,7 +632,7 @@ public class MacOSXCGLContext extends GLContextImpl // Thread.dumpStack(); } config.setChosenCapabilities(fixedCaps); - + final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1); // Try to allocate a context with this ctx = CGL.createContext(share, nsViewHandle, incompleteView, @@ -665,12 +665,12 @@ public class MacOSXCGLContext extends GLContextImpl * <p> * Since NSOpenGLLayer creation requires this context for it's shared context creation, * this method attempts to acquire the surface and context lock with {@link #screenVSyncTimeout}/2 maximum wait time. - * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution. + * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution. * </p> * <p> * Hence this method blocks the main-thread only for a short period of time. * </p> - */ + */ class AttachGLLayerCmd implements Runnable { final OffscreenLayerSurface ols; final long ctx; @@ -685,7 +685,7 @@ public class MacOSXCGLContext extends GLContextImpl long nsOpenGLLayer; /** Synchronized by instance's monitor */ boolean valid; - + AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, boolean isOpaque, int width, int height) { this.ols = ols; this.ctx = ctx; @@ -699,23 +699,23 @@ public class MacOSXCGLContext extends GLContextImpl this.valid = false; this.nsOpenGLLayer = 0; } - + public final String contentToString() { return "valid "+valid+", size "+width+"x"+height+", ctx "+toHexString(ctx)+", opaque "+isOpaque+", texID "+texID+", pbuffer "+toHexString(pbuffer)+", nsOpenGLLayer "+toHexString(nsOpenGLLayer); } - + @Override public final String toString() { return "AttachGLLayerCmd["+contentToString()+"]"; } - + @Override public void run() { synchronized(this) { if( !valid ) { try { final int maxwait = screenVSyncTimeout/2000; // TO 1/2 of current screen-vsync in [ms] - final RecursiveLock surfaceLock = ols.getLock(); + final RecursiveLock surfaceLock = ols.getLock(); if( surfaceLock.tryLock( maxwait ) ) { try { if( MacOSXCGLContext.this.lock.tryLock( maxwait ) ) { @@ -752,19 +752,19 @@ public class MacOSXCGLContext extends GLContextImpl } } AttachGLLayerCmd attachGLLayerCmd = null; - + class DetachGLLayerCmd implements Runnable { final AttachGLLayerCmd cmd; - + DetachGLLayerCmd(AttachGLLayerCmd cmd) { this.cmd = cmd; } - + @Override public final String toString() { return "DetachGLLayerCmd["+cmd.contentToString()+"]"; } - + @Override public void run() { synchronized( cmd ) { @@ -777,7 +777,7 @@ public class MacOSXCGLContext extends GLContextImpl ols.detachSurfaceLayer(); } } catch(Throwable t) { - System.err.println("Catched Exception on thread "+getThreadName()); + System.err.println("Catched Exception on thread "+getThreadName()); t.printStackTrace(); } CGL.releaseNSOpenGLLayer(cmd.nsOpenGLLayer); @@ -790,27 +790,27 @@ public class MacOSXCGLContext extends GLContextImpl System.err.println("NSOpenGLLayer.Detach: Skipped "+toHexString(cmd.nsOpenGLLayer)+" - "+getThreadName()); } } - } + } } - + @Override public void associateDrawable(boolean bound) { backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true); - + if(DEBUG) { System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable: "+bound+", ctx "+toHexString(contextHandle)+ ", hasBackingLayerHost "+(null!=backingLayerHost)+", attachGLLayerCmd "+attachGLLayerCmd); // Thread.dumpStack(); - } - - if( bound ) { + } + + if( bound ) { if( null != backingLayerHost ) { final GLCapabilitiesImmutable chosenCaps; final long ctx; final int texID; final long pbufferHandle; final int gl3ShaderProgramName; - + // // handled layered surface // @@ -823,8 +823,8 @@ public class MacOSXCGLContext extends GLContextImpl pbufferHandle = 0; fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() { public void swapBuffers(boolean doubleBuffered) { - MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers(); - } } ) ; + MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers(); + } } ) ; } else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { texID = 0; pbufferHandle = drawableHandle; @@ -847,19 +847,19 @@ public class MacOSXCGLContext extends GLContextImpl gl3ShaderProgramName = gl3ShaderProgram.program(); } else { gl3ShaderProgramName = 0; - } - + } + // All CALayer lifecycle ops are deferred on main-thread - attachGLLayerCmd = new AttachGLLayerCmd( - backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID, + attachGLLayerCmd = new AttachGLLayerCmd( + backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID, chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight ); if(DEBUG) { System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(true): "+attachGLLayerCmd); - } + } OSXUtil.RunOnMainThread(false, attachGLLayerCmd); - } else { // -> null == backingLayerHost + } else { // -> null == backingLayerHost lastWidth = drawable.getWidth(); - lastHeight = drawable.getHeight(); + lastHeight = drawable.getHeight(); boolean[] isPBuffer = { false }; boolean[] isFBO = { false }; CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); @@ -882,7 +882,7 @@ public class MacOSXCGLContext extends GLContextImpl final DetachGLLayerCmd dCmd = new DetachGLLayerCmd(cmd); if(DEBUG) { System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(false): "+dCmd); - } + } OSXUtil.RunOnMainThread(false, dCmd); if( null != gl3ShaderProgram ) { gl3ShaderProgram.destroy(MacOSXCGLContext.this.gl.getGL3()); @@ -903,11 +903,11 @@ public class MacOSXCGLContext extends GLContextImpl needsSetContextPBuffer = false; CGL.setContextPBuffer(ctx, drawableHandle); if(DEBUG) { - System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx)); + System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx)); } } } - + /** Returns true if size has been updated, otherwise false (same size). */ private final boolean validateDrawableSizeConfig(long ctx) { final int width = drawable.getWidth(); @@ -916,13 +916,13 @@ public class MacOSXCGLContext extends GLContextImpl lastWidth = drawable.getWidth(); lastHeight = drawable.getHeight(); if(DEBUG) { - System.err.println("NS.validateDrawableConfig size changed"); + System.err.println("NS.validateDrawableConfig size changed"); } return true; } return false; } - + @Override public boolean copyImpl(long src, int mask) { CGL.copyContext(contextHandle, src, mask); @@ -975,7 +975,7 @@ public class MacOSXCGLContext extends GLContextImpl // CGL.setContextPBuffer(contextHandle, 0); // doesn't work, i.e. not taking nil return true; } - + @Override public boolean setSwapInterval(int interval) { final AttachGLLayerCmd cmd = attachGLLayerCmd; @@ -1004,7 +1004,7 @@ public class MacOSXCGLContext extends GLContextImpl if(DEBUG) { System.err.println("CGL setSwapInterval: "+interval); } CGL.setSwapInterval(contextHandle, interval); } - + private int skipSync=0; /** TODO: Remove after discussion private boolean perfIterReset = false; @@ -1014,7 +1014,7 @@ public class MacOSXCGLContext extends GLContextImpl private long frameXS = 0; private long lastFrameStart = 0; */ - + @Override public boolean swapBuffers() { final AttachGLLayerCmd cmd = attachGLLayerCmd; @@ -1026,7 +1026,7 @@ public class MacOSXCGLContext extends GLContextImpl // allowing to update the texture IDs ASAP. skipSync = 10; } - + final boolean res; final int texID; final boolean valid; @@ -1054,19 +1054,19 @@ public class MacOSXCGLContext extends GLContextImpl final long lastFramePeriod0 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart; gl.glFinish(); // Require to finish previous GL rendering to give CALayer proper result final long lastFramePeriod1 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart; - - // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay, + + // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay, // while still synchronizing w/ CALayer. // If v-sync is enabled wait until next swap interval (v-sync). CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout); final long lastFramePeriodX = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart; - + final long finishGL = lastFramePeriod1 - lastFramePeriod0; final long waitGL = lastFramePeriodX - lastFramePeriod1; finishGLS += finishGL; waitGLS += waitGL; frameXS += lastFramePeriodX; - + System.err.println("XXX["+perfIter+"] TO "+vsyncTimeout/1000+" ms, "+ "lFrame0 "+lastFramePeriod0/1000+" ms, "+ "lFrameX "+lastFramePeriodX/1000+" / "+frameXS/1000+" ~"+(frameXS/perfIter)/1000.0+" ms, "+ @@ -1080,8 +1080,8 @@ public class MacOSXCGLContext extends GLContextImpl // FIXME: IMHO this synchronization should be implicitly performed via 'CGL.flushBuffer(contextHandle)' above, // in case this will be determined a driver bug - use a QUIRK entry in GLRendererQuirks! gl.glFinish(); - - // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay, + + // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay, // while still synchronizing w/ CALayer. // If v-sync is enabled wait until next swap interval (v-sync). CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout); @@ -1093,7 +1093,7 @@ public class MacOSXCGLContext extends GLContextImpl CGL.setNSOpenGLLayerNeedsDisplayFBO(cmd.nsOpenGLLayer, texID); } else { // trigger CALayer to update incl. possible surface change (new pbuffer handle) - CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle()); + CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle()); } // lastFrameStart = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()); } @@ -1137,8 +1137,8 @@ public class MacOSXCGLContext extends GLContextImpl if (0 != ctx) { GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque()); - { // determine on-/offscreen caps, since pformat is ambiguous - fixedCaps.setFBO( false ); // n/a for CGLImpl + { // determine on-/offscreen caps, since pformat is ambiguous + fixedCaps.setFBO( false ); // n/a for CGLImpl fixedCaps.setPBuffer( fixedCaps.isPBuffer() && !chosenCaps.isOnscreen() ); fixedCaps.setBitmap( false ); // n/a in our OSX impl. fixedCaps.setOnscreen( !fixedCaps.isPBuffer() ); @@ -1153,7 +1153,7 @@ public class MacOSXCGLContext extends GLContextImpl if (res != CGL.kCGLNoError) { throw new GLException("Error code " + res + " while attaching context to pbuffer"); } - } + } } } finally { CGL.CGLDestroyPixelFormat(pixelFormat); @@ -1224,7 +1224,7 @@ public class MacOSXCGLContext extends GLContextImpl } */ return true; } - + @Override public boolean setSwapInterval(int interval) { final IntBuffer lval = Buffers.newDirectIntBuffer(1); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 4bd7bc994..bb36a7219 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -105,7 +105,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { @Override protected void setRealizedImpl() { } - + @Override protected void associateContext(GLContext ctx, boolean bound) { // NOTE: we need to keep track of the created contexts in order to @@ -123,14 +123,14 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } else { i++; } - } + } } - } + } } - + @Override protected final void swapBuffersImpl(boolean doubleBuffered) { - if(doubleBuffered) { + if(doubleBuffered) { synchronized (createdContexts) { for(int i=0; i<createdContexts.size(); ) { final MacOSXCGLContext ctx = createdContexts.get(i).get(); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 83d656475..6f86e840b 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -124,7 +124,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected final boolean isComplete() { return null != macOSXCGLDynamicLookupHelper; } - + @Override protected final void destroy() { if(null != sharedMap) { @@ -194,7 +194,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override public GLRendererQuirks getRendererQuirks() { - return glRendererQuirks; + return glRendererQuirks; } } @@ -251,12 +251,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { final GLCapabilitiesImmutable caps = new GLCapabilities(glp); final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); sharedDrawable.setRealized(true); - + final MacOSXCGLContext sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null); if (null == sharedContext) { throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); } - + try { sharedContext.makeCurrent(); // could cause exception isValid = sharedContext.isCurrent(); @@ -342,8 +342,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, + protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final MacOSXGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) { @@ -354,24 +354,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true); if(null == config) { - throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); - } + throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); + } return new WrappedSurface(config, 0, upstreamHook, createNewDevice); } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); - return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, - new OSXDummyUpstreamSurfaceHook(width, height)); - } - + 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) { final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); - final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true); + final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true); return new WrappedSurface(config, windowHandle, upstream, true); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java index f8c874a53..cda8307c7 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.macosx.cgl; import jogamp.opengl.*; @@ -42,13 +42,13 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib final List<String> libsGL = new ArrayList<String>(); libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); libsGL.add("GL"); - libsList.add(libsGL); + libsList.add(libsGL); return libsList; } - + @Override public final List<String> getToolGetProcAddressFuncNameList() { - return null; + return null; /** OSX manual says: NSImage use is discouraged List res = new ArrayList(); res.add("GetProcAddress"); // dummy @@ -59,7 +59,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { return 0; /** OSX manual says: NSImage use is discouraged - return CGL.getProcAddress(glFuncName); // manual implementation + 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 5eb11c6a4..535c4d2d3 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,7 +29,7 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -54,7 +54,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, + MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); } @@ -71,10 +71,10 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration // MacOSXGraphicsDevice osxDevice = sharedResource.getDevice(); return new ArrayList<GLCapabilitiesImmutable>(0); } - + static final IntBuffer cglInternalAttributeToken = Buffers.newDirectIntBuffer(new int[] { CGL.kCGLPFAOpenGLProfile, // >= lion - CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat + CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat CGL.NSOpenGLPFANoRecovery, CGL.kCGLPFAColorFloat, CGL.NSOpenGLPFAPixelBuffer, @@ -96,13 +96,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration for (int idx = 0; idx < len; idx++) { final int attr = attrToken.get(idx+off); switch (attr) { - case CGL.kCGLPFAOpenGLProfile: + case CGL.kCGLPFAOpenGLProfile: ivalues.put(idx, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor)); break; case CGL.NSOpenGLPFANoRecovery: ivalues.put(idx, caps.getHardwareAccelerated() ? 1 : 0); break; - + case CGL.kCGLPFAColorFloat: // ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() && caps.getPbufferFloatingPointBuffers() ) ? 1 : 0); ivalues.put(idx, 0); @@ -160,7 +160,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration if ( !MacOSXCGLContext.isLionOrLater ) { // no OpenGLProfile attrToken.position(1); - } + } final IntBuffer ivalues = GLCapabilities2NSAttribList(attrToken, caps, ctp, major, minor); return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues); } @@ -174,7 +174,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration final IntBuffer attrs = Buffers.newDirectIntBuffer(256); int i = 0; if(MacOSXCGLContext.isLionOrLater) { - attrs.put(i++, CGL.kCGLPFAOpenGLProfile); + attrs.put(i++, CGL.kCGLPFAOpenGLProfile); attrs.put(i++, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor)); } /** @@ -222,8 +222,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } return fmt.get(0); } - - static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { + + static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { return PixelFormat2GLCapabilities(null, pixelFormat, false); } @@ -235,7 +235,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration off = 1; } else { off = 0; - } + } attrToken.position(off); final int len = attrToken.remaining(); final IntBuffer ivalues = Buffers.newDirectIntBuffer(len); @@ -243,7 +243,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration // On this platform the pixel format is associated with the // context and not the drawable. However it's a reasonable // approximation to just store the chosen pixel format up in the - // NativeSurface's AbstractGraphicsConfiguration, + // NativeSurface's AbstractGraphicsConfiguration, // since the public API doesn't provide for a different GLCapabilities per context. // Note: These restrictions of the platform's API might be considered as a bug anyways. @@ -253,7 +253,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } else { CGL.CGLQueryPixelFormat(pixelFormat, attrToken, len, ivalues); } - + if(null == glp && MacOSXCGLContext.isLionOrLater) { // pre-scan for OpenGL Profile for (int i = 0; i < len; i++) { @@ -265,11 +265,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration break; case CGL.kCGLOGLPVersion_Legacy: glp = GLProfile.get(GLProfile.GL2); - break; + break; default: throw new RuntimeException("Unhandled OSX OpenGL Profile: 0x"+Integer.toHexString(ivalue)); } - } + } } } if(null == glp) { @@ -284,7 +284,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration case CGL.NSOpenGLPFAAccelerated: caps.setHardwareAccelerated(ivalue != 0); break; - + case CGL.kCGLPFAColorFloat: // caps.setPbufferFloatingPointBuffers(ivalue != 0); break; @@ -346,7 +346,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } } caps.setAlphaBits(alphaBits); - + return caps; } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index 3bbba2c52..e761be7b7 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -56,13 +56,13 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati static void registerFactory() { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXCGLGraphicsConfigurationFactory()); } - private MacOSXCGLGraphicsConfigurationFactory() { + private MacOSXCGLGraphicsConfigurationFactory() { } protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { - + if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } @@ -78,7 +78,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - + return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen, false); } @@ -91,7 +91,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati } final AbstractGraphicsDevice device = absScreen.getDevice(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device); - + return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 4e791cb5f..f6e8b8fa3 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -90,7 +90,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { public GLContext createContext(GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } - + protected int getTextureTarget() { return pBufferTexTarget; } protected int getTextureWidth() { return pBufferTexWidth; } protected int getTextureHeight() { return pBufferTexHeight; } @@ -101,7 +101,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { if (0 != pBuffer) { synchronized (createdContexts) { for(int i=0; i<createdContexts.size(); ) { - final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i); + final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i); final MacOSXCGLContext ctx = ref.get(); if (ctx != null) { ctx.detachPBuffer(); 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 edf9b7c84..c08259665 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -59,7 +59,7 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLGraphicsConfiguration; public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory { public static void registerFactory() { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXAWTCGLGraphicsConfigurationFactory()); - } + } private MacOSXAWTCGLGraphicsConfigurationFactory() { } diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java index 1a4ca345b..810a9286b 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java @@ -37,22 +37,22 @@ import javax.media.opengl.*; */ public interface GLArrayHandler { - + /** - * if <code>bind</code> is true and the data uses VBO, + * if <code>bind</code> is true and the data uses VBO, * the latter will be bound and data written to the GPU if required. * <p> * If <code>bind</code> is false and the data uses VBO, * the latter will be unbound. * </p> - * + * * @param gl current GL object - * @param bind true if VBO shall be bound and data written, + * @param bind true if VBO shall be bound and data written, * otherwise clear VBO binding. - * @return true if data uses VBO and action was performed, otherwise false + * @return true if data uses VBO and action was performed, otherwise false */ public boolean bindBuffer(GL gl, boolean bind); - + /** * Implementation shall enable or disable the array state. * <p> @@ -60,23 +60,23 @@ public interface GLArrayHandler { * implementation shall synchronize the data with the GPU * and associate the data with the array. * </p> - * + * * @param gl current GL object * @param enable true if array shall be enabled, otherwise false. - * @param ext extension object allowing passing of an implementation detail + * @param ext extension object allowing passing of an implementation detail */ public void enableState(GL gl, boolean enable, Object ext); - + /** - * Supporting interleaved arrays, where sub handlers may handle + * Supporting interleaved arrays, where sub handlers may handle * the array state and the <i>master</i> handler the buffer consistency. - * + * * @param handler the sub handler * @throws UnsupportedOperationException if this array handler does not support interleaved arrays */ public void addSubHandler(GLArrayHandlerFlat handler) throws UnsupportedOperationException; public void setSubArrayVBOName(int vboName); - + } diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java index 4a8f40608..179142fee 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java @@ -39,21 +39,21 @@ public interface GLArrayHandlerFlat { /** * Implementation shall associate the data with the array - * + * * @param gl current GL object - * @param ext extension object allowing passing of an implementation detail + * @param ext extension object allowing passing of an implementation detail */ public void syncData(GL gl, Object ext); - + /** * Implementation shall enable or disable the array state. - * + * * @param gl current GL object * @param enable true if array shall be enabled, otherwise false. - * @param ext extension object allowing passing of an implementation detail + * @param ext extension object allowing passing of an implementation detail */ - public void enableState(GL gl, boolean enable, Object ext); - + public void enableState(GL gl, boolean enable, Object ext); + public GLArrayDataWrapper getData(); } diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java index 98f711b8e..5f9b25530 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java @@ -36,8 +36,8 @@ import javax.media.opengl.GL; import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Interleaved fixed function arrays, i.e. where this buffer data - * represents many arrays. + * Interleaved fixed function arrays, i.e. where this buffer data + * represents many arrays. */ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler { private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>(); @@ -45,13 +45,13 @@ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLAr public GLArrayHandlerInterleaved(GLArrayDataEditable ad) { super(ad); } - + public final void setSubArrayVBOName(int vboName) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).getData().setVBOName(vboName); - } + } } - + public final void addSubHandler(GLArrayHandlerFlat handler) { subArrays.add(handler); } @@ -59,20 +59,20 @@ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLAr private final void syncSubData(GL gl, Object ext) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).syncData(gl, ext); - } - } - + } + } + public final void enableState(GL gl, boolean enable, Object ext) { if(enable) { final boolean vboBound = bindBuffer(gl, true); syncSubData(gl, ext); if(vboBound) { bindBuffer(gl, false); - } + } } for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).enableState(gl, enable, ext); - } + } } } diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java index 862d49d1d..be50fa9ef 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java @@ -35,8 +35,8 @@ import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Used for pure VBO data arrays, i.e. where the buffer data - * does not represents a specific array name. + * Used for pure VBO data arrays, i.e. where the buffer data + * does not represents a specific array name. */ public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { @@ -47,12 +47,12 @@ public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHand public final void setSubArrayVBOName(int vboName) { throw new UnsupportedOperationException(); } - + public final void addSubHandler(GLArrayHandlerFlat handler) { throw new UnsupportedOperationException(); } - - public final void enableState(GL gl, boolean enable, Object ext) { + + public final void enableState(GL gl, boolean enable, Object ext) { if(enable) { if(!ad.isVBO()) { // makes no sense otherwise diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java index 32bba896f..8908bd89d 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java @@ -35,22 +35,22 @@ import javax.media.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Used for 1:1 fixed function arrays, i.e. where the buffer data - * represents this array only. + * Used for 1:1 fixed function arrays, i.e. where the buffer data + * represents this array only. */ public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { public GLFixedArrayHandler(GLArrayDataEditable ad) { super(ad); } - + public final void setSubArrayVBOName(int vboName) { throw new UnsupportedOperationException(); } - + public final void addSubHandler(GLArrayHandlerFlat handler) { throw new UnsupportedOperationException(); } - + public final void enableState(GL gl, boolean enable, Object ext) { final GLPointerFunc glp = gl.getGL2ES1(); if(enable) { @@ -69,12 +69,12 @@ public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHan glp.glTexCoordPointer(ad); break; default: - throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); + throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); } if(vboBound) { bindBuffer(gl, false); - } - glp.glEnableClientState(ad.getIndex()); + } + glp.glEnableClientState(ad.getIndex()); } else { glp.glDisableClientState(ad.getIndex()); } diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java index ff1813b95..bbdd32f0f 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java @@ -35,7 +35,7 @@ import javax.media.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.util.GLArrayDataWrapper; /** - * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled + * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled * separately and interleaves many arrays. */ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat { @@ -48,7 +48,7 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat { public GLArrayDataWrapper getData() { return ad; } - + public final void syncData(GL gl, Object ext) { final GLPointerFunc glp = gl.getGL2ES1(); switch(ad.getIndex()) { @@ -65,14 +65,14 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat { glp.glTexCoordPointer(ad); break; default: - throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); + throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad); } } public final void enableState(GL gl, boolean enable, Object ext) { final GLPointerFunc glp = gl.getGL2ES1(); if(enable) { - glp.glEnableClientState(ad.getIndex()); + glp.glEnableClientState(ad.getIndex()); } else { glp.glDisableClientState(ad.getIndex()); } diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java index 383898898..2bab1c2c9 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java @@ -35,8 +35,8 @@ import javax.media.opengl.GL; import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Interleaved fixed function arrays, i.e. where this buffer data - * represents many arrays. + * Interleaved fixed function arrays, i.e. where this buffer data + * represents many arrays. */ public abstract class GLVBOArrayHandler implements GLArrayHandler { protected GLArrayDataEditable ad; @@ -44,13 +44,13 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler { public GLVBOArrayHandler(GLArrayDataEditable ad) { this.ad = ad; } - + public final boolean bindBuffer(GL gl, boolean bind) { if( !ad.isVBO() ) { return false; } if(bind) { - // always bind and refresh the VBO mgr, + // always bind and refresh the VBO mgr, // in case more than one gl*Pointer objects are in use gl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); if(!ad.isVBOWritten()) { @@ -65,6 +65,6 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler { } return true; } - + } diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java index 31af8e4db..e893bab89 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,30 +44,30 @@ import jogamp.opengl.egl.EGLExt; public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { final protected TextureType texType; final protected boolean useKHRSync; - + public enum TextureType { - GL(0), KHRImage(1); - + GL(0), KHRImage(1); + public final int id; TextureType(int id){ this.id = id; } - } - + } + public static class EGLTextureFrame extends TextureSequence.TextureFrame { - + public EGLTextureFrame(Buffer clientBuffer, Texture t, long khrImage, long khrSync) { super(t); this.clientBuffer = clientBuffer; this.image = khrImage; this.sync = khrSync; } - + public final Buffer getClientBuffer() { return clientBuffer; } - public final long getImage() { return image; } + public final long getImage() { return image; } public final long getSync() { return sync; } - + public String toString() { return "EGLTextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ texture.getTextureObject() + ", img "+ image + ", sync "+ sync+", clientBuffer "+clientBuffer+"]"; } @@ -76,7 +76,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { protected final long sync; } - + protected EGLMediaPlayerImpl(TextureType texType, boolean useKHRSync) { super(); this.texType = texType; @@ -89,21 +89,21 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { final Buffer clientBuffer; final long image; final long sync; - final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ; + final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ; final EGLContext eglCtx; final EGLExt eglExt; final EGLDrawable eglDrawable; - + if(eglUsage) { eglCtx = (EGLContext) gl.getContext(); eglExt = eglCtx.getEGLExt(); - eglDrawable = (EGLDrawable) eglCtx.getGLDrawable(); + eglDrawable = (EGLDrawable) eglCtx.getGLDrawable(); } else { eglCtx = null; eglExt = null; eglDrawable = null; } - + if(TextureType.KHRImage == texType) { IntBuffer nioTmp = Buffers.newDirectIntBuffer(1); // create EGLImage from texture @@ -135,25 +135,25 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { } return new EGLTextureFrame(clientBuffer, texture, image, sync); } - + @Override protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { - final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ; + final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ; final EGLContext eglCtx; final EGLExt eglExt; final EGLDrawable eglDrawable; - + if(eglUsage) { eglCtx = (EGLContext) gl.getContext(); eglExt = eglCtx.getEGLExt(); - eglDrawable = (EGLDrawable) eglCtx.getGLDrawable(); + eglDrawable = (EGLDrawable) eglCtx.getGLDrawable(); } else { eglCtx = null; eglExt = null; eglDrawable = null; } final EGLTextureFrame eglTex = (EGLTextureFrame) frame; - + if(0!=eglTex.getImage()) { eglExt.eglDestroyImageKHR(eglDrawable.getNativeSurface().getDisplayHandle(), eglTex.getImage()); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 40fa9c9d6..ebb344664 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -63,7 +63,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; * <li>{@link #setTextureTarget(int)}</li> * <li>{@link EGLMediaPlayerImpl#setEGLTexImageAttribs(boolean, boolean)}.</li> * </ul> - * + * * <p> * See {@link GLMediaPlayer}. * </p> @@ -75,21 +75,21 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected volatile State state; private Object stateLock = new Object(); - + protected int textureCount; protected int textureTarget; protected int textureFormat; - protected int textureInternalFormat; + protected int textureInternalFormat; protected int textureType; protected int texUnit; - - + + protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST }; protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE }; - + /** User requested URI stream location. */ protected URI streamLoc = null; - /** + /** * In case {@link #streamLoc} is a {@link GLMediaPlayer#CameraInputScheme}, * {@link #cameraPath} holds the URI's path portion * as parsed in {@link #initStream(URI, int, int, int)}. @@ -98,10 +98,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected String cameraPath = null; /** Optional camera properties, see {@link #cameraPath}. */ protected Map<String, String> cameraProps = null; - + protected volatile float playSpeed = 1.0f; protected float audioVolume = 1.0f; - + /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */ protected int vid = GLMediaPlayer.STREAM_ID_AUTO; /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */ @@ -130,20 +130,20 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected String acodec = unknown; /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */ protected String vcodec = unknown; - + protected volatile int decodedFrameCount = 0; protected int presentedFrameCount = 0; protected int displayedFrameCount = 0; protected volatile int video_pts_last = 0; - + /** See {@link #getAudioSink()}. Set by implementation if used from within {@link #initStreamImpl(int, int)}! */ protected AudioSink audioSink = null; protected boolean audioSinkPlaySpeedSet = false; - + /** System Clock Reference (SCR) of first audio PTS at start time. */ private long audio_scr_t0 = 0; private boolean audioSCR_reset = true; - + /** System Clock Reference (SCR) of first video frame at start time. */ private long video_scr_t0 = 0; /** System Clock Reference (SCR) PTS offset, i.e. first video PTS at start time. */ @@ -152,7 +152,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private float video_dpts_cum = 0; /** Cumulative video frames. */ private int video_dpts_count = 0; - /** Number of min frame count required for video cumulative sync. */ + /** Number of min frame count required for video cumulative sync. */ private static final int VIDEO_DPTS_NUM = 20; /** Cumulative coefficient, value {@value}. */ private static final float VIDEO_DPTS_COEFF = 0.7943282f; // (float) Math.exp(Math.log(0.01) / VIDEO_DPTS_NUM); @@ -160,7 +160,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private static final int VIDEO_DPTS_MAX = 5000; // 5s max diff /** Trigger video PTS reset with given cause as bitfield. */ private boolean videoSCR_reset = false; - + protected TextureFrame[] videoFramesOrig = null; protected Ringbuffer<TextureFrame> videoFramesFree = null; protected Ringbuffer<TextureFrame> videoFramesDecoded = null; @@ -177,42 +177,42 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.textureTarget=GL.GL_TEXTURE_2D; this.textureFormat = GL.GL_RGBA; this.textureInternalFormat = GL.GL_RGBA; - this.textureType = GL.GL_UNSIGNED_BYTE; + this.textureType = GL.GL_UNSIGNED_BYTE; this.texUnit = 0; this.state = State.Uninitialized; } @Override public final void setTextureUnit(int u) { texUnit = u; } - + @Override public final int getTextureUnit() { return texUnit; } - + @Override public final int getTextureTarget() { return textureTarget; } - + @Override public final int getTextureCount() { return textureCount; } - + protected final void setTextureTarget(int target) { textureTarget=target; } - protected final void setTextureFormat(int internalFormat, int format) { - textureInternalFormat=internalFormat; - textureFormat=format; - } + protected final void setTextureFormat(int internalFormat, int format) { + textureInternalFormat=internalFormat; + textureFormat=format; + } protected final void setTextureType(int t) { textureType=t; } public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];} public final int[] getTextureMinMagFilter() { return texMinMagFilter; } - + public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];} - public final int[] getTextureWrapST() { return texWrapST; } - + public final int[] getTextureWrapST() { return texWrapST; } + private final void checkGLInit() { if(State.Uninitialized == state || State.Initialized == state ) { throw new IllegalStateException("GL not initialized: "+this); - } + } } - + @Override public String getRequiredExtensionsShaderStub() throws IllegalStateException { checkGLInit(); @@ -221,24 +221,24 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } return ""; } - + @Override public String getTextureSampler2DType() throws IllegalStateException { checkGLInit(); switch(textureTarget) { case GL.GL_TEXTURE_2D: - case GL2.GL_TEXTURE_RECTANGLE: + case GL2.GL_TEXTURE_RECTANGLE: return TextureSequence.sampler2D; case GLES2.GL_TEXTURE_EXTERNAL_OES: return TextureSequence.samplerExternalOES; default: - throw new GLException("Unsuported texture target: "+toHexString(textureTarget)); + throw new GLException("Unsuported texture target: "+toHexString(textureTarget)); } } - + /** * {@inheritDoc} - * + * * This implementation simply returns the build-in function name of <code>texture2D</code>, * if not overridden by specialization. */ @@ -247,31 +247,31 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { checkGLInit(); return "texture2D"; } - + /** * {@inheritDoc} - * - * This implementation simply returns an empty string since it's using + * + * This implementation simply returns an empty string since it's using * the build-in function <code>texture2D</code>, * if not overridden by specialization. */ @Override public String getTextureLookupFragmentShaderImpl() throws IllegalStateException { checkGLInit(); - return ""; + return ""; } - + @Override public final int getDecodedFrameCount() { return decodedFrameCount; } - + @Override public final int getPresentedFrameCount() { return presentedFrameCount; } - + @Override public final int getVideoPTS() { return video_pts_last; } - + @Override - public final int getAudioPTS() { + public final int getAudioPTS() { if( State.Uninitialized != state ) { return getAudioPTSImpl(); } @@ -285,10 +285,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return 0; } } - + @Override public final State getState() { return state; } - + @Override public final State play() { synchronized( stateLock ) { @@ -310,7 +310,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } protected abstract boolean playImpl(); - + @Override public final State pause(boolean flush) { return pauseImpl(flush, 0); @@ -337,7 +337,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } protected abstract boolean pauseImpl(); - + @Override public final State destroy(GL gl) { return destroyImpl(gl, 0); @@ -354,7 +354,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } protected abstract void destroyImpl(GL gl); - + @Override public final int seek(int msec) { synchronized( stateLock ) { @@ -383,12 +383,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } protected abstract int seekImpl(int msec); - + @Override public final float getPlaySpeed() { return playSpeed; } - + @Override public final boolean setPlaySpeed(float rate) { synchronized( stateLock ) { @@ -410,18 +410,18 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return res; } } - /** + /** * Override if not using AudioSink, or AudioSink's {@link AudioSink#setPlaySpeed(float)} is not sufficient! * <p> - * AudioSink shall respect <code>!audioSinkPlaySpeedSet</code> to determine data_size + * AudioSink shall respect <code>!audioSinkPlaySpeedSet</code> to determine data_size * at {@link AudioSink#enqueueData(com.jogamp.opengl.util.av.AudioSink.AudioFrame)}. - * </p> + * </p> */ protected boolean setPlaySpeedImpl(float rate) { if( null != audioSink ) { audioSinkPlaySpeedSet = audioSink.setPlaySpeed(rate); } - // still true, even if audioSink rejects command since we deal w/ video sync + // still true, even if audioSink rejects command since we deal w/ video sync // and AudioSink w/ audioSinkPlaySpeedSet at enqueueData(..). return true; } @@ -431,7 +431,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { getAudioVolumeImpl(); return audioVolume; } - /** + /** * Override if not using AudioSink, or AudioSink's {@link AudioSink#getVolume()} is not sufficient! */ protected void getAudioVolumeImpl() { @@ -439,7 +439,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { audioVolume = audioSink.getVolume(); } } - + @Override public boolean setAudioVolume(float v) { synchronized( stateLock ) { @@ -460,7 +460,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return res; } } - /** + /** * Override if not using AudioSink, or AudioSink's {@link AudioSink#setVolume(float)} is not sufficient! */ protected boolean setAudioVolumeImpl(float v) { @@ -470,7 +470,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { // still true, even if audioSink rejects command .. return true; } - + @Override public final void initStream(URI streamLoc, int vid, int aid, int reqTextureCount) throws IllegalStateException, IllegalArgumentException { synchronized( stateLock ) { @@ -490,7 +490,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } decodedFrameCount = 0; presentedFrameCount = 0; - displayedFrameCount = 0; + displayedFrameCount = 0; this.streamLoc = streamLoc; // Pre-parse for camera-input scheme @@ -500,7 +500,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { if( null != streamLocScheme && streamLocScheme.equals(CameraInputScheme) ) { final String rawPath = streamLoc.getRawPath(); if( null != rawPath && rawPath.length() > 0 ) { - // cut-off root fwd-slash + // cut-off root fwd-slash cameraPath = rawPath.substring(1); final URIQueryProps props = URIQueryProps.create(streamLoc, ';'); cameraProps = props.getProperties(); @@ -508,7 +508,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { throw new IllegalArgumentException("Camera path is empty: "+streamLoc.toString()); } } - + this.vid = vid; this.aid = aid; if (this.streamLoc != null) { @@ -519,7 +519,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { /** * Implementation shall set the following set of data here * @see #vid - * @see #aid + * @see #aid * @see #width * @see #height * @see #fps @@ -530,7 +530,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * @see #vcodec */ protected abstract void initStreamImpl(int vid, int aid) throws Exception; - + @Override public final StreamException getStreamException() { synchronized( stateLock ) { @@ -541,26 +541,26 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } } - + @Override public final void initGL(GL gl) throws IllegalStateException, StreamException, GLException { synchronized( stateLock ) { if(State.Initialized != state ) { throw new IllegalStateException("Stream not in state initialized: "+this); - } + } final StreamException streamInitErr = streamWorker.getStreamErr(); if( null != streamInitErr ) { streamWorker = null; // already terminated! destroy(null); throw streamInitErr; } - try { + try { if( STREAM_ID_NONE != vid ) { removeAllTextureFrames(gl); initGLImpl(gl); if(DEBUG) { System.err.println("initGLImpl.X "+this); - } + } videoFramesOrig = createTexFrames(gl, textureCount); videoFramesFree = new LFRingbuffer<TextureFrame>(videoFramesOrig); videoFramesDecoded = new LFRingbuffer<TextureFrame>(TextureFrame[].class, textureCount); @@ -583,7 +583,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } } - /** + /** * Shall initialize all GL related resources, if not audio-only. * <p> * Shall also take care of {@link AudioSink} initialization if appropriate. @@ -593,8 +593,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * @throws GLException */ protected abstract void initGLImpl(GL gl) throws IOException, GLException; - - /** + + /** * Returns the validated number of textures to be handled. * <p> * Default is {@link #TEXTURE_COUNT_MIN} minimum textures. @@ -606,7 +606,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected int validateTextureCount(int desiredTextureCount) { return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount; } - + protected TextureFrame[] createTexFrames(GL gl, final int count) { final int[] texNames = new int[count]; gl.glGenTextures(count, texNames, 0); @@ -621,7 +621,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return texFrames; } protected abstract TextureFrame createTexImage(GL gl, int texName); - + protected final Texture createTexImageImpl(GL gl, int texName, int tWidth, int tHeight) { if( 0 > texName ) { throw new RuntimeException("TextureName "+toHexString(texName)+" invalid."); @@ -661,19 +661,19 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, texMinMagFilter[0]); - gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]); + gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]); gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, texWrapST[0]); gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, texWrapST[1]); - + return com.jogamp.opengl.util.texture.TextureIO.newTexture( texName, textureTarget, tWidth, tHeight, width, height, - !isInGLOrientation); + !isInGLOrientation); } - + protected void destroyTexFrame(GL gl, TextureFrame frame) { - frame.getTexture().destroy(gl); + frame.getTexture().destroy(gl); } @Override @@ -683,7 +683,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } return lastFrame; } - + private final void removeAllTextureFrames(GL gl) { final TextureFrame[] texFrames = videoFramesOrig; videoFramesOrig = null; @@ -699,14 +699,14 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } texFrames[i] = null; } - System.err.println(Thread.currentThread().getName()+"> Clear TexFrame["+i+"]: "+frame+" -> null"); - } + System.err.println(Thread.currentThread().getName()+"> Clear TexFrame["+i+"]: "+frame+" -> null"); + } } } - + protected TextureFrame cachedFrame = null; protected long lastTimeMillis = 0; - + @Override public final TextureFrame getNextTexture(GL gl) throws IllegalStateException { synchronized( stateLock ) { @@ -750,7 +750,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } else { d_apts = 0; } - + final int frame_period_last = video_pts - video_pts_last; // rendering loop interrupted ? if( videoSCR_reset || frame_period_last > frame_duration*10 ) { videoSCR_reset = false; @@ -782,7 +782,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { cachedFrame = nextFrame; nextFrame = null; } else if ( !droppedFrame && dt < -maxVideoDelay && videoFramesDecoded.size() > 0 ) { - // only drop if prev. frame has not been dropped and + // only drop if prev. frame has not been dropped and // frame is too late and one decoded frame is already available. dropFrame = true; } @@ -791,7 +791,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { System.err.println( "AV_: dT "+(currentTimeMillis-lastTimeMillis)+", "+ getPerfStringImpl( video_scr, video_pts, d_vpts, audio_scr, audio_pts, d_apts, - video_dpts_avg_diff ) + + video_dpts_avg_diff ) + ", avg dpy-fps "+avg_dpy_duration+" ms/f, maxD "+maxVideoDelay+" ms, "+_nextFrame+", playCached " + playCached + ", dropFrame "+dropFrame); } } @@ -803,7 +803,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { lastFrame = nextFrame; videoFramesFree.putBlocking(_lastFrame); } - } else if( DEBUG ) { + } else if( DEBUG ) { final int video_pts = lastFrame.getPTS(); final int audio_pts = getAudioPTSImpl(); final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed ); @@ -835,25 +835,25 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * Audio frames, i.e. {@link AudioSink.AudioFrame}, shall be handled in the process. * <p> * Video frames shall be ignored, if {@link #getVID()} is {@link #STREAM_ID_NONE}. - * </p> + * </p> * <p> * Audio frames shall be ignored, if {@link #getAID()} is {@link #STREAM_ID_NONE}. * </p> * <p> * Method may be invoked on the <a href="#streamworker"><i>StreamWorker</i> decoding thread</a>. - * </p> + * </p> * <p> * Implementation shall care of OpenGL synchronization as required, e.g. glFinish()/glFlush()! * </p> - * @param gl valid and current GL instance, shall be <code>null</code> for audio only. + * @param gl valid and current GL instance, shall be <code>null</code> for audio only. * @param nextFrame the {@link TextureFrame} to store the video PTS and texture data, * shall be <code>null</code> for audio only. * @return the last processed video PTS value, maybe {@link TimeFrameI#INVALID_PTS} if video frame is invalid or n/a. - * Will be {@link TimeFrameI#END_OF_STREAM_PTS} if end of stream reached. + * Will be {@link TimeFrameI#END_OF_STREAM_PTS} if end of stream reached. */ protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame); - - /** + + /** * {@inheritDoc} * <p> * Note: All {@link AudioSink} operations are performed from {@link GLMediaPlayerImpl}, @@ -866,8 +866,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { */ @Override public final AudioSink getAudioSink() { return audioSink; } - - /** + + /** * To be called from implementation at 1st PTS after start * w/ current pts value in milliseconds. * @param audio_scr_t0 @@ -908,10 +908,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private final int getVideoDPTSAvg() { return (int) ( video_dpts_cum * (1.0f - VIDEO_DPTS_COEFF) + 0.5f ); } - + private final void newFrameAvailable(TextureFrame frame, long currentTimeMillis) { decodedFrameCount++; - if( 0 == frame.getDuration() ) { // patch frame duration if not set already + if( 0 == frame.getDuration() ) { // patch frame duration if not set already frame.setDuration( (int) frame_duration ); } synchronized(eventListenersLock) { @@ -920,38 +920,38 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } } - + class StreamWorker extends Thread { private volatile boolean isRunning = false; private volatile boolean isActive = false; private volatile boolean isBlocked = false; - + private volatile boolean shallPause = true; private volatile boolean shallStop = false; - + private volatile StreamException streamErr = null; private volatile GLContext sharedGLCtx = null; private boolean sharedGLCtxCurrent = false; private GLDrawable dummyDrawable = null; - - /** - * Starts this daemon thread, + + /** + * Starts this daemon thread, * which initializes the stream first via {@link GLMediaPlayerImpl#initStreamImpl(int, int)} first. * <p> * After stream initialization, this thread pauses! * </p> - **/ + **/ StreamWorker() { setDaemon(true); start(); } - + private void makeCurrent(GLContext ctx) { if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) { throw new GLException("Couldn't make ctx current: "+ctx); } } - + private void destroySharedGL() { if( null != sharedGLCtx ) { if( sharedGLCtx.isCreated() ) { @@ -963,16 +963,16 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { gle.printStackTrace(); } } - sharedGLCtx = null; + sharedGLCtx = null; } if( null != dummyDrawable ) { final AbstractGraphicsDevice device = dummyDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); dummyDrawable.setRealized(false); dummyDrawable = null; device.close(); - } + } } - + public synchronized void initGL(GL gl) { final GLContext glCtx = gl.getContext(); final boolean glCtxCurrent = glCtx.isCurrent(); @@ -1013,7 +1013,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { while( !isActive ) { this.notify(); // wake-up pause-block try { - this.wait(); // wait until resumed + this.wait(); // wait until resumed } catch (InterruptedException e) { e.printStackTrace(); } @@ -1041,12 +1041,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } public boolean isRunning() { return isRunning; } public boolean isActive() { return isActive; } - public StreamException getStreamErr() { return streamErr; } - + public StreamException getStreamErr() { return streamErr; } + public void run() { setName(getName()+"-StreamWorker_"+StreamWorkerInstanceId); StreamWorkerInstanceId++; - + synchronized ( this ) { isRunning = true; try { @@ -1061,7 +1061,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return; // end of thread! } // also initializes width, height, .. etc } - + while( !shallStop ){ if( shallPause ) { synchronized ( this ) { @@ -1100,7 +1100,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } } - + if( !shallStop ) { TextureFrame nextFrame = null; try { @@ -1121,7 +1121,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { Thread.sleep(STREAM_WORKER_DELAY); } if( !videoFramesDecoded.put(nextFrame) ) { - throw new InternalError("XXX: free "+videoFramesFree+", decoded "+videoFramesDecoded+", "+GLMediaPlayerImpl.this); + throw new InternalError("XXX: free "+videoFramesFree+", decoded "+videoFramesDecoded+", "+GLMediaPlayerImpl.this); } newFrameAvailable(nextFrame, Platform.currentTimeMillis()); nextFrame = null; @@ -1170,10 +1170,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.notify(); // wake-up doStop() } } - } - static int StreamWorkerInstanceId = 0; + } + static int StreamWorkerInstanceId = 0; private StreamWorker streamWorker = null; - + protected final int addStateEventMask(int event_mask, State newState) { if( state != newState ) { switch( newState ) { @@ -1193,7 +1193,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } return event_mask; } - + protected final void attributesUpdated(int event_mask) { if( 0 != event_mask ) { final long now = Platform.currentTimeMillis(); @@ -1204,7 +1204,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } } - + protected final void changeState(int event_mask, State newState) { event_mask = addStateEventMask(event_mask, newState); if( 0 != event_mask ) { @@ -1212,9 +1212,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { attributesUpdated( event_mask ); } } - - protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream, - int bps_video, int bps_audio, float fps, + + protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream, + int bps_video, int bps_audio, float fps, int videoFrames, int audioFrames, int duration, String vcodec, String acodec) { int event_mask = 0; if( state == State.Uninitialized ) { @@ -1227,19 +1227,19 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { if( this.vid != vid ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_VID; this.vid = vid; - } + } if( STREAM_ID_AUTO == vid ) { vid = STREAM_ID_NONE; } if( this.aid != aid ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_AID; this.aid = aid; - } + } if( this.width != width || this.height != height ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_SIZE; this.width = width; this.height = height; - } + } if( this.fps != fps ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_FPS; this.fps = fps; @@ -1257,7 +1257,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.audioFrames = audioFrames; this.duration = duration; } - if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) { + if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) { event_mask |= GLMediaEventListener.EVENT_CHANGE_CODEC; this.acodec = acodec; } @@ -1283,7 +1283,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { attributesUpdated(GLMediaEventListener.EVENT_CHANGE_SIZE); } } - + @Override public final URI getURI() { return streamLoc; @@ -1291,10 +1291,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { @Override public final int getVID() { return vid; } - + @Override public final int getAID() { return aid; } - + @Override public final String getVideoCodec() { return vcodec; @@ -1309,7 +1309,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { public final int getVideoFrames() { return videoFrames; } - + @Override public final int getAudioFrames() { return audioFrames; @@ -1319,7 +1319,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { public final int getDuration() { return duration; } - + @Override public final long getStreamBitrate() { return bps_stream; @@ -1329,12 +1329,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { public final int getVideoBitrate() { return bps_video; } - + @Override public final int getAudioBitrate() { return bps_audio; } - + @Override public final float getFramerate() { return fps; @@ -1344,7 +1344,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { public final boolean isGLOriented() { return isInGLOrientation; } - + @Override public final int getWidth() { return width; @@ -1369,11 +1369,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { "Video[id "+vid+", <"+vcodec+">, "+width+"x"+height+", glOrient "+isInGLOrientation+", "+fps+" fps, "+frame_duration+" fdur, "+bps_video+" bps], "+ "Audio[id "+aid+", <"+acodec+">, "+bps_audio+" bps, "+audioFrames+" frames], uri "+loc+camPath+"]"; } - + @Override public final String getPerfString() { final long currentTimeMillis = Platform.currentTimeMillis(); - final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed ); + final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed ); final int d_vpts = video_pts_last - video_scr; final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed ); final int audio_pts = getAudioPTSImpl(); @@ -1383,7 +1383,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private final String getPerfStringImpl(final int video_scr, final int video_pts, final int d_vpts, final int audio_scr, final int audio_pts, final int d_apts, final int video_dpts_avg_diff) { - final float tt = getDuration() / 1000.0f; + final float tt = getDuration() / 1000.0f; final String audioSinkInfo; final AudioSink audioSink = getAudioSink(); if( null != audioSink ) { diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java index 85fab96a4..6e006d9c0 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java @@ -22,75 +22,75 @@ public class JavaSoundAudioSink implements AudioSink { public static final int BUFFER_SIZE = 1000; public static final int SAMPLES_PER_BUFFER = BUFFER_SIZE / 2; private static final boolean staticAvailable; - + // Sample time values // public static final double SAMPLE_TIME_IN_SECS = 1.0 / DEFAULT_SAMPLE_RATE; // public static final double BUFFER_TIME_IN_SECS = SAMPLE_TIME_IN_SECS * SAMPLES_PER_BUFFER; - + private javax.sound.sampled.AudioFormat format; private DataLine.Info info; private SourceDataLine auline; private int bufferCount; - private byte [] sampleData = new byte[BUFFER_SIZE]; + private byte [] sampleData = new byte[BUFFER_SIZE]; private boolean initialized = false; private AudioSink.AudioFormat chosenFormat = null; - + private volatile boolean playRequested = false; private float volume = 1.0f; - + static { boolean ok = false; try { AudioSystem.getAudioFileTypes(); ok = true; } catch (Throwable t) { - + } staticAvailable=ok; - } - + } + @Override public String toString() { return "JavaSoundSink[init "+initialized+", dataLine "+info+", source "+auline+", bufferCount "+bufferCount+ ", chosen "+chosenFormat+", jsFormat "+format; } - + @Override public final float getPlaySpeed() { return 1.0f; } // FIXME - + @Override - public final boolean setPlaySpeed(float rate) { - return false; // FIXME + public final boolean setPlaySpeed(float rate) { + return false; // FIXME } - + @Override public final float getVolume() { // FIXME - return volume; + return volume; } - + @Override public final boolean setVolume(float v) { // FIXME volume = v; return true; } - + @Override public AudioSink.AudioFormat getPreferredFormat() { return DefaultFormat; } - + @Override public final int getMaxSupportedChannels() { return 2; } - + @Override public final boolean isSupported(AudioSink.AudioFormat format) { return true; } - + @Override public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { if( !staticAvailable ) { @@ -117,12 +117,12 @@ public class JavaSoundAudioSink implements AudioSink { } return true; } - + @Override public boolean isPlaying() { return playRequested && auline.isRunning(); } - + @Override public void play() { if( null != auline ) { @@ -135,7 +135,7 @@ public class JavaSoundAudioSink implements AudioSink { auline.start(); } } - + @Override public void pause() { if( null != auline ) { @@ -143,9 +143,9 @@ public class JavaSoundAudioSink implements AudioSink { auline.stop(); } } - + @Override - public void flush() { + public void flush() { if( null != auline ) { playRequested = false; auline.stop(); @@ -157,17 +157,17 @@ public class JavaSoundAudioSink implements AudioSink { public final int getEnqueuedFrameCount() { return 0; // FIXME } - + @Override public int getFrameCount() { return 1; } - + @Override public int getQueuedFrameCount() { return 0; } - + @Override public boolean isInitialized() { return initialized; @@ -179,7 +179,7 @@ public class JavaSoundAudioSink implements AudioSink { chosenFormat = null; // FIXEM: complete code! } - + @Override public AudioFrame enqueueData(AudioDataFrame audioDataFrame) { int byteSize = audioDataFrame.getByteSize(); @@ -188,7 +188,7 @@ public class JavaSoundAudioSink implements AudioSink { final int p = byteBuffer.position(); byteBuffer.get(bytes, 0, byteSize); byteBuffer.position(p); - + int written = 0; int len; while (byteSize > 0) { @@ -203,27 +203,27 @@ public class JavaSoundAudioSink implements AudioSink { @Override public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) { return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount)); - } - + } + @Override public int getQueuedByteCount() { return auline.getBufferSize() - auline.available(); } - + @Override public int getFreeFrameCount() { return auline.available(); } - + @Override public int getQueuedTime() { return getQueuedTimeImpl( getQueuedByteCount() ); } private final int getQueuedTimeImpl(int byteCount) { final int bytesPerSample = chosenFormat.sampleSize >>> 3; // /8 - return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) ); + return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) ); } @Override - public final int getPTS() { return 0; } // FIXME + public final int getPTS() { return 0; } // FIXME } diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java index 723bb9dd1..8d3dbdf44 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java @@ -15,32 +15,32 @@ public class NullAudioSink implements AudioSink { private volatile float playSpeed = 1.0f; private volatile boolean playRequested = false; private float volume = 1.0f; - + @Override public final float getPlaySpeed() { return playSpeed; } - + @Override - public final boolean setPlaySpeed(float rate) { + public final boolean setPlaySpeed(float rate) { if( Math.abs(1.0f - rate) < 0.01f ) { rate = 1.0f; } - playSpeed = rate; + playSpeed = rate; return true; } - + @Override public final float getVolume() { // FIXME - return volume; + return volume; } - + @Override public final boolean setVolume(float v) { // FIXME - volume = v; + volume = v; return true; } - + @Override public AudioFormat getPreferredFormat() { return DefaultFormat; @@ -50,73 +50,73 @@ public class NullAudioSink implements AudioSink { public final int getMaxSupportedChannels() { return 8; } - + @Override public final boolean isSupported(AudioFormat format) { return true; } - + @Override public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { return true; } - + @Override public boolean isPlaying() { return playRequested; } - + @Override public void play() { playRequested = true; } - + @Override public void pause() { playRequested = false; } - + @Override - public void flush() { + public void flush() { } - + @Override public void destroy() { } - + @Override public final int getEnqueuedFrameCount() { return 0; } - + @Override public int getFrameCount() { return 0; } - + @Override public int getQueuedFrameCount() { return 0; } - + @Override public int getQueuedByteCount() { return 0; } - + @Override public int getQueuedTime() { return 0; } - + @Override public final int getPTS() { return 0; } - + @Override public int getFreeFrameCount() { - return 1; + return 1; } - + @Override public AudioFrame enqueueData(AudioDataFrame audioDataFrame) { return null; @@ -125,5 +125,5 @@ public class NullAudioSink implements AudioSink { @Override public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) { return null; - } + } } diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java index 1cddaa9cf..840149272 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -54,10 +54,10 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { private TextureData texData = null; private int pos_ms = 0; private long pos_start = 0; - + public NullGLMediaPlayer() { super(); - + } @Override @@ -82,16 +82,16 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { validatePos(); return pos_ms; } - + @Override protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { final int pts = getAudioPTSImpl(); nextFrame.setPTS( pts ); return pts; } - + @Override - protected final int getAudioPTSImpl() { + protected final int getAudioPTSImpl() { pos_ms = (int) ( Platform.currentTimeMillis() - pos_start ); validatePos(); return pos_ms; @@ -102,9 +102,9 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { if(null != texData) { texData.destroy(); texData = null; - } + } } - + public final static TextureData createTestTextureData() { TextureData res = null; try { @@ -125,28 +125,28 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { buffer.rewind(); res = new TextureData(GLProfile.getGL2ES2(), GL.GL_RGBA, w, h, 0, - GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false, + GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false, false, false, buffer, null); } return res; } - + @Override protected final void initStreamImpl(int vid, int aid) throws IOException { texData = createTestTextureData(); final float _fps = 24f; final int _duration = 10*60*1000; // msec final int _totalFrames = (int) ( (_duration/1000)*_fps ); - updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE, - texData.getWidth(), texData.getHeight(), 0, - 0, 0, _fps, + updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE, + texData.getWidth(), texData.getHeight(), 0, + 0, 0, _fps, _totalFrames, 0, _duration, "png-static", null); - } + } @Override protected final void initGLImpl(GL gl) throws IOException, GLException { isInGLOrientation = true; } - + /** * {@inheritDoc} * <p> @@ -157,21 +157,21 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { protected int validateTextureCount(int desiredTextureCount) { return 2; } - + @Override protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) { final Texture texture = super.createTexImageImpl(gl, texName, width, height); if(null != texData) { texture.updateImage(gl, texData); - } + } return new TextureSequence.TextureFrame( texture ); } - + @Override protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { super.destroyTexFrame(gl, frame); } - + private void validatePos() { boolean considerPausing = false; if( 0 > pos_ms) { diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index 146a47ebc..390c20346 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.util.av.impl; import java.security.AccessController; @@ -48,9 +48,9 @@ import com.jogamp.common.util.VersionNumber; */ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final boolean DEBUG = FFMPEGMediaPlayer.DEBUG || DynamicLibraryBundleInfo.DEBUG; - + private static final List<String> glueLibNames = new ArrayList<String>(); // none - + private static final int symbolCount = 65; private static final String[] symbolNames = { "avutil_version", @@ -61,10 +61,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { // libavcodec "avcodec_register_all", - "avcodec_close", - "avcodec_string", - "avcodec_find_decoder", - "avcodec_open2", // 53.6.0 (opt) + "avcodec_close", + "avcodec_string", + "avcodec_find_decoder", + "avcodec_open2", // 53.6.0 (opt) "avcodec_alloc_frame", "avcodec_get_frame_defaults", "avcodec_free_frame", // 54.28.0 (opt) @@ -79,10 +79,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "av_init_packet", "av_new_packet", "av_destruct_packet", - "av_free_packet", + "av_free_packet", "avcodec_decode_audio4", // 53.25.0 (opt) /* 27 */ "avcodec_decode_video2", // 52.23.0 - + // libavutil "av_pix_fmt_descriptors", "av_frame_unref", // 55.0.0 (opt) @@ -101,10 +101,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "avformat_alloc_context", "avformat_free_context", // 52.96.0 (opt) "avformat_close_input", // 53.17.0 (opt) - "av_register_all", + "av_register_all", "av_find_input_format", - "avformat_open_input", - "av_dump_format", + "avformat_open_input", + "av_dump_format", "av_read_frame", "av_seek_frame", "avformat_seek_file", // ??? (opt) @@ -115,24 +115,24 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { /* 54 */ "avformat_find_stream_info", // 53.3.0 (opt) // libavdevice -/* 55 */ "avdevice_register_all", // ??? - +/* 55 */ "avdevice_register_all", // ??? + // libavresample "avresample_alloc_context", // 1.0.1 "avresample_open", "avresample_close", "avresample_free", /* 60 */ "avresample_convert", - + // libavresample "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample! "swr_alloc", - "swr_init", + "swr_init", "swr_free", /* 65 */ "swr_convert", }; - + // optional symbol names private static final String[] optionalSymbolNames = { "avformat_seek_file", // ??? (opt) @@ -145,7 +145,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { // libavdevice "avdevice_register_all", // 53.0.0 (opt) - + // libavresample "avresample_version", // 1.0.1 "avresample_alloc_context", // 1.0.1 @@ -153,43 +153,43 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "avresample_close", "avresample_free", "avresample_convert", - + // libavresample "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample! "swresample_version", // 0 "swr_alloc", - "swr_init", + "swr_init", "swr_free", "swr_convert", }; - + private static final long[] symbolAddr = new long[symbolCount]; private static final boolean ready; private static final boolean libsUFCLoaded; private static final boolean avresampleLoaded; // optional private static final boolean swresampleLoaded; // optional private static final boolean avdeviceLoaded; // optional - static final VersionNumber avCodecVersion; + static final VersionNumber avCodecVersion; static final VersionNumber avFormatVersion; static final VersionNumber avUtilVersion; static final VersionNumber avResampleVersion; static final VersionNumber swResampleVersion; private static final FFMPEGNatives natives; - + private static final int LIB_IDX_UTI = 0; private static final int LIB_IDX_FMT = 1; private static final int LIB_IDX_COD = 2; private static final int LIB_IDX_DEV = 3; private static final int LIB_IDX_AVR = 4; private static final int LIB_IDX_SWR = 5; - + static { - // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile + // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile GLProfile.initSingleton(); boolean _ready = false; - /** util, format, codec, device, avresample, swresample */ - boolean[] _loaded= new boolean[6]; - /** util, format, codec, avresample, swresample */ + /** util, format, codec, device, avresample, swresample */ + boolean[] _loaded= new boolean[6]; + /** util, format, codec, avresample, swresample */ VersionNumber[] _versions = new VersionNumber[5]; try { _ready = initSymbols(_loaded, _versions); @@ -226,7 +226,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } else { System.err.println("LIB_AV No Version/Native-Impl Match"); natives = null; - } + } if( null != natives && FFMPEGStaticNatives.initIDs0() ) { ready = natives.initSymbols0(symbolAddr, symbolCount); } else { @@ -234,7 +234,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } } } - + static boolean libsLoaded() { return libsUFCLoaded; } static boolean avDeviceLoaded() { return avdeviceLoaded; } static boolean avResampleLoaded() { return avresampleLoaded; } @@ -265,11 +265,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { if(symbolNames.length != symbolCount) { throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount); } - + // optional symbol name set final Set<String> optionalSymbolNameSet = new HashSet<String>(); optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames)); - + // lookup AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { @@ -278,9 +278,9 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } return null; } } ); - + // validate results - boolean res = true; + boolean res = true; for(int i = 0; i<symbolCount; i++) { if( 0 == symbolAddr[i] ) { // no symbol, check optional and alternative symbols @@ -298,10 +298,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2])); versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3])); versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4])); - + return res; } - + protected FFMPEGDynamicLibraryBundleInfo() { } @@ -313,12 +313,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { * <p> * Returns <code>true</code>. * </p> - */ + */ @Override public final boolean shallLookupGlobal() { - return true; + return true; } - + @Override public final List<String> getGlueLibNames() { return glueLibNames; @@ -329,7 +329,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { List<List<String>> libsList = new ArrayList<List<String>>(); // 6: util, format, codec, device, avresample, swresample - + final List<String> avutil = new ArrayList<String>(); avutil.add("avutil"); // default @@ -337,13 +337,13 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10 avutil.add("libavutil.so.51"); // 0.8 avutil.add("libavutil.so.50"); // 0.7 - + avutil.add("avutil-53"); // dummy future proof avutil.add("avutil-52"); // ffmpeg 1.2 + 2 / libav 9 + 10 avutil.add("avutil-51"); // 0.8 avutil.add("avutil-50"); // 0.7 libsList.add(avutil); - + final List<String> avformat = new ArrayList<String>(); avformat.add("avformat"); // default @@ -352,14 +352,14 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { avformat.add("libavformat.so.54"); // ffmpeg 1.2 / libav 9 avformat.add("libavformat.so.53"); // 0.8 avformat.add("libavformat.so.52"); // 0.7 - + avformat.add("avformat-56"); // dummy future proof avformat.add("avformat-55"); // ffmpeg 2 / libav 10 avformat.add("avformat-54"); // ffmpeg 1.2 / libav 9 avformat.add("avformat-53"); // 0.8 - avformat.add("avformat-52"); // 0.7 + avformat.add("avformat-52"); // 0.7 libsList.add(avformat); - + final List<String> avcodec = new ArrayList<String>(); avcodec.add("avcodec"); // default @@ -367,15 +367,15 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { avcodec.add("libavcodec.so.55"); // ffmpeg 2/ libav 10 avcodec.add("libavcodec.so.54"); // ffmpeg 1.2 / libav 9 avcodec.add("libavcodec.so.53"); // 0.8 - avcodec.add("libavcodec.so.52"); // 0.7 - + avcodec.add("libavcodec.so.52"); // 0.7 + avcodec.add("avcodec-56"); // dummy future proof avcodec.add("avcodec-55"); // ffmpeg 2/ libav 10 avcodec.add("avcodec-54"); // ffmpeg 1.2 / libav 9 avcodec.add("avcodec-53"); // 0.8 - avcodec.add("avcodec-52"); // 0.7 + avcodec.add("avcodec-52"); // 0.7 libsList.add(avcodec); - + final List<String> avdevice = new ArrayList<String>(); avdevice.add("avdevice"); // default @@ -383,19 +383,19 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { avdevice.add("libavdevice.so.55"); // ffmpeg 2 avdevice.add("libavdevice.so.54"); // ffmpeg 1.2 / libav 10 avdevice.add("libavdevice.so.53"); // 0.8 && libav 9 - + avdevice.add("avdevice-56"); // dummy future proof avdevice.add("avdevice-55"); // ffmpeg 2 avdevice.add("avdevice-54"); // ffmpeg 1.2 / libav 10 avdevice.add("avdevice-53"); // 0.8 && libav 9 libsList.add(avdevice); - + final List<String> avresample = new ArrayList<String>(); avresample.add("avresample"); // default avresample.add("libavresample.so.2"); // dummy future proof avresample.add("libavresample.so.1"); // libav 9 + 10 - + avresample.add("avresample-2"); // dummy future proof avresample.add("avresample-1"); // libav 9 + 10 libsList.add(avresample); @@ -405,11 +405,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { swresample.add("libswresample.so.1"); // dummy future proof swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.x - + swresample.add("swresample-1"); // dummy future proof swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x libsList.add(swresample); - + return libsList; } @@ -431,5 +431,5 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { @Override public final RunnableExecutor getLibLoaderExecutor() { return DynamicLibraryBundle.getDefaultRunnableExecutor(); - } + } } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index f196ebef1..2abd73181 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -65,18 +65,18 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * Besides the default BSD/Linux/.. repositories and installations, * precompiled binaries can be found at the * <a href="#libavavail">listed location below</a>. - * </p> - * + * </p> + * * <a name="implspecifics"><h5>Implementation specifics</h5></a> * <p> - * The decoded video frame is written directly into an OpenGL texture - * on the GPU in it's native format. A custom fragment shader converts - * the native pixelformat to a usable <i>RGB</i> format if required. - * Hence only 1 copy is required before bloating the picture + * The decoded video frame is written directly into an OpenGL texture + * on the GPU in it's native format. A custom fragment shader converts + * the native pixelformat to a usable <i>RGB</i> format if required. + * Hence only 1 copy is required before bloating the picture * from <i>YUV*</i> to <i>RGB</i>, for example. - * </p> + * </p> * <p> - * Implements pixel format conversion to <i>RGB</i> via + * Implements pixel format conversion to <i>RGB</i> via * fragment shader texture-lookup functions: * <ul> * <li>{@link PixelFormat#YUV420P}</li> @@ -88,10 +88,10 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * </ul> * </p> * <p> - * + * * <a name="libavspecifics"><h5>Libav Specifics</h5></a> * <p> - * Utilizes a slim dynamic and native binding to the Lib_av + * Utilizes a slim dynamic and native binding to the Lib_av * libraries: * <ul> * <li>libavcodec</li> @@ -99,9 +99,9 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * <li>libavutil</li> * <li>libavresample (opt)</li> * <li>libavdevice (opt)</li> - * </ul> + * </ul> * </p> - * + * * <a name="compatibility"><h5>LibAV Compatibility</h5></a> * <p> * Currently we are binary compatible w/: @@ -115,25 +115,25 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * <p> * See http://upstream-tracker.org/versions/libav.html * </p> - * <p> - * Check tag 'FIXME: Add more planar formats !' + * <p> + * Check tag 'FIXME: Add more planar formats !' * here and in the corresponding native code * <code>jogl/src/jogl/native/libav/ffmpeg_impl_template.c</code> * </p> - * - * + * + * * <a name="todo"><h5>TODO:</h5></a> * <p> * <ul> * <li>better audio synchronization handling? (video is synchronized)</li> - * </ul> + * </ul> * </p> - * + * * <a name="libavavail"><h5>FFMPEG / LibAV Availability</h5></a> * <p> * <ul> * <li>GNU/Linux: ffmpeg or libav are deployed in most distributions.</li> - * <li>Windows: + * <li>Windows: * <ul> * <li>http://ffmpeg.zeranoe.com/builds/ (ffmpeg) <i>recommended, works w/ dshow</i></li> * <li>http://win32.libav.org/releases/ (libav)</li> @@ -144,22 +144,22 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * pkt install pkg:/video/ffmpeg * </pre></li> * </ul> - * </p> + * </p> */ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { /** POSIX ENOSYS {@value}: Function not implemented. FIXME: Move to GlueGen ?!*/ private static final int ENOSYS = 38; - + // Instance data private static final FFMPEGNatives natives; private static final int avUtilMajorVersionCC; private static final int avFormatMajorVersionCC; - private static final int avCodecMajorVersionCC; + private static final int avCodecMajorVersionCC; private static final int avResampleMajorVersionCC; private static final int swResampleMajorVersionCC; private static final boolean available; - + static { final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton(); final boolean libAVVersionGood; @@ -171,7 +171,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avUtilMajorVersionCC = natives.getAvUtilMajorVersionCC0(); avResampleMajorVersionCC = natives.getAvResampleMajorVersionCC0(); swResampleMajorVersionCC = natives.getSwResampleMajorVersionCC0(); - } else { + } else { avUtilMajorVersionCC = 0; avFormatMajorVersionCC = 0; avCodecMajorVersionCC = 0; @@ -211,25 +211,25 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } available = libAVGood && libAVVersionGood && null != natives; } - + public static final boolean isAvailable() { return available; } // // General // - - private long moviePtr = 0; - + + private long moviePtr = 0; + // // Video // - + private String texLookupFuncName = "ffmpegTexture2D"; - private boolean usesTexLookupShader = false; + private boolean usesTexLookupShader = false; private PixelFormat vPixelFmt = null; private int vPlanes = 0; private int vBitsPerPixel = 0; - private int vBytesPerPixelPerPlane = 0; + private int vBytesPerPixelPerPlane = 0; private int texWidth, texHeight; // overall (stuffing planes in one texture) private String singleTexComp = "r"; private GLPixelStorageModes psm; @@ -237,10 +237,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { // // Audio // - + private AudioSink.AudioFormat avChosenAudioFormat; private int audioSamplesPerFrameAndChannel = 0; - + public FFMPEGMediaPlayer() { if(!available) { throw new RuntimeException("FFMPEGMediaPlayer not available"); @@ -263,14 +263,14 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } private final void destroyAudioSink() { final AudioSink _audioSink = audioSink; - if( null != _audioSink ) { + if( null != _audioSink ) { audioSink = null; _audioSink.destroy(); } } - + public static final String dev_video_linux = "/dev/video"; - + @Override protected final void initStreamImpl(int vid, int aid) throws IOException { if(0==moviePtr) { @@ -279,7 +279,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if(DEBUG) { System.err.println("initStream: p1 "+this); } - + final String streamLocS=IOUtil.decodeFromURI(streamLoc.toString()); destroyAudioSink(); if( GLMediaPlayer.STREAM_ID_NONE == aid ) { @@ -291,7 +291,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if(DEBUG) { System.err.println("initStream: p2 preferred "+preferredAudioFormat+", "+this); } - + final boolean isCameraInput = null != cameraPath; final String resStreamLocS; // int rw=640, rh=480, rr=15; @@ -314,7 +314,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { case OPENKODE: default: resStreamLocS = streamLocS; // FIXME: ?? - break; + break; } if( null != cameraProps ) { sizes = cameraProps.get(CameraPropSizeS); @@ -362,7 +362,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if(DEBUG) { System.err.println("initGL: p3 avChosen "+avChosenAudioFormat); } - + if( STREAM_ID_NONE == aid ) { audioSink.destroy(); audioSink = AudioSinkFactory.createNull(); @@ -386,7 +386,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { System.err.println("initGL: p4 chosen "+avChosenAudioFormat); System.err.println("initGL: p4 chosen "+audioSink); } - + if( null != gl && STREAM_ID_NONE != vid ) { int tf, tif=GL.GL_RGBA; // texture format and internal format int tt = GL.GL_UNSIGNED_BYTE; @@ -413,9 +413,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { tf = GL2ES2.GL_BGRA; tif=GL.GL_RGBA; break; } else { tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break; - } + } default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane); - } + } setTextureFormat(tif, tf); setTextureType(tt); if(DEBUG) { @@ -423,12 +423,12 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { ", tex "+texWidth+"x"+texHeight+", usesTexLookupShader "+usesTexLookupShader); } } - } + } @Override protected final TextureFrame createTexImage(GL gl, int texName) { return new TextureFrame( createTexImageImpl(gl, texName, texWidth, texHeight) ); } - + /** * @param sampleRate sample rate in Hz (1/s) * @param sampleSize sample size in bits @@ -439,10 +439,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param littleEndian true for little-endian, false for big endian * @return */ - + /** * Native callback - * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}. + * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}. * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}. * @param audioSampleRate sample rate in Hz (1/s) * @param audioChannels number of channels @@ -456,9 +456,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } return res; } - + /** - * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values. + * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values. * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}. * @param audioSampleRate sample rate in Hz (1/s) * @param audioChannels number of channels @@ -506,7 +506,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } return new AudioFormat(audioSampleRate, sampleSize, audioChannels, signed, fixedP, planar, true /* littleEndian */); } - + /** * Native callback * @param vid @@ -523,9 +523,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param audioChannels * @param audioSamplesPerFrameAndChannel in audio samples per frame and channel */ - void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, + void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, int tWd0, int tWd1, int tWd2, int vW, int vH, - int aid, int audioSampleFmt, int audioSampleRate, + int aid, int audioSampleFmt, int audioSampleRate, int audioChannels, int audioSamplesPerFrameAndChannel) { // defaults .. vPixelFmt = null; @@ -534,28 +534,28 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { vBytesPerPixelPerPlane = 0; usesTexLookupShader = false; texWidth = 0; texHeight = 0; - + final int[] vTexWidth = { 0, 0, 0 }; // per plane - + if( STREAM_ID_NONE != vid ) { vPixelFmt = PixelFormat.valueOf(pixFmt); vPlanes = planes; vBitsPerPixel = bitsPerPixel; - vBytesPerPixelPerPlane = bytesPerPixelPerPlane; + vBytesPerPixelPerPlane = bytesPerPixelPerPlane; vTexWidth[0] = tWd0; vTexWidth[1] = tWd1; vTexWidth[2] = tWd2; - + switch(vPixelFmt) { case YUVJ420P: case YUV420P: // < planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) usesTexLookupShader = true; // YUV420P: Adding U+V on right side of fixed height texture, // since width is already aligned by decoder. - // Splitting texture to 4 quadrants: + // Splitting texture to 4 quadrants: // Y covers left top/low quadrant // U on top-right quadrant. // V on low-right quadrant. // Y=w*h, U=w/2*h/2, V=w/2*h/2 - // w*h + 2 ( w/2 * h/2 ) + // w*h + 2 ( w/2 * h/2 ) // w*h + w*h/2 texWidth = vTexWidth[0] + vTexWidth[1]; texHeight = vH; break; @@ -573,27 +573,27 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { case YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr - stuffed into RGBA half width texture case BGR24: usesTexLookupShader = true; - texWidth = vTexWidth[0]; texHeight = vH; + texWidth = vTexWidth[0]; texHeight = vH; break; - + case RGB24: case ARGB: case RGBA: case ABGR: case BGRA: usesTexLookupShader = false; - texWidth = vTexWidth[0]; texHeight = vH; + texWidth = vTexWidth[0]; texHeight = vH; break; default: // FIXME: Add more formats ! throw new RuntimeException("Unsupported pixelformat: "+vPixelFmt); } } - + // defaults .. final SampleFormat aSampleFmt; avChosenAudioFormat = null;; this.audioSamplesPerFrameAndChannel = 0; - + if( STREAM_ID_NONE != aid ) { aSampleFmt = SampleFormat.valueOf(audioSampleFmt); avChosenAudioFormat = avAudioFormat2Local(aSampleFmt, audioSampleRate, audioChannels); @@ -601,7 +601,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } else { aSampleFmt = null; } - + if(DEBUG) { System.err.println("audio: id "+aid+", fmt "+aSampleFmt+", "+avChosenAudioFormat+", aFrameSize/fc "+audioSamplesPerFrameAndChannel); System.err.println("video: id "+vid+", fmt "+vW+"x"+vH+", "+vPixelFmt+", planes "+vPlanes+", bpp "+vBitsPerPixel+"/"+vBytesPerPixelPerPlane+", usesTexLookupShader "+usesTexLookupShader); @@ -612,7 +612,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { System.err.println(this.toString()); } } - + /** * Native callback * @param isInGLOrientation @@ -624,13 +624,13 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param tWd1 * @param tWd2 */ - void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, + void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, int tWd0, int tWd1, int tWd2, int vW, int vH) { } - + /** * {@inheritDoc} - * + * * If this implementation generates a specialized shader, * it allows the user to override the default function name <code>ffmpegTexture2D</code>. * Otherwise the call is delegated to it's super class. @@ -646,15 +646,15 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } return texLookupFuncName; } - return super.getTextureLookupFunctionName(desiredFuncName); + return super.getTextureLookupFunctionName(desiredFuncName); } - + /** * {@inheritDoc} - * + * * Depending on the pixelformat, a specific conversion shader is being created, - * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class. - */ + * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class. + */ @Override public final String getTextureLookupFragmentShaderImpl() throws IllegalStateException { if(State.Uninitialized == state) { @@ -685,7 +685,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { " return vec4(r, g, b, 1);\n"+ "}\n" ; - + case YUVJ422P: case YUV422P: ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) return @@ -706,7 +706,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { " return vec4(r, g, b, 1);\n"+ "}\n" ; - + case YUYV422: // < packed YUV 4:2:2, 2 x 16bpp, [Y0 Cb] [Y1 Cr] // Stuffed into RGBA half width texture return @@ -740,9 +740,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { default: // FIXME: Add more formats ! throw new InternalError("Add proper mapping of: vPixelFmt "+vPixelFmt+", usesTexLookupShader "+usesTexLookupShader); - } + } } - + @Override public final boolean playImpl() { if(0==moviePtr) { @@ -754,7 +754,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } return true; } - + @Override public final boolean pauseImpl() { if(0==moviePtr) { @@ -780,12 +780,12 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1 gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit()); } - + @Override protected void postNextTextureImpl(GL gl) { psm.restore(gl); } - + @Override protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { if(0==moviePtr) { @@ -806,14 +806,14 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { nextFrame.setPTS(vPTS); } return vPTS; - } - + } + final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) { setFirstAudioPTS2SCR( audio_pts ); if( 1.0f == playSpeed || audioSinkPlaySpeedSet ) { audioSink.enqueueData( audio_pts, sampleData, data_size); } } - + } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java index 8e08c23fa..bc0865aa9 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -30,21 +30,21 @@ package jogamp.opengl.util.av.impl; import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; interface FFMPEGNatives { - + boolean initSymbols0(long[] symbols, int count); int getAvUtilMajorVersionCC0(); int getAvFormatMajorVersionCC0(); int getAvCodecMajorVersionCC0(); int getAvResampleMajorVersionCC0(); int getSwResampleMajorVersionCC0(); - + long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); void destroyInstance0(long moviePtr); - + /** * Issues {@link #updateAttributes(int, int, int, int, int, int, int, float, int, int, String, String)} * and {@link #updateAttributes2(int, int, int, int, int, int, int, int, int, int)}. - * + * * @param moviePtr * @param url * @param vid @@ -56,25 +56,25 @@ interface FFMPEGNatives { * @param aPrefSampleRate * @param aPrefChannelCount */ - void setStream0(long moviePtr, String url, boolean isCameraInput, - int vid, String sizes, int vWidth, int vHeight, + void setStream0(long moviePtr, String url, boolean isCameraInput, + int vid, String sizes, int vWidth, int vHeight, int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate); - + void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish); - int getVideoPTS0(long moviePtr); - + int getVideoPTS0(long moviePtr); + int getAudioPTS0(long moviePtr); - + /** * @return resulting current video PTS, or {@link TextureFrame#INVALID_PTS} */ int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType); - + int play0(long moviePtr); int pause0(long moviePtr); int seek0(long moviePtr, int position); - + /** FFMPEG/libAV Audio Sample Format */ public static enum SampleFormat { // NONE = -1, @@ -89,10 +89,10 @@ interface FFMPEGNatives { S32P, ///< signed 32 bits, planar FLTP, ///< float, planar DBLP, ///< double, planar - + COUNT; ///< Number of sample formats. - - /** + + /** * Returns the matching SampleFormat value corresponding to the given SampleFormat's integer ordinal. * <pre> * given: @@ -131,7 +131,7 @@ interface FFMPEGNatives { /** planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) */ YUV411P, /** Y, 8bpp */ - GRAY8, + GRAY8, /** Y, 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb */ MONOWHITE, /** Y, 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb */ @@ -151,57 +151,57 @@ interface FFMPEGNatives { /** packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 */ UYVY422, /** packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 */ - UYYVYY411, + UYYVYY411, /** packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) */ - BGR8, + BGR8, /** packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits */ - BGR4, + BGR4, /** packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) */ - BGR4_BYTE, + BGR4_BYTE, /** packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) */ - RGB8, + RGB8, /** packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits */ - RGB4, + RGB4, /** packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) */ - RGB4_BYTE, + RGB4_BYTE, /** planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) */ - NV12, + NV12, /** as above, but U and V bytes are swapped */ - NV21, + NV21, /** packed ARGB 8:8:8:8, 32bpp, ARGBARGB... */ - ARGB, + ARGB, /** packed RGBA 8:8:8:8, 32bpp, RGBARGBA... */ - RGBA, + RGBA, /** packed ABGR 8:8:8:8, 32bpp, ABGRABGR... */ - ABGR, + ABGR, /** packed BGRA 8:8:8:8, 32bpp, BGRABGRA... */ - BGRA, + BGRA, /** Y, 16bpp, big-endian */ - GRAY16BE, + GRAY16BE, /** Y , 16bpp, little-endian */ - GRAY16LE, + GRAY16LE, /** planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) */ - YUV440P, + YUV440P, /** planar YUV 4:4:0 full scale (JPEG), deprecated in favor of YUV440P and setting color_range */ - YUVJ440P, + YUVJ440P, /** planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) */ - YUVA420P, + YUVA420P, /** H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */ - VDPAU_H264, + VDPAU_H264, /** MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */ - VDPAU_MPEG1, + VDPAU_MPEG1, /** MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */ - VDPAU_MPEG2, + VDPAU_MPEG2, /** WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */ - VDPAU_WMV3, + VDPAU_WMV3, /** VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */ - VDPAU_VC1, + VDPAU_VC1, /** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian */ - RGB48BE, + RGB48BE, /** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian */ - RGB48LE, + RGB48LE, RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian @@ -255,7 +255,7 @@ interface FFMPEGNatives { GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian COUNT ///< number of pixel formats in this list ; - /** + /** * Returns the matching PixelFormat value corresponding to the given PixelFormat's integer ordinal. * <pre> * given: diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java index 01c249313..22a045825 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -29,7 +29,7 @@ package jogamp.opengl.util.av.impl; import com.jogamp.common.util.VersionNumber; -class FFMPEGStaticNatives { +class FFMPEGStaticNatives { static VersionNumber getAVVersion(int vers) { return new VersionNumber( ( vers >> 16 ) & 0xFF, ( vers >> 8 ) & 0xFF, diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java index 22694888d..4b013c1b3 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -45,7 +45,7 @@ class FFMPEGv08Natives implements FFMPEGNatives { @Override public native int getSwResampleMajorVersionCC0(); - + @Override public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java index 08e19d5e6..d69763287 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -45,7 +45,7 @@ class FFMPEGv09Natives implements FFMPEGNatives { @Override public native int getSwResampleMajorVersionCC0(); - + @Override public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java index 0081743fa..0b5f70d7c 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -45,7 +45,7 @@ class FFMPEGv10Natives implements FFMPEGNatives { @Override public native int getSwResampleMajorVersionCC0(); - + @Override public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java index a5a701a4f..24198703a 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -45,19 +45,19 @@ import jogamp.opengl.util.av.EGLMediaPlayerImpl; */ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { static final boolean available; - + static { available = false; /** FIXME! - // OMX binding is included in jogl_desktop and jogl_mobile + // OMX binding is included in jogl_desktop and jogl_mobile GLProfile.initSingleton(); available = initIDs0(); */ } - + public static final boolean isAvailable() { return available; } - + protected long moviePtr = 0; - + public OMXGLMediaPlayer() { super(TextureType.KHRImage, true); if(!available) { @@ -70,21 +70,21 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { moviePtr = _createInstance(); if(0==moviePtr) { throw new GLException("Couldn't create OMXInstance"); - } + } } - + @Override protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) { final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, texName); _setStreamEGLImageTexture2D(moviePtr, texName, eglTex.getImage(), eglTex.getSync()); return eglTex; } - + @Override protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame imgTex) { - super.destroyTexFrame(gl, imgTex); + super.destroyTexFrame(gl, imgTex); } - + @Override protected void destroyImpl(GL gl) { if (moviePtr != 0) { @@ -94,20 +94,20 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { moviePtr = 0; } } - + @Override protected void initStreamImpl(int vid, int aid) throws IOException { if(0==moviePtr) { throw new GLException("OMX native instance null"); } if(!streamLoc.getScheme().equals("file")) { - throw new IOException("Only file schemes are allowed: "+streamLoc); + throw new IOException("Only file schemes are allowed: "+streamLoc); } final String path=streamLoc.getPath(); if(DEBUG) { System.out.println("initGLStream: clean path "+path); } - + if(DEBUG) { System.out.println("initGLStream: p1 "+this); } @@ -121,7 +121,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { // NOP isInGLOrientation = true; } - + @Override protected int getAudioPTSImpl() { return 0!=moviePtr ? _getCurrentPosition(moviePtr) : 0; @@ -172,8 +172,8 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { final int nextTex = _getNextTextureID(moviePtr, true); if(0 < nextTex) { // FIXME set pts ! - /* FIXME - final TextureSequence.TextureFrame eglImgTex = + /* FIXME + final TextureSequence.TextureFrame eglImgTex = texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking))); if(null!=eglImgTex) { lastTex = eglImgTex; @@ -181,7 +181,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } return 0; // FIXME: return pts } - + private String replaceAll(String orig, String search, String repl) { String dest=null; // In case replaceAll / java.util.regex.* is not supported (-> CVM) @@ -203,14 +203,14 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } private static native boolean initIDs0(); - private native long _createInstance(); + private native long _createInstance(); private native void _destroyInstance(long moviePtr); - + private native void _detachVideoRenderer(long moviePtr); // stop before private native void _attachVideoRenderer(long moviePtr); // detach before private native void _setStream(long moviePtr, int textureNum, String path); private native void _activateStream(long moviePtr); - + private native void _setStreamEGLImageTexture2D(long moviePtr, int tex, long image, long sync); private native int _seek(long moviePtr, int position); private native void _setPlaySpeed(long moviePtr, float rate); diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java index 3c468f358..2d74fa532 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java @@ -41,23 +41,23 @@ import com.jogamp.opengl.util.GLArrayDataEditable; import com.jogamp.opengl.util.glsl.ShaderState; /** - * Used for 1:1 GLSL arrays, i.e. where the buffer data - * represents this array only. + * Used for 1:1 GLSL arrays, i.e. where the buffer data + * represents this array only. */ -public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { - +public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandler { + public GLSLArrayHandler(GLArrayDataEditable ad) { super(ad); } - + public final void setSubArrayVBOName(int vboName) { throw new UnsupportedOperationException(); } - + public final void addSubHandler(GLArrayHandlerFlat handler) { throw new UnsupportedOperationException(); } - + public final void enableState(GL gl, boolean enable, Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { @@ -66,12 +66,12 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle enableSimple(glsl, enable); } } - + private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) { if(enable) { /* * This would be the non optimized code path: - * + * if(ad.isVBO()) { glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); if(!ad.isVBOWritten()) { @@ -108,13 +108,13 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle } else if(null!=buffer) { st.vertexAttribPointer(glsl, ad); } - + st.enableVertexAttribArray(glsl, ad); } else { st.disableVertexAttribArray(glsl, ad); } } - + private final void enableSimple(GL2ES2 glsl, boolean enable) { final int location = ad.getLocation(); if( 0 > location ) { @@ -123,7 +123,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle if(enable) { /* * This would be the non optimized code path: - * + * if(ad.isVBO()) { glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName()); if(!ad.isVBOWritten()) { diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java index 855406db3..a5f78b5d6 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java @@ -37,7 +37,7 @@ import com.jogamp.opengl.util.GLArrayDataWrapper; import com.jogamp.opengl.util.glsl.ShaderState; /** - * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled + * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled * separately and interleaves many arrays. */ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { @@ -50,7 +50,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { public GLArrayDataWrapper getData() { return ad; } - + public final void syncData(GL gl, Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { @@ -62,7 +62,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { } /** * Due to probable application VBO switching, this might not make any sense .. - * + * if(!written) { st.vertexAttribPointer(glsl, ad); } else if(st.getAttribLocation(glsl, ad) >= 0) { @@ -94,7 +94,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { } else { glsl.glDisableVertexAttribArray(location); } - } + } } - } + } } diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java index c2048d652..bcc146d78 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java @@ -40,8 +40,8 @@ import jogamp.opengl.util.GLVBOArrayHandler; import com.jogamp.opengl.util.GLArrayDataEditable; /** - * Interleaved fixed function arrays, i.e. where this buffer data - * represents many arrays. + * Interleaved fixed function arrays, i.e. where this buffer data + * represents many arrays. */ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler { private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>(); @@ -49,13 +49,13 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL public GLSLArrayHandlerInterleaved(GLArrayDataEditable ad) { super(ad); } - + public final void setSubArrayVBOName(int vboName) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).getData().setVBOName(vboName); - } + } } - + public final void addSubHandler(GLArrayHandlerFlat handler) { subArrays.add(handler); } @@ -63,9 +63,9 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL private final void syncSubData(GL gl, Object ext) { for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).syncData(gl, ext); - } - } - + } + } + public final void enableState(GL gl, boolean enable, Object ext) { if(enable) { if(!ad.isVBO()) { @@ -78,7 +78,7 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL } for(int i=0; i<subArrays.size(); i++) { subArrays.get(i).enableState(gl, enable, ext); - } + } } } diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java index eaf8dc30a..dba408554 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.util.glsl; import java.nio.FloatBuffer; @@ -45,33 +45,33 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc; public class GLSLTextureRaster { private final boolean textureVertFlipped; private final int textureUnit; - + private ShaderProgram sp; private PMVMatrix pmvMatrix; private GLUniformData pmvMatrixUniform; private GLUniformData activeTexUniform; private GLArrayDataServer interleavedVBO; - + public GLSLTextureRaster(int textureUnit, boolean textureVertFlipped) { this.textureVertFlipped = textureVertFlipped; this.textureUnit = textureUnit; } - + public int getTextureUnit() { return textureUnit; } static final String shaderBasename = "texture01_xxx"; static final String shaderSrcPath = "../../shader"; static final String shaderBinPath = "../../shader/bin"; - + public void init(GL2ES2 gl) { // Create & Compile the shader objects - final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), shaderSrcPath, shaderBinPath, shaderBasename, true); - final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), + final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), shaderSrcPath, shaderBinPath, shaderBasename, true); rsVp.defaultShaderCustomization(gl, true, true); rsFp.defaultShaderCustomization(gl, true, true); - + // Create & Link the shader program sp = new ShaderProgram(); sp.add(rsVp); @@ -80,13 +80,13 @@ public class GLSLTextureRaster { throw new GLException("Couldn't link program: "+sp); } sp.useProgram(gl, true); - + // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); - pmvMatrix.glLoadIdentity(); + pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) { throw new GLException("Couldn't locate "+pmvMatrixUniform+" in shader: "+sp); @@ -105,9 +105,9 @@ public class GLSLTextureRaster { } else { s_quadTexCoords = s_quadTexCoords00; } - + interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+2, GL.GL_FLOAT, false, 2*4, GL.GL_STATIC_DRAW); - { + { final GLArrayData vArrayData = interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER); if( vArrayData.setLocation(gl, sp.program()) < 0 ) { throw new GLException("Couldn't locate "+vArrayData+" in shader: "+sp); @@ -116,15 +116,15 @@ public class GLSLTextureRaster { if( tArrayData.setLocation(gl, sp.program()) < 0 ) { throw new GLException("Couldn't locate "+tArrayData+" in shader: "+sp); } - final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); + final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); for(int i=0; i<4; i++) { ib.put(s_quadVertices, i*3, 3); ib.put(s_quadTexCoords, i*2, 2); - } + } } interleavedVBO.seal(gl, true); interleavedVBO.enableBuffer(gl, false); - + sp.useProgram(gl, false); } @@ -133,14 +133,14 @@ public class GLSLTextureRaster { pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f); - + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - + sp.useProgram(gl, true); gl.glUniform(pmvMatrixUniform); sp.useProgram(gl, false); - } + } } public void dispose(GL2ES2 gl) { @@ -162,34 +162,34 @@ public class GLSLTextureRaster { } public void display(GL2ES2 gl) { - if(null != sp) { - sp.useProgram(gl, true); + if(null != sp) { + sp.useProgram(gl, true); interleavedVBO.enableBuffer(gl, true); - + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); - - interleavedVBO.enableBuffer(gl, false); + + interleavedVBO.enableBuffer(gl, false); sp.useProgram(gl, false); } } - - private static final float[] s_quadVertices = { + + private static final float[] s_quadVertices = { -1f, -1f, 0f, // LB 1f, -1f, 0f, // RB -1f, 1f, 0f, // LT - 1f, 1f, 0f // RT + 1f, 1f, 0f // RT }; - private static final float[] s_quadTexCoords00 = { + private static final float[] s_quadTexCoords00 = { 0f, 0f, // LB 1f, 0f, // RB - 0f, 1f, // LT + 0f, 1f, // LT 1f, 1f // RT }; - private static final float[] s_quadTexCoords01 = { + private static final float[] s_quadTexCoords01 = { 0f, 1f, // LB 1f, 1f, // RB - 0f, 0f, // LT + 0f, 0f, // LT 1f, 0f // RT - }; + }; } diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java index 6d5b16def..d86940e04 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -77,7 +77,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun * @param mode TODO * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline} */ - public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, + public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, Class<?> shaderRootClass, String shaderSrcRoot, String shaderBinRoot, String vertexColorFile, String vertexColorLightFile, String fragmentColorFile, String fragmentColorTextureFile) { @@ -90,14 +90,14 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun this.pmvMatrix = new PMVMatrix(); } - fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot, + fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot, shaderBinRoot, vertexColorFile, vertexColorLightFile, fragmentColorFile, fragmentColorTextureFile); } public boolean verbose() { return fixedFunction.verbose(); } public void setVerbose(boolean v) { fixedFunction.setVerbose(v); } - + public void destroy() { fixedFunction.destroy(gl); fixedFunction = null; @@ -111,16 +111,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public PMVMatrix getMatrix() { return pmvMatrix; } // - // FixedFuncHookIf - hooks + // FixedFuncHookIf - hooks // public void glDrawArrays(int mode, int first, int count) { fixedFunction.glDrawArrays(gl, mode, first, count); } public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) { - fixedFunction.glDrawElements(gl, mode, count, type, indices); + fixedFunction.glDrawElements(gl, mode, count, type, indices); } public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) { - fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset); + fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset); } public void glActiveTexture(int texture) { @@ -136,7 +136,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun if(fixedFunction.glEnable(cap, false)) { gl.glDisable(cap); } - } + } public void glGetFloatv(int pname, java.nio.FloatBuffer params) { if(PMVMatrix.isMatrixGetName(pname)) { pmvMatrix.glGetFloatv(pname, params); @@ -165,7 +165,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } gl.glGetIntegerv(pname, params, params_offset); } - + public void glTexEnvi(int target, int pname, int value) { fixedFunction.glTexEnvi(target, pname, value); } @@ -179,7 +179,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glBindTexture(target, texture); gl.glBindTexture(target, texture); } - public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, + public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels) { // align internalformat w/ format, an ES2 requirement switch(internalformat) { @@ -212,8 +212,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public void glPointParameterfv(int pname, java.nio.FloatBuffer params) { fixedFunction.glPointParameterfv(pname, params); } - - // + + // // MatrixIf // public int glGetMatrixMode() { @@ -253,29 +253,29 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun pmvMatrix.glScalef(x, y, z); } public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) { - glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); + glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); } public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar); } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { - glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar); + glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar); } public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar); } - // + // // LightingIf // public void glColor4f(float red, float green, float blue, float alpha) { fixedFunction.glColor4f(gl, red, green, blue, alpha); } - + public void glColor4ub(byte red, byte green, byte blue, byte alpha) { - glColor4f(ValueConv.byte_to_float(red, false), - ValueConv.byte_to_float(green, false), - ValueConv.byte_to_float(blue, false), + glColor4f(ValueConv.byte_to_float(red, false), + ValueConv.byte_to_float(green, false), + ValueConv.byte_to_float(blue, false), ValueConv.byte_to_float(alpha, false) ); } public void glLightfv(int light, int pname, java.nio.FloatBuffer params) { @@ -299,17 +299,17 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // public void glShadeModel(int mode) { fixedFunction.glShadeModel(gl, mode); - } + } public void glAlphaFunc(int func, float ref) { fixedFunction.glAlphaFunc(func, ref); } - - /** ES2 supports CullFace implicit + + /** ES2 supports CullFace implicit public void glCullFace(int faceName) { fixedFunction.glCullFace(faceName); gl.glCullFace(faceName); } */ - + // // PointerIf // @@ -340,7 +340,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) { - glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) { @@ -348,7 +348,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } - glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER)); } @@ -368,7 +368,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glColorPointer(gl, array); } public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) { - glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) { @@ -376,7 +376,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } - glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER)); } @@ -399,7 +399,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glNormalPointer(gl, array); } public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) { - glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } public void glNormalPointer(int type, int stride, long pointer_buffer_offset) { @@ -407,7 +407,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } - glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride, + glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride, null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER)); } @@ -428,7 +428,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) { glTexCoordPointer( - GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) { @@ -437,7 +437,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } glTexCoordPointer( - GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, + GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER) ); } diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java index 5349745ea..187fdb309 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java @@ -59,25 +59,25 @@ import com.jogamp.opengl.util.glsl.ShaderState; import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode; /** - * + * * <p> - * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace) - * are mapped to a lower number range so they can be stored in low precision storage, + * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace) + * are mapped to a lower number range so they can be stored in low precision storage, * i.e. in a 'lowp int' (GL ES2). * </p> */ public class FixedFuncPipeline { protected static final boolean DEBUG; - + static { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.FixedFuncPipeline", true); } - + /** The maximum texture units which could be used, depending on {@link ShaderSelectionMode}. */ public static final int MAX_TEXTURE_UNITS = 8; public static final int MAX_LIGHTS = 8; - + public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { shaderRootClass = FixedFuncPipeline.class; shaderSrcRoot = shaderSrcRootDef; @@ -88,8 +88,8 @@ public class FixedFuncPipeline { fragmentColorTextureFile = fragmentColorTextureFileDef; init(gl, mode, pmvMatrix); } - public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, - Class<?> shaderRootClass, String shaderSrcRoot, + public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, + Class<?> shaderRootClass, String shaderSrcRoot, String shaderBinRoot, String vertexColorFile, String vertexColorLightFile, String fragmentColorFile, String fragmentColorTextureFile) { @@ -100,9 +100,9 @@ public class FixedFuncPipeline { this.vertexColorLightFile = vertexColorLightFile; this.fragmentColorFile = fragmentColorFile; this.fragmentColorTextureFile = fragmentColorTextureFile; - init(gl, mode, pmvMatrix); + init(gl, mode, pmvMatrix); } - + public ShaderSelectionMode getShaderSelectionMode() { return requestedShaderSelectionMode; } public void setShaderSelectionMode(ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; } public ShaderSelectionMode getCurrentShaderSelectionMode() { return currentShaderSelectionMode; } @@ -153,21 +153,21 @@ public class FixedFuncPipeline { colorStatic.put(1, green); colorStatic.put(2, blue); colorStatic.put(3, alpha); - + shaderState.useProgram(gl, true); - final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic); + final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic); if(null!=ud) { // same data object .. shaderState.uniform(gl, ud); } else { throw new GLException("Failed to update: mgl_ColorStatic"); - } + } } - + // // Arrays / States // - + public void glEnableClientState(GL2ES2 gl, int glArrayIndex) { glToggleClientState(gl, glArrayIndex, true); } @@ -202,7 +202,7 @@ public class FixedFuncPipeline { break; } } - + public void glVertexPointer(GL2ES2 gl, GLArrayData data) { shaderState.useProgram(gl, true); shaderState.vertexAttribPointer(gl, data); @@ -217,14 +217,14 @@ public class FixedFuncPipeline { shaderState.useProgram(gl, true); shaderState.vertexAttribPointer(gl, data); } - + // // MULTI-TEXTURE // /** Enables/Disables the named texture unit (if changed), returns previous state */ private boolean glEnableTexture(boolean enable, int unit) { - final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) ); + final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) ); if( isEnabled != enable ) { if(enable) { textureEnabledBits |= ( 1 << unit ); @@ -237,7 +237,7 @@ public class FixedFuncPipeline { } return isEnabled; } - + public void glClientActiveTexture(int textureUnit) { textureUnit -= GL.GL_TEXTURE0; if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) { @@ -246,7 +246,7 @@ public class FixedFuncPipeline { throw new GLException("glClientActiveTexture textureUnit not within GL_TEXTURE0 + [0.."+MAX_TEXTURE_UNITS+"]: "+textureUnit); } } - + public void glActiveTexture(int textureUnit) { textureUnit -= GL.GL_TEXTURE0; if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) { @@ -264,7 +264,7 @@ public class FixedFuncPipeline { data.setName( GLPointerFuncUtil.getPredefinedArrayIndexName(data.getIndex(), clientActiveTextureUnit) ) ; shaderState.vertexAttribPointer(gl, data); } - + public void glBindTexture(int target, int texture) { if(GL.GL_TEXTURE_2D == target) { if( texture != boundTextureObject[activeTextureUnit] ) { @@ -272,15 +272,15 @@ public class FixedFuncPipeline { textureFormatDirty = true; } } else { - System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture)); + System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture)); } } - + public void glTexImage2D(int target, /* int level, */ int internalformat, /*, int width, int height, int border, */ int format /*, int type, Buffer pixels */) { final int ifmt; if(GL.GL_TEXTURE_2D == target) { - switch(internalformat) { + switch(internalformat) { case 3: case GL.GL_RGB: case GL.GL_RGB565: @@ -306,16 +306,16 @@ public class FixedFuncPipeline { // System.err.println("glTexImage2D TEXTURE_2D: internalformat ifmt "+toHexString(internalformat)+" fmt "+toHexString(format)+" -> "+toHexString(ifmt)); } } else { - System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat)); + System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat)); } } /* public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, - int format, int type, long pixels_buffer_offset) { + int format, int type, long pixels_buffer_offset) { textureFormat.put(activeTextureUnit, internalformat); textureFormatDirty = true; }*/ - + public void glTexEnvi(int target, int pname, int value) { if(GL2ES1.GL_TEXTURE_ENV == target && GL2ES1.GL_TEXTURE_ENV_MODE == pname) { final int mode; @@ -351,7 +351,7 @@ public class FixedFuncPipeline { if( value != textureEnvMode.get(activeTextureUnit) ) { textureEnvMode.put(activeTextureUnit, value); textureEnvModeDirty = true; - } + } } public void glGetTexEnviv(int target, int pname, IntBuffer params) { // FIXME System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname)); @@ -359,13 +359,13 @@ public class FixedFuncPipeline { public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { // FIXME System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname)); } - + // // Point Sprites // public void glPointSize(float size) { pointParams.put(0, size); - pointParamsDirty = true; + pointParamsDirty = true; } public void glPointParameterf(int pname, float param) { switch(pname) { @@ -379,7 +379,7 @@ public class FixedFuncPipeline { pointParams.put(4+3, param); break; } - pointParamsDirty = true; + pointParamsDirty = true; } public void glPointParameterfv(int pname, float[] params, int params_offset) { switch(pname) { @@ -389,7 +389,7 @@ public class FixedFuncPipeline { pointParams.put(4+2, params[params_offset + 2]); break; } - pointParamsDirty = true; + pointParamsDirty = true; } public void glPointParameterfv(int pname, java.nio.FloatBuffer params) { final int o = params.position(); @@ -400,24 +400,24 @@ public class FixedFuncPipeline { pointParams.put(4+2, params.get(o + 2)); break; } - pointParamsDirty = true; + pointParamsDirty = true; } // private int[] pointTexObj = new int[] { 0 }; - + private void glDrawPoints(GL2ES2 gl, GLRunnable2<Object,Object> glDrawAction, Object args) { if(gl.isGL2GL3()) { gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE); } if(gl.isGL2ES1()) { gl.glEnable(GL2ES1.GL_POINT_SPRITE); - } + } loadShaderPoints(gl); shaderState.attachShaderProgram(gl, shaderProgramPoints, true); validate(gl, false); // sync uniforms glDrawAction.run(gl, args); - + if(gl.isGL2ES1()) { gl.glDisable(GL2ES1.GL_POINT_SPRITE); } @@ -432,17 +432,17 @@ public class FixedFuncPipeline { int[] _args = (int[])args; gl.glDrawArrays(GL.GL_POINTS, _args[0], _args[1]); return null; - } - }; + } + }; private final void glDrawPointArrays(GL2ES2 gl, int first, int count) { - glDrawPoints(gl, glDrawArraysAction, new int[] { first, count }); + glDrawPoints(gl, glDrawArraysAction, new int[] { first, count }); } - + // // Lighting - // + // - public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) { + public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) { shaderState.useProgram(gl, true); light -=GLLightingFunc.GL_LIGHT0; if(0 <= light && light < MAX_LIGHTS) { @@ -536,14 +536,14 @@ public class FixedFuncPipeline { ud.setData(params); shaderState.uniform(gl, ud); } else if(verbose) { - + } } // // Misc States // - + public void glShadeModel(GL2ES2 gl, int mode) { shaderState.useProgram(gl, true); GLUniformData ud = shaderState.getUniform(mgl_ShadeModel); @@ -608,7 +608,7 @@ public class FixedFuncPipeline { _func = 8; break; default: - throw new GLException("glAlphaFunc invalid func: "+toHexString(func)); + throw new GLException("glAlphaFunc invalid func: "+toHexString(func)); } if(0 < _func) { if(0>alphaTestFunc) { @@ -623,7 +623,7 @@ public class FixedFuncPipeline { } /** - * @return false if digested in regard to GL2ES2 spec, + * @return false if digested in regard to GL2ES2 spec, * eg this call must not be passed to an underlying ES2 implementation. * true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well. */ @@ -631,16 +631,16 @@ public class FixedFuncPipeline { switch(cap) { case GL.GL_BLEND: case GL.GL_DEPTH_TEST: - case GL.GL_DITHER: + case GL.GL_DITHER: case GL.GL_POLYGON_OFFSET_FILL: case GL.GL_SAMPLE_ALPHA_TO_COVERAGE: case GL.GL_SAMPLE_COVERAGE: case GL.GL_SCISSOR_TEST: case GL.GL_STENCIL_TEST: return true; - + case GL.GL_CULL_FACE: - /** ES2 supports CullFace implicit + /** ES2 supports CullFace implicit final int _cullFace; if(0>cullFace && enable || 0<cullFace && !enable) { _cullFace = cullFace * -1; @@ -652,15 +652,15 @@ public class FixedFuncPipeline { cullFace=_cullFace; } */ return true; - + case GL.GL_TEXTURE_2D: glEnableTexture(enable, activeTextureUnit); return false; - + case GLLightingFunc.GL_LIGHTING: lightingEnabled=enable; return false; - + case GL2ES1.GL_ALPHA_TEST: final int _alphaTestFunc; if(0>alphaTestFunc && enable || 0<alphaTestFunc && !enable) { @@ -673,12 +673,12 @@ public class FixedFuncPipeline { alphaTestFunc=_alphaTestFunc; } return false; - + case GL2ES1.GL_POINT_SMOOTH: pointParams.put(1, enable ? 1.0f : 0.0f); pointParamsDirty = true; return false; - + case GL2ES1.GL_POINT_SPRITE: // gl_PointCoord always enabled return false; @@ -699,7 +699,7 @@ public class FixedFuncPipeline { // // Draw // - + public void glDrawArrays(GL2ES2 gl, int mode, int first, int count) { switch(mode) { case GL2.GL_QUAD_STRIP: @@ -717,34 +717,34 @@ public class FixedFuncPipeline { for (int j = first; j < count - 3; j += 4) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4); } - } else { + } else { gl.glDrawArrays(mode, first, count); } } public void glDrawElements(GL2ES2 gl, int mode, int count, int type, java.nio.Buffer indices) { - validate(gl, true); + validate(gl, true); if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { final int idx0 = indices.position(); - + if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; for (int j = 0; j < count; j++) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4); - } + } } else if( GL.GL_UNSIGNED_SHORT == type ){ final ShortBuffer b = (ShortBuffer) indices; for (int j = 0; j < count; j++) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4); - } + } } else { final IntBuffer b = (IntBuffer) indices; for (int j = 0; j < count; j++) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); - } + } } } else { // FIXME: Impl. VBO usage .. or unroll (see above)! - if( !gl.getContext().isCPUDataSourcingAvail() ) { + if( !gl.getContext().isCPUDataSourcingAvail() ) { throw new GLException("CPU data sourcing n/a w/ "+gl.getContext()); } if( GL2ES1.GL_POINTS != mode ) { @@ -756,17 +756,17 @@ public class FixedFuncPipeline { } } public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) { - validate(gl, true); + validate(gl, true); if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access"); - } else if( GL2ES1.GL_POINTS != mode ) { + } else if( GL2ES1.GL_POINTS != mode ) { // FIXME GL_POINTS ! gl.glDrawElements(mode, count, type, indices_buffer_offset); } else { gl.glDrawElements(mode, count, type, indices_buffer_offset); } } - + private final int textureEnabledCount() { int n=0; for(int i=MAX_TEXTURE_UNITS-1; i>=0; i--) { @@ -776,12 +776,12 @@ public class FixedFuncPipeline { } return n; } - + public void validate(GL2ES2 gl, boolean selectShader) { if( selectShader ) { if( ShaderSelectionMode.AUTO == requestedShaderSelectionMode) { final ShaderSelectionMode newMode; - + // pre-validate shader switch if( 0 != textureEnabledBits ) { if(lightingEnabled) { @@ -808,9 +808,9 @@ public class FixedFuncPipeline { shaderState.useProgram(gl, true); } } - + GLUniformData ud; - if( pmvMatrix.update() ) { + if( pmvMatrix.update() ) { ud = shaderState.getUniform(mgl_PMVMatrix); if(null!=ud) { final FloatBuffer m; @@ -818,7 +818,7 @@ public class FixedFuncPipeline { ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX== currentShaderSelectionMode ) { m = pmvMatrix.glGetPMvMvitMatrixf(); } else { - m = pmvMatrix.glGetPMvMatrixf(); + m = pmvMatrix.glGetPMvMatrixf(); } if(m != ud.getBuffer()) { ud.setData(m); @@ -829,7 +829,7 @@ public class FixedFuncPipeline { throw new GLException("Failed to update: mgl_PMVMatrix"); } } - if(colorVAEnabledDirty) { + if(colorVAEnabledDirty) { ud = shaderState.getUniform(mgl_ColorEnabled); if(null!=ud) { int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ; @@ -838,7 +838,7 @@ public class FixedFuncPipeline { shaderState.uniform(gl, ud); } } else { - throw new GLException("Failed to update: mgl_ColorEnabled"); + throw new GLException("Failed to update: mgl_ColorEnabled"); } colorVAEnabledDirty = false; } @@ -868,16 +868,16 @@ public class FixedFuncPipeline { if(pointParamsDirty) { ud = shaderState.getUniform(mgl_PointParams); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); } pointParamsDirty = false; } - + if(lightsEnabledDirty) { ud = shaderState.getUniform(mgl_LightsEnabled); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); } lightsEnabledDirty=false; @@ -886,41 +886,41 @@ public class FixedFuncPipeline { if(textureCoordEnabledDirty) { ud = shaderState.getUniform(mgl_TexCoordEnabled); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); } textureCoordEnabledDirty=false; - } + } if(textureEnvModeDirty) { ud = shaderState.getUniform(mgl_TexEnvMode); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); } textureEnvModeDirty = false; } - + if(textureFormatDirty) { for(int i = 0; i<MAX_TEXTURE_UNITS; i++) { textureFormat.put(i, texID2Format.get(boundTextureObject[i])); } ud = shaderState.getUniform(mgl_TexFormat); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); - } + } textureFormatDirty = false; - } + } if(textureEnabledDirty) { ud = shaderState.getUniform(mgl_TextureEnabled); if(null!=ud) { - // same data object + // same data object shaderState.uniform(gl, ud); } textureEnabledDirty=false; } - + if(verbose) { System.err.println("validate: "+toString(null, DEBUG).toString()); } @@ -944,7 +944,7 @@ public class FixedFuncPipeline { sb.append("\n\t, ShaderState: "); shaderState.toString(sb, alsoUnlocated); sb.append("]"); - return sb; + return sb; } public String toString() { return toString(null, DEBUG).toString(); @@ -954,19 +954,19 @@ public class FixedFuncPipeline { private static final String constMaxTextures2 = "#define MAX_TEXTURE_UNITS 2\n"; private static final String constMaxTextures4 = "#define MAX_TEXTURE_UNITS 4\n"; private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n"; - + private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) { int rsVpPos = vp.defaultShaderCustomization(gl, true, true); - int rsFpPos = fp.defaultShaderCustomization(gl, true, true); + int rsFpPos = fp.defaultShaderCustomization(gl, true, true); vp.insertShaderSource(0, rsVpPos, maxTextureDefine); - fp.insertShaderSource(0, rsFpPos, maxTextureDefine); + fp.insertShaderSource(0, rsFpPos, maxTextureDefine); } private final void loadShaderPoints(GL2ES2 gl) { if( null != shaderProgramPoints ) { return; } - + final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, shaderPointFileDef, true); final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot, @@ -977,18 +977,18 @@ public class FixedFuncPipeline { shaderProgramPoints.add(fp); if(!shaderProgramPoints.link(gl, System.err)) { throw new GLException("Couldn't link VertexColor program: "+shaderProgramPoints); - } + } } - + private final void loadShader(GL2ES2 gl, ShaderSelectionMode mode) { final boolean loadColor = ShaderSelectionMode.COLOR == mode; final boolean loadColorTexture2 = ShaderSelectionMode.COLOR_TEXTURE2 == mode; final boolean loadColorTexture4 = ShaderSelectionMode.COLOR_TEXTURE4 == mode; final boolean loadColorTexture8 = ShaderSelectionMode.COLOR_TEXTURE8 == mode; - final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ; + final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ; final boolean loadColorLightPerVertex = ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX == mode; final boolean loadColorTexture8LightPerVertex = ShaderSelectionMode.COLOR_TEXTURE8_LIGHT_PER_VERTEX == mode; - + if( null != shaderProgramColor && loadColor || null != shaderProgramColorTexture2 && loadColorTexture2 || null != shaderProgramColorTexture4 && loadColorTexture4 || @@ -997,7 +997,7 @@ public class FixedFuncPipeline { null != shaderProgramColorTexture8Light && loadColorTexture8LightPerVertex ) { return; } - + if( loadColor ) { final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, vertexColorFile, true); @@ -1014,7 +1014,7 @@ public class FixedFuncPipeline { final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, vertexColorFile, true); final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, fragmentColorTextureFile, true); - + if( loadColorTexture2 ) { customizeShader(gl, vp, fp, constMaxTextures2); shaderProgramColorTexture2 = new ShaderProgram(); @@ -1066,7 +1066,7 @@ public class FixedFuncPipeline { } } } - + private ShaderProgram selectShaderProgram(GL2ES2 gl, ShaderSelectionMode newMode) { if(ShaderSelectionMode.AUTO == newMode) { newMode = ShaderSelectionMode.COLOR; @@ -1096,13 +1096,13 @@ public class FixedFuncPipeline { currentShaderSelectionMode = newMode; return sp; } - - private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { + + private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { if(null==pmvMatrix) { throw new GLException("PMVMatrix is null"); } this.pmvMatrix=pmvMatrix; - this.requestedShaderSelectionMode = mode; + this.requestedShaderSelectionMode = mode; this.shaderState=new ShaderState(); this.shaderState.setVerbose(verbose); @@ -1115,11 +1115,11 @@ public class FixedFuncPipeline { shaderState.uniform(gl, new GLUniformData(mgl_ColorEnabled, 0)); shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, colorStatic)); - - texID2Format.setKeyNotFoundValue(0); + + texID2Format.setKeyNotFoundValue(0); shaderState.uniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordEnabled)); shaderState.uniform(gl, new GLUniformData(mgl_TexEnvMode, 1, textureEnvMode)); - shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat)); + shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat)); shaderState.uniform(gl, new GLUniformData(mgl_TextureEnabled, 1, textureEnabled)); for(int i=0; i<MAX_TEXTURE_UNITS; i++) { shaderState.uniform(gl, new GLUniformData(mgl_Texture+i, i)); @@ -1128,7 +1128,7 @@ public class FixedFuncPipeline { /** ES2 supports CullFace implicit shaderState.uniform(gl, new GLUniformData(mgl_CullFace, cullFace)); */ shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestFunc, alphaTestFunc)); - shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef)); + shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef)); shaderState.uniform(gl, new GLUniformData(mgl_PointParams, 4, pointParams)); for(int i=0; i<MAX_LIGHTS; i++) { shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].ambient", 4, defAmbient)); @@ -1141,7 +1141,7 @@ public class FixedFuncPipeline { shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].constantAttenuation", defConstantAtten)); shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].linearAttenuation", defLinearAtten)); shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].quadraticAttenuation", defQuadraticAtten)); - } + } shaderState.uniform(gl, new GLUniformData(mgl_LightModel+".ambient", 4, defLightModelAmbient)); shaderState.uniform(gl, new GLUniformData(mgl_LightsEnabled, 1, lightsEnabled)); shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".ambient", 4, defMatAmbient)); @@ -1159,11 +1159,11 @@ public class FixedFuncPipeline { private String toHexString(int i) { return "0x"+Integer.toHexString(i); } - + protected boolean verbose = DEBUG; private final FloatBuffer colorStatic = Buffers.copyFloatBuffer(one4f); - + private int activeTextureUnit=0; private int clientActiveTextureUnit=0; private final IntIntHashMap texID2Format = new IntIntHashMap(); @@ -1172,9 +1172,9 @@ public class FixedFuncPipeline { private final IntBuffer textureEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit private boolean textureEnabledDirty = false; private final IntBuffer textureCoordEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit - private boolean textureCoordEnabledDirty = false; + private boolean textureCoordEnabledDirty = false; // textureEnvMode: 1 GL_ADD, 2 GL_MODULATE (default), 3 GL_DECAL, 4 GL_BLEND, 5 GL_REPLACE, 6 GL_COMBINE - private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 }); + private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 }); private boolean textureEnvModeDirty = false; private final IntBuffer textureFormat = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit private boolean textureFormatDirty = false; @@ -1192,11 +1192,11 @@ public class FixedFuncPipeline { private boolean alphaTestDirty=false; private int alphaTestFunc=-8; // <=0 disabled; 1 GL_NEVER, 2 GL_LESS, 3 GL_EQUAL, 4 GL_LEQUAL, 5 GL_GREATER, 6 GL_NOTEQUAL, 7 GL_GEQUAL, and 8 GL_ALWAYS (default) private float alphaTestRef=0f; - + private boolean pointParamsDirty = false; /** ( pointSize, pointSmooth, attn. pointMinSize, attn. pointMaxSize ) , ( attenuation coefficients 1f 0f 0f, attenuation fade theshold 1f ) */ - private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }); - + private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f }); + private PMVMatrix pmvMatrix; private ShaderState shaderState; private ShaderProgram shaderProgramColor; @@ -1204,7 +1204,7 @@ public class FixedFuncPipeline { private ShaderProgram shaderProgramColorLight; private ShaderProgram shaderProgramColorTexture8Light; private ShaderProgram shaderProgramPoints; - + private ShaderSelectionMode requestedShaderSelectionMode = ShaderSelectionMode.AUTO; private ShaderSelectionMode currentShaderSelectionMode = requestedShaderSelectionMode; @@ -1219,7 +1219,7 @@ public class FixedFuncPipeline { private static final String mgl_LightsEnabled = "mgl_LightsEnabled"; // int mgl_LightsEnabled[MAX_LIGHTS]; private static final String mgl_AlphaTestFunc = "mgl_AlphaTestFunc"; // 1i (lowp int) - private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f + private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f private static final String mgl_ShadeModel = "mgl_ShadeModel"; // 1i private static final String mgl_PointParams = "mgl_PointParams"; // vec4[2]: { (sz, smooth, attnMinSz, attnMaxSz), (attnCoeff(3), attnFadeTs) } @@ -1231,7 +1231,7 @@ public class FixedFuncPipeline { // private static final FloatBuffer zero4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f }); private static final FloatBuffer neut4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); - private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); + private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); public static final FloatBuffer defAmbient = neut4f; public static final FloatBuffer defDiffuseN = neut4f; @@ -1245,7 +1245,7 @@ public class FixedFuncPipeline { public static final float defQuadraticAtten = 0f; public static final FloatBuffer defLightModelAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f }); - + public static final FloatBuffer defMatAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f }); public static final FloatBuffer defMatDiffuse = Buffers.newDirectFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f }); public static final FloatBuffer defMatSpecular = neut4f; @@ -1259,13 +1259,13 @@ public class FixedFuncPipeline { private static final String shaderPointFileDef = "FixedFuncPoints"; private static final String shaderSrcRootDef = "shaders" ; private static final String shaderBinRootDef = "shaders/bin" ; - + private final Class<?> shaderRootClass; - private final String shaderSrcRoot; + private final String shaderSrcRoot; private final String shaderBinRoot; private final String vertexColorFile; private final String vertexColorLightFile; private final String fragmentColorFile; - private final String fragmentColorTextureFile; + private final String fragmentColorTextureFile; } diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java index 833771dd1..1833a1d87 100644 --- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java +++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java @@ -1,16 +1,16 @@ /** * Original JavaScript code from <https://github.com/notmasteryet/jpgjs/blob/master/jpg.js>, * ported to Java for JogAmp Community. - * + * * Enhancements: * * InputStream instead of memory buffer * * User provided memory handler - * * Fixed JPEG Component ID/Index mapping + * * Fixed JPEG Component ID/Index mapping * * Color space conversion (YCCK, CMYK -> RGB) * * More error tolerant - * + * * ***************** - * + * * Copyright 2011 notmasteryet * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,21 +24,21 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * ***************** - * + * * Copyright 2013 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -48,7 +48,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -70,7 +70,7 @@ import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureData.ColorSpace; /** - * + * * <ul> * <li> The JPEG specification can be found in the ITU CCITT Recommendation T.81 * (www.w3.org/Graphics/JPEG/itu-t81.pdf) </li> @@ -89,22 +89,22 @@ public class JPEGDecoder { private static final boolean DEBUG = Debug.debug("JPEGImage"); private static final boolean DEBUG_IN = false; - /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */ + /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */ public static interface ColorSink { /** * @param width * @param height * @param sourceCS the color-space of the decoded JPEG * @param sourceComponents number of components used for the given source color-space - * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception! + * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception! * @throws RuntimeException */ public TextureData.ColorSpace allocate(int width, int height, TextureData.ColorSpace sourceCS, int sourceComponents) throws RuntimeException; public void store2(int x, int y, byte c1, byte c2); public void storeRGB(int x, int y, byte r, byte g, byte b); - public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr); + public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr); } - + public static class JFIF { final VersionNumber version; final int densityUnits; @@ -138,11 +138,11 @@ public class JPEGDecoder { } else { return null; } - } + } public final String toString() { return "JFIF[ver "+version+", density[units "+densityUnits+", "+xDensity+"x"+yDensity+"], thumb "+thumbWidth+"x"+thumbHeight+"]"; - } + } } public static class Adobe { @@ -151,7 +151,7 @@ public class JPEGDecoder { final short flags1; final short colorCode; final ColorSpace colorSpace; - + private Adobe(final byte[] data) { version = data[6]; flags0 = (short) ( (data[7] << 8) | data[8] ) ; @@ -174,7 +174,7 @@ public class JPEGDecoder { } public final String toString() { return "Adobe[ver "+version+", flags["+toHexString(flags0)+", "+toHexString(flags1)+"], colorSpace/Code "+colorSpace+"/"+toHexString(colorCode)+"]"; - } + } } /** TODO */ public static class EXIF { @@ -189,10 +189,10 @@ public class JPEGDecoder { } else { return null; } - } + } public final String toString() { return "EXIF[]"; - } + } } @SuppressWarnings("serial") @@ -210,7 +210,7 @@ public class JPEGDecoder { } public int getMarker() { return marker; } } - + /** Start of Image */ private static final int M_SOI = 0xFFD8; /** End of Image */ @@ -264,8 +264,8 @@ public class JPEGDecoder { private static final int M_APP15 = 0xFFEF; /** Annotation / Comment */ - private static final int M_ANO = 0xFFFE; - + private static final int M_ANO = 0xFFFE; + static final int[] dctZigZag = new int[] { 0, 1, 8, @@ -323,7 +323,7 @@ public class JPEGDecoder { private final void checkBounds(int idx) { if( 0 > idx || idx >= compCount ) { throw new CodecException("Idx out of bounds "+idx+", "+this); - } + } } public final void validateComponents() { for(int i=0; i<compCount; i++) { @@ -378,7 +378,7 @@ public class JPEGDecoder { int blocksPerLine; int blocksPerLineForMcu; /** [blocksPerColumnForMcu][blocksPerLineForMcu][64]; */ - int[][][] blocks; + int[][][] blocks; int pred; BinObj huffmanTableAC; BinObj huffmanTableDC; @@ -400,9 +400,9 @@ public class JPEGDecoder { if( row >= blocksPerColumnForMcu || col >= blocksPerLineForMcu ) { throw new CodecException("Out of bounds given ["+row+"]["+col+"] - "+this); } - return blocks[row][col]; + return blocks[row][col]; } - + public final String toString() { return "CompIn[h "+h+", v "+v+", qttIdx "+qttIdx+", blocks["+blocksPerColumn+", mcu "+blocksPerColumnForMcu+"]["+blocksPerLine+", mcu "+blocksPerLineForMcu+"][64]]"; } @@ -410,7 +410,7 @@ public class JPEGDecoder { /** The decoded components */ class ComponentOut { - private final ArrayList<byte[]> lines; + private final ArrayList<byte[]> lines; final float scaleX; final float scaleY; @@ -419,13 +419,13 @@ public class JPEGDecoder { this.scaleX = scaleX; this.scaleY = scaleY; } - + /** Safely returning a line, if index exceeds number of lines, last line is returned. */ public final byte[] getLine(int i) { final int sz = lines.size(); return lines.get( i < sz ? i : sz - 1); } - + public final String toString() { return "CompOut[lines "+lines.size()+", scale "+scaleX+"x"+scaleY+"]"; } @@ -442,7 +442,7 @@ public class JPEGDecoder { private BufferedInputStream istream; private int _ipos = 0; private int _iposSave = 0; - + private int width = 0; private int height = 0; private JFIF jfif = null; @@ -457,14 +457,14 @@ public class JPEGDecoder { public final int getHeight() { return height; } private final void resetInput(InputStream is) { - if( is instanceof BufferedInputStream ) { + if( is instanceof BufferedInputStream ) { istream = (BufferedInputStream) is; } else { istream = new BufferedInputStream(is); } _ipos = 0; } - + private final void markStream(int readLimit) { istream.mark(readLimit); _iposSave = _ipos; @@ -480,7 +480,7 @@ public class JPEGDecoder { if( -1 < r ) { if(DEBUG_IN) { System.err.println("u8["+_ipos+"]: "+toHexString(r)); } _ipos++; - } else if(DEBUG_IN) { + } else if(DEBUG_IN) { System.err.println("u8["+_ipos+"]: EOS"); } return r; @@ -519,7 +519,7 @@ public class JPEGDecoder { } if(DEBUG_IN) { System.err.println("JPEG.readDataBlock: net-len "+(len-2)+", "+this); dumpData(data, 0, len-2); } return data; - } + } static final void dumpData(byte[] data, int offset, int len) { for(int i=0; i<len; ) { System.err.print(i%8+": "); @@ -527,8 +527,8 @@ public class JPEGDecoder { System.err.println(toHexString(0x000000FF & data[offset+i])+", "); } System.err.println(""); - } - } + } + } public synchronized void clear(InputStream inputStream) { resetInput(inputStream); @@ -536,17 +536,17 @@ public class JPEGDecoder { height = 0; jfif = null; exif = null; - adobe = null; - components = null; + adobe = null; + components = null; } - public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException { + public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException { clear(inputStream); - + final int[][] quantizationTables = new int[0x0F][]; // 4 bits final BinObj[] huffmanTablesAC = new BinObj[0x0F]; // Huffman table spec - 4 bits final BinObj[] huffmanTablesDC = new BinObj[0x0F]; // Huffman table spec - 4 bits // final ArrayList<Frame> frames = new ArrayList<Frame>(); // JAU: max 1-frame - + Frame frame = null; int resetInterval = 0; int fileMarker = readUint16(); @@ -614,7 +614,7 @@ public class JPEGDecoder { quantizationTables[tableIdx] = tableData; if( DEBUG ) { System.err.println("JPEG.parse.QTT["+tableIdx+"]: spec "+quantizationTableSpec+", precision "+precisionID+", data "+count+"/"+quantizationTablesLength); - } + } } if(count!=quantizationTablesLength){ throw new CodecException("ERROR: QTT format error [count!=Length]: "+count+"/"+quantizationTablesLength); @@ -660,7 +660,7 @@ public class JPEGDecoder { } break; - case M_DHT: { + case M_DHT: { int count = 0; final int huffmanLength = readUint16(); count+=2; int i=count, codeLengthTotal = 0; @@ -675,7 +675,7 @@ public class JPEGDecoder { for (int j = 0; j < codeLengthSum; j++) { huffmanValues[j] = (byte)readUint8(); count++; } - codeLengthTotal += codeLengthSum; + codeLengthTotal += codeLengthSum; i += 17 + codeLengthSum; final BinObj[] table = ( huffmanTableSpec >> 4 ) == 0 ? huffmanTablesDC : huffmanTablesAC; table[huffmanTableSpec & 0x0F] = buildHuffmanTable(codeLengths, huffmanValues); @@ -699,7 +699,7 @@ public class JPEGDecoder { final int sosLen = readUint16(); count+=2; final int selectorsCount = readUint8(); count++; ArrayList<ComponentIn> components = new ArrayList<ComponentIn>(); - if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); } + if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); } for (int i = 0; i < selectorsCount; i++) { final int compID = readUint8(); count++; final ComponentIn component = frame.getCompByID(compID); @@ -751,8 +751,8 @@ public class JPEGDecoder { final ComponentIn component = frame.getCompByIndex(i); // System.err.println("JPG.parse.buildComponentData["+i+"]: "+component); // JAU // System.err.println("JPG.parse.buildComponentData["+i+"]: "+frame); // JAU - this.components[i] = new ComponentOut( output.buildComponentData(frame, component), - (float)component.h / (float)frame.maxH, + this.components[i] = new ComponentOut( output.buildComponentData(frame, component), + (float)component.h / (float)frame.maxH, (float)component.v / (float)frame.maxV ); } if(DEBUG) { System.err.println("JPG.parse.X: End of processing input "+this); } @@ -797,7 +797,7 @@ public class JPEGDecoder { final boolean isValue; final BinObj[] tree; final byte b; - + BinObj(byte b) { this.isValue= true; this.b = b; @@ -815,13 +815,13 @@ public class JPEGDecoder { } private BinObj buildHuffmanTable(int[] codeLengths, byte[] values) { - int k = 0; - int length = 16; + int k = 0; + int length = 16; final ArrayList<BinObjIdxed> code = new ArrayList<BinObjIdxed>(); while (length > 0 && 0==codeLengths[length - 1]) { length--; } - code.add(new BinObjIdxed()); + code.add(new BinObjIdxed()); BinObjIdxed p = code.get(0), q; for (int i = 0; i < length; i++) { for (int j = 0; j < codeLengths[i]; j++) { @@ -959,7 +959,7 @@ public class JPEGDecoder { t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; v6 = t; - + // stage 1 p[0 + row] = v0 + v7; p[7 + row] = v0 - v7; @@ -1066,7 +1066,7 @@ public class JPEGDecoder { private int successiveACState, successiveACNextValue; private int decodeScan(Frame frame, ArrayList<ComponentIn> components, int resetInterval, - int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException { + int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException { // this.precision = frame.precision; // this.samplesPerLine = frame.samplesPerLine; // this.scanLines = frame.scanLines; @@ -1079,7 +1079,7 @@ public class JPEGDecoder { this.spectralStart = spectralStart; this.spectralEnd = spectralEnd; this.successive = successive; - + final int componentsLength = components.size(); final DecoderFunction decodeFn; @@ -1096,7 +1096,7 @@ public class JPEGDecoder { int mcu = 0; int mcuExpected; if (componentsLength == 1) { - final ComponentIn c = components.get(0); + final ComponentIn c = components.get(0); mcuExpected = c.blocksPerLine * c.blocksPerColumn; } else { mcuExpected = mcusPerLine * frame.mcusPerColumn; @@ -1153,14 +1153,14 @@ public class JPEGDecoder { if( marker < 0xFF00 ) { rewindStream(); throw new CodecException("marker not found @ mcu "+mcu+"/"+mcuExpected+", u16: "+toHexString(marker)); - } + } final boolean isRSTx = 0xFFD0 <= marker && marker <= 0xFFD7; // !RSTx if(DEBUG) { System.err.println("JPEG.decodeScan: MCUs "+mcu+"/"+mcuExpected+", u16 "+toHexString(marker)+", RSTx "+isRSTx+", "+frame); } if ( !isRSTx ) { break; // handle !RSTx marker in caller - } + } } return marker; } @@ -1306,7 +1306,7 @@ public class JPEGDecoder { successiveACState = 1; } } else { - // if (s !== 1) { + // if (s !== 1) { if (s != 1) { throw new CodecException("invalid ACn encoding"); } @@ -1380,18 +1380,18 @@ public class JPEGDecoder { int R = Y + ( ( 91881 * Cr ) >> 16 ); if(R<0) R=0; else if(R>255) R=255; - + pixelStorage.storeRGB(x, y, (byte)R, (byte)G, (byte)B); } */ - + public synchronized void getPixel(JPEGDecoder.ColorSink pixelStorage, int width, int height) { final int scaleX = this.width / width, scaleY = this.height / height; final int componentCount = this.components.length; - final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr; + final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr; final ColorSpace storageCS = pixelStorage.allocate(width, height, sourceCS, componentCount); if( ColorSpace.RGB != storageCS && ColorSpace.YCbCr != storageCS ) { - throw new IllegalArgumentException("Unsupported storage color space: "+storageCS); + throw new IllegalArgumentException("Unsupported storage color space: "+storageCS); } switch (componentCount) { @@ -1504,7 +1504,7 @@ public class JPEGDecoder { final byte G = clampTo8bit( ( cM * cK ) / 255f ); final byte B = clampTo8bit( ( cY * cK ) / 255f ); pixelStorage.storeRGB(x, y, R, G, B); - } + } } else { // ColorModel.YCCK == sourceCM for (int x = 0; x < width; x++) { final int xs = x * scaleX; @@ -1525,7 +1525,7 @@ public class JPEGDecoder { } } } - } + } break; default: throw new CodecException("Unsupported color model: Space "+sourceCS+", components "+componentCount); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java index 0fffc85b1..5e177b8c3 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java @@ -4,7 +4,7 @@ import java.util.HashMap; /**
* Internal PNG predictor filter, or strategy to select it.
- *
+ *
*/
public enum FilterType {
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java index e62134cd5..ac7b858e1 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java @@ -98,7 +98,7 @@ public class ImageInfo { /**
* Full constructor
- *
+ *
* @param cols
* Width in pixels
* @param rows
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java index e34e6a226..906ce6373 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java @@ -25,7 +25,7 @@ public class ImageLine { * Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each
* <code>int</code> is a "sample" (one for channel), (0-255 or 0-65535) in
* the corresponding PNG sequence: <code>R G B R G B...</code> or
- * <code>R G B A R G B A...</tt>
+ * <code>R G B A R G B A...</tt>
* or <code>g g g ...</code> or <code>i i i</code> (palette index)
* <p>
* For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED
@@ -60,7 +60,7 @@ public class ImageLine { /**
* true: each element of the scanline array represents a sample always, even
* for internally packed PNG formats
- *
+ *
* false: if the original image was of packed type (bit depth less than 8)
* we keep samples packed in a single array element
*/
@@ -74,7 +74,7 @@ public class ImageLine { }
/**
- *
+ *
* @param imgInfo
* Inmutable ImageInfo, basic parameter of the image we are
* reading or writing
@@ -84,7 +84,7 @@ public class ImageLine { * @param unpackedMode
* If true, we use unpacked format, even for packed original
* images
- *
+ *
*/
public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) {
this(imgInfo, stype, unpackedMode, null, null);
@@ -124,13 +124,13 @@ public class ImageLine { /*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRowPacked dst : samplesPerRow
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)!
- *
+ *
* If not, you should only call this only when necesary (bitdepth <8)
- *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void unpackInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scale) {
@@ -165,15 +165,15 @@ public class ImageLine { /*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRow dst : samplesPerRowPacked
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)! If not, you should only call this only when
* necesary (bitdepth <8)
- *
+ *
* The trailing elements are trash
- *
- *
+ *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void packInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scaled) {
@@ -270,7 +270,7 @@ public class ImageLine { /**
* Creates a new ImageLine similar to this, but unpacked
- *
+ *
* The caller must be sure that the original was really packed
*/
public ImageLine unpackToNewImageLine() {
@@ -284,7 +284,7 @@ public class ImageLine { /**
* Creates a new ImageLine similar to this, but packed
- *
+ *
* The caller must be sure that the original was really unpacked
*/
public ImageLine packToNewImageLine() {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java index 91516a704..438a69984 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java @@ -23,7 +23,7 @@ public class ImageLineHelper { /**
* Given an indexed line with a palette, unpacks as a RGB array, or RGBA if
* a non nul PngChunkTRNS chunk is passed
- *
+ *
* @param line
* ImageLine as returned from PngReader
* @param pal
@@ -143,7 +143,7 @@ public class ImageLineHelper { /**
* integer packed R G B only for bitdepth=8! (does not check!)
- *
+ *
**/
public static int getPixelRGB8(ImageLine line, int column) {
int offset = column * line.channels;
@@ -252,7 +252,7 @@ public class ImageLineHelper { * <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
* <p>
* You probably should use {@link ImageLine#unpackToNewImageLine()}
- *
+ *
*/
public static int[] unpack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
int len1 = imgInfo.samplesPerRow;
@@ -282,7 +282,7 @@ public class ImageLineHelper { * Packs scanline (for bitdepth 1-2-4) from array into the scanline
* <p>
* If <code>scale==true<code>, it scales the value (just a bit shift).
- *
+ *
* You probably should use {@link ImageLine#packToNewImageLine()}
*/
public static int[] pack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java index feb50e7b6..fb2cf5910 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java @@ -5,7 +5,7 @@ import jogamp.opengl.util.pngj.ImageLine.SampleType; /** * Wraps in a matrix a set of image rows, not necessarily contiguous - but * equispaced. - * + * * The fields mirrors those of {@link ImageLine}, and you can access each row as * a ImageLine backed by the matrix row, see * {@link #getImageLineAtMatrixRow(int)} @@ -28,7 +28,7 @@ public class ImageLines { * Allocates a matrix to store {@code nRows} image rows. See * {@link ImageLine} and {@link PngReader#readRowsInt()} * {@link PngReader#readRowsByte()} - * + * * @param imgInfo * @param stype * @param unpackedMode @@ -77,7 +77,7 @@ public class ImageLines { /** * Converts from matrix row number (0 : nRows-1) to image row number - * + * * @param mrow * Matrix row number * @return Image row number. Invalid only if mrow is invalid @@ -88,7 +88,7 @@ public class ImageLines { /** * Returns a ImageLine is backed by the matrix, no allocation done - * + * * @param mrow * Matrix row, from 0 to nRows This is not necessarily the image * row, see {@link #imageRowToMatrixRow(int)} and diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java index a950c6b33..1f598a5de 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java @@ -49,7 +49,7 @@ public class PngHelperInternal { /**
* -1 if eof
- *
+ *
* PNG uses "network byte order"
*/
public static int readInt2(InputStream is) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java index e42dd8733..73442e0bb 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java @@ -92,13 +92,13 @@ public class PngReader { * Constructs a PngReader from an InputStream. * <p> * See also <code>FileHelper.createPngReader(File f)</code> if available. - * + * * Reads only the signature and first chunk (IDHR) - * + * * @param filenameOrDescription * : Optional, can be a filename or a description. Just for * error/debug messages - * + * */ public PngReader(InputStream inputStream, String filenameOrDescription) { this.filename = filenameOrDescription == null ? "" : filenameOrDescription; @@ -411,7 +411,7 @@ public class PngReader { /** * Determines which ancillary chunks (metada) are to be loaded - * + * * @param chunkLoadBehaviour * {@link ChunkLoadBehaviour} */ @@ -427,7 +427,7 @@ public class PngReader { * replaced by a single dummy-marker IDAT chunk. These might be copied to * the PngWriter * <p> - * + * * @see #getMetadata() */ public ChunksList getChunksList() { @@ -442,7 +442,7 @@ public class PngReader { /** * High level wrapper over chunksList - * + * * @see #getChunksList() */ public PngMetadata getMetadata() { @@ -456,7 +456,7 @@ public class PngReader { * appropiate readRowInt/readRowByte * <p> * In general, specifying the concrete readRowInt/readRowByte is preferrable - * + * * @see #readRowInt(int) {@link #readRowByte(int)} */ public ImageLine readRow(int nrow) { @@ -468,9 +468,9 @@ public class PngReader { /** * Reads the row as INT, storing it in the {@link #imgLine} property and * returning it. - * + * * The row must be greater or equal than the last read row. - * + * * @param nrow * Row number, from 0 to rows-1. Increasing order. * @return ImageLine object, also available as field. Data is in @@ -490,10 +490,10 @@ public class PngReader { /** * Reads the row as BYTES, storing it in the {@link #imgLine} property and * returning it. - * + * * The row must be greater or equal than the last read row. This method * allows to pass the same row that was last read. - * + * * @param nrow * Row number, from 0 to rows-1. Increasing order. * @return ImageLine object, also available as field. Data is in @@ -524,13 +524,13 @@ public class PngReader { * <p> * If the bitdepth is less than 8, the bytes are packed - unless * {@link #unpackedMode} is true. - * + * * @param buffer * Prealocated buffer, or null. * @param nrow * Row number (0 is top). Most be strictly greater than the last * read row. - * + * * @return The scanline in the same passwd buffer if it was allocated, a * newly allocated one otherwise */ @@ -562,13 +562,13 @@ public class PngReader { * {@link #unpackedMode} is true. <br> * If the bitdepth is 16, the least significant byte is lost. * <p> - * + * * @param buffer * Prealocated buffer, or null. * @param nrow * Row number (0 is top). Most be strictly greater than the last * read row. - * + * * @return The scanline in the same passwd buffer if it was allocated, a * newly allocated one otherwise */ @@ -632,9 +632,9 @@ public class PngReader { * <p> * Notice that the columns in the matrix is not the pixel width of the * image, but rather pixels x channels - * + * * @see #readRowInt(int) to read about the format of each row - * + * * @param rowOffset * Number of rows to be skipped * @param nRows @@ -678,7 +678,7 @@ public class PngReader { /** * Same as readRowsInt(0, imgInfo.rows, 1) - * + * * @see #readRowsInt(int, int, int) */ public ImageLines readRowsInt() { @@ -696,10 +696,10 @@ public class PngReader { * <p> * Notice that the columns in the matrix is not the pixel width of the * image, but rather pixels x channels - * + * * @see #readRowByte(int) to read about the format of each row. Notice that * if the bitdepth is 16 this will lose information - * + * * @param rowOffset * Number of rows to be skipped * @param nRows @@ -743,7 +743,7 @@ public class PngReader { /** * Same as readRowsByte(0, imgInfo.rows, 1) - * + * * @see #readRowsByte(int, int, int) */ public ImageLines readRowsByte() { @@ -752,13 +752,13 @@ public class PngReader { /* * For the interlaced case, nrow indicates the subsampled image - the pass must be set already. - * + * * This must be called in strict order, both for interlaced or no interlaced. - * + * * Updates rowNum. - * + * * Leaves raw result in rowb - * + * * Returns bytes actually read (not including the filter byte) */ private int readRowRaw(final int nrow) { @@ -933,7 +933,7 @@ public class PngReader { * scanline will be sample. This implies more processing and memory, but * it's the most efficient option if you intend to read individual pixels. <br> * This option should only be set before start reading. - * + * * @param unPackedMode */ public void setUnpackedMode(boolean unPackedMode) { @@ -951,7 +951,7 @@ public class PngReader { * Tries to reuse the allocated buffers from other already used PngReader * object. This will have no effect if the buffers are smaller than necessary. * It also reuses the inflater. - * + * * @param other A PngReader that has already finished reading pixels. Can be null. */ public void reuseBuffersFrom(PngReader other) { @@ -977,7 +977,7 @@ public class PngReader { /** * Just for testing. TO be called after ending reading, only if * initCrctest() was called before start - * + * * @return CRC of the raw pixels values */ long getCrctestVal() { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java index 3e684a881..2f475aab1 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java @@ -88,7 +88,7 @@ public class PngWriter { * filters) and queue chunks before start writing the pixels.
* <p>
* See also <code>FileHelper.createPngWriter()</code> if available.
- *
+ *
* @param outputStream
* Opened stream for binary writing
* @param imgInfo
@@ -422,7 +422,7 @@ public class PngWriter { * Should be called when creating an image from another, before starting
* writing lines, to copy relevant chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened.
* @param copy_mask
@@ -439,7 +439,7 @@ public class PngWriter { * Should be called when creating an image from another, after writing all
* lines, before closing the writer, to copy additional chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened and fully read.
* @param copy_mask
@@ -455,7 +455,7 @@ public class PngWriter { * <p>
* Actually: compressed size = total size of IDAT data , raw size =
* uncompressed pixel bytes = rows * (bytesPerRow + 1).
- *
+ *
* This must be called after pngw.end()
*/
public double computeCompressionRatio() {
@@ -512,7 +512,7 @@ public class PngWriter { * This must be called just after constructor, before starting writing.
* <p>
* See also setFilterType()
- *
+ *
* @param compLevel
* between 0 and 9 (default:6 , recommended: 6 or more)
*/
@@ -528,7 +528,7 @@ public class PngWriter { * This must be called just after constructor, before starting writing.
* <p>
* See also setCompLevel()
- *
+ *
* @param filterType
* One of the five prediction types or strategy to choose it (see
* <code>PngFilterType</code>) Recommended values: DEFAULT
@@ -542,7 +542,7 @@ public class PngWriter { * Sets maximum size of IDAT fragments. This has little effect on
* performance you should rarely call this
* <p>
- *
+ *
* @param idatMaxSize
* default=0 : use defaultSize (32K)
*/
@@ -572,7 +572,7 @@ public class PngWriter { /**
* Writes line, checks that the row number is consistent with that of the
* ImageLine See writeRow(int[] newrow, int rown)
- *
+ *
* @deprecated Better use writeRow(ImageLine imgline, int rownumber)
*/
public void writeRow(ImageLine imgline) {
@@ -581,9 +581,9 @@ public class PngWriter { /**
* Writes line. See writeRow(int[] newrow, int rown)
- *
+ *
* The <tt>packed</tt> flag of the imageline is honoured!
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(ImageLine imgline, int rownumber) {
@@ -596,7 +596,7 @@ public class PngWriter { /**
* Same as writeRow(int[] newrow, int rown), but does not check row number
- *
+ *
* @param newrow
*/
public void writeRow(int[] newrow) {
@@ -605,7 +605,7 @@ public class PngWriter { /**
* Alias to writeRowInt
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(int[] newrow, int rown) {
@@ -624,7 +624,7 @@ public class PngWriter { * Warning: the array might be modified in some cases (unpacked row with low
* bitdepth)
* <p>
- *
+ *
* @param newrow
* Array of pixel values. Warning: the array size should be exact
* (samplesPerRowP)
@@ -642,7 +642,7 @@ public class PngWriter { * Same semantics as writeRowInt but using bytes. Each byte is still a
* sample. If 16bitdepth, we are passing only the most significant byte (and
* hence losing some info)
- *
+ *
* @see PngWriter#writeRowInt(int[], int)
*/
public void writeRowByte(byte[] newrow, int rown) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java index 4a45cb5bf..97e24fc73 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java @@ -2,9 +2,9 @@ package jogamp.opengl.util.pngj; /**
* Generic exception
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjException extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java index c429b893b..5da70de7b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java @@ -3,9 +3,9 @@ package jogamp.opengl.util.pngj; /**
* Exception for anomalous internal problems (sort of asserts) that point to
* some issue with the library
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjExceptionInternal extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java index a995e4481..82abb902d 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java @@ -59,7 +59,7 @@ public class ChunkHelper { }; /* - * static auxiliary buffer. any method that uses this should synchronize against this + * static auxiliary buffer. any method that uses this should synchronize against this */ private static byte[] tmpbuffer = new byte[4096]; @@ -136,7 +136,7 @@ public class ChunkHelper { /** * Finds position of null byte in array - * + * * @param b * @return -1 if not found */ @@ -149,7 +149,7 @@ public class ChunkHelper { /** * Decides if a chunk should be loaded, according to a ChunkLoadBehaviour - * + * * @param id * @param behav * @return true/false @@ -208,7 +208,7 @@ public class ChunkHelper { /** * Returns only the chunks that "match" the predicate - * + * * See also trimList() */ public static List<PngChunk> filterList(List<PngChunk> target, ChunkPredicate predicateKeep) { @@ -223,7 +223,7 @@ public class ChunkHelper { /** * Remove (in place) the chunks that "match" the predicate - * + * * See also filterList */ public static int trimList(List<PngChunk> target, ChunkPredicate predicateRemove) { @@ -244,10 +244,10 @@ public class ChunkHelper { * they have same id and (perhaps, if multiple are allowed) if the match * also in some "internal key" (eg: key for string values, palette for sPLT, * etc) - * + * * Notice that the use of this is optional, and that the PNG standard allows * Text chunks that have same key - * + * * @return true if "equivalent" */ public static final boolean equivalent(PngChunk c1, PngChunk c2) { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java index 82ab3bcf9..1fa00380a 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java @@ -15,7 +15,7 @@ public enum ChunkLoadBehaviour { */
LOAD_CHUNK_KNOWN,
/**
- *
+ *
* Load chunk if "known" or "safe to copy".
*/
LOAD_CHUNK_IF_SAFE,
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java index a750ae34f..4695ccf44 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java @@ -6,7 +6,7 @@ package jogamp.opengl.util.pngj.chunks; public interface ChunkPredicate { /** * The other chunk matches with this one - * + * * @param chunk * @return true if match */ diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java index 5ce94ff9f..3e0d03051 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java @@ -24,7 +24,7 @@ public class ChunksList { /**
* All chunks, read (or written)
- *
+ *
* But IDAT is a single pseudo chunk without data
*/
protected List<PngChunk> chunks = new ArrayList<PngChunk>();
@@ -37,7 +37,7 @@ public class ChunksList { /**
* Keys of processed (read or writen) chunks
- *
+ *
* @return key:chunk id, val: number of occurrences
*/
public HashMap<String, Integer> getChunksKeys() {
@@ -87,7 +87,7 @@ public class ChunksList { /**
* All chunks with this ID
- *
+ *
* @param id
* @return List, empty if none
*/
@@ -98,7 +98,7 @@ public class ChunksList { /**
* If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's
* filtered by that id
- *
+ *
* @param id
* @return innerid Only used for text and SPLT chunks
* @return List, empty if none
@@ -109,7 +109,7 @@ public class ChunksList { /**
* Returns only one chunk
- *
+ *
* @param id
* @return First chunk found, null if not found
*/
@@ -146,7 +146,7 @@ public class ChunksList { /**
* Finds all chunks "equivalent" to this one
- *
+ *
* @param c2
* @return Empty if nothing found
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java index e76456ad4..3b84ab800 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java @@ -67,7 +67,7 @@ public class ChunksListForWrite extends ChunksList { /** * Remove Chunk: only from queued - * + * * WARNING: this depends on c.equals() implementation, which is * straightforward for SingleChunks. For MultipleChunks, it will normally * check for reference equality! @@ -78,9 +78,9 @@ public class ChunksListForWrite extends ChunksList { /** * Adds chunk to queue - * + * * Does not check for duplicated or anything - * + * * @param c */ public boolean queue(PngChunk c) { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java index a45979ec2..6cd86eb98 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java @@ -248,7 +248,7 @@ public abstract class PngChunk { /**
* Creates the physical chunk. This is used when writing (serialization).
* Each particular chunk class implements its own logic.
- *
+ *
* @return A newly allocated and filled raw chunk
*/
public abstract ChunkRaw createRawChunk();
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java index 4a8502a3d..ea6235432 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java @@ -70,7 +70,7 @@ public class PngChunkBKGD extends PngChunkSingle { /**
* Set gray value (0-255 if bitdept=8)
- *
+ *
* @param gray
*/
public void setGray(int gray) {
@@ -87,7 +87,7 @@ public class PngChunkBKGD extends PngChunkSingle { /**
* Set pallette index
- *
+ *
*/
public void setPaletteIndex(int i) {
if (!imgInfo.indexed)
@@ -103,7 +103,7 @@ public class PngChunkBKGD extends PngChunkSingle { /**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java index d44250a2f..057f6c25e 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java @@ -19,9 +19,9 @@ public abstract class PngChunkMultiple extends PngChunk { /**
* NOTE: this chunk uses the default Object's equals() hashCode()
* implementation.
- *
+ *
* This is the right thing to do, normally.
- *
+ *
* This is important, eg see ChunkList.removeFromList()
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java index bc70c6e5e..3a490654a 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java @@ -106,7 +106,7 @@ public class PngChunkSBIT extends PngChunkSingle { /**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java index b68776477..867e34861 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java @@ -82,7 +82,7 @@ public class PngChunkTRNS extends PngChunkSingle { /** * Set rgb values - * + * */ public void setRGB(int r, int g, int b) { if (imgInfo.greyscale || imgInfo.indexed) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java index ecf8b98c3..fa3649613 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java @@ -87,7 +87,7 @@ public class PngMetadata { /** * Creates a time chunk with current time, less secsAgo seconds * <p> - * + * * @return Returns the created-queued chunk, just in case you want to * examine or modify it */ @@ -105,7 +105,7 @@ public class PngMetadata { /** * Creates a time chunk with diven date-time * <p> - * + * * @return Returns the created-queued chunk, just in case you want to * examine or modify it */ @@ -133,7 +133,7 @@ public class PngMetadata { /** * Creates a text chunk and queue it. * <p> - * + * * @param k * : key (latin1) * @param val @@ -201,7 +201,7 @@ public class PngMetadata { /** * Returns the palette chunk, if present - * + * * @return null if not present */ public PngChunkPLTE getPLTE() { @@ -220,7 +220,7 @@ public class PngMetadata { /** * Returns the TRNS chunk, if present - * + * * @return null if not present */ public PngChunkTRNS getTRNS() { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index bf2d3fa47..7a4e08d26 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -58,7 +58,7 @@ public class WGLGLCapabilities extends GLCapabilities { setRedBits(pfd.getCRedBits()); setGreenBits(pfd.getCGreenBits()); setBlueBits(pfd.getCBlueBits()); - setAlphaBits(pfd.getCAlphaBits()); + setAlphaBits(pfd.getCAlphaBits()); setAccumRedBits(pfd.getCAccumRedBits()); setAccumGreenBits(pfd.getCAccumGreenBits()); setAccumBlueBits(pfd.getCAccumBlueBits()); @@ -77,12 +77,12 @@ public class WGLGLCapabilities extends GLCapabilities { return true; } - + public static final String PFD2String(PIXELFORMATDESCRIPTOR pfd, int pfdID) { final int dwFlags = pfd.getDwFlags(); StringBuilder sb = new StringBuilder(); boolean sep = false; - + if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) { sep = true; sb.append("window"); @@ -106,7 +106,7 @@ public class WGLGLCapabilities extends GLCapabilities { if( 0 == (GDI.PFD_GENERIC_FORMAT & dwFlags ) || 0 == (GDI.PFD_GENERIC_ACCELERATED & dwFlags ) ) { if(sep) { sb.append(CSEP); } sep=true; sb.append("hw-accel"); - } + } return "PFD[id = "+pfdID+" (0x"+Integer.toHexString(pfdID)+ "), colorBits "+pfd.getCColorBits()+", rgba "+pfd.getCRedBits()+ESEP+pfd.getCGreenBits()+ESEP+pfd.getCBlueBits()+ESEP+pfd.getCAlphaBits()+ ", accum-rgba "+pfd.getCAccumRedBits()+ESEP+pfd.getCAccumGreenBits()+ESEP+pfd.getCAccumBlueBits()+ESEP+pfd.getCAccumAlphaBits()+ diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java index 3e788d286..6454a34b5 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java @@ -33,15 +33,15 @@ import jogamp.opengl.Debug; public class WGLUtil { /** - * Switch to use the <code>wgl</code> variants of {@link jogamp.opengl.windows.wgl.WGL} + * Switch to use the <code>wgl</code> variants of {@link jogamp.opengl.windows.wgl.WGL} * to replace the following 5 GDI based functions (see below). * <p> * Disabled per default. - * </p> + * </p> * <p> * You can enable it by defining the property <code>jogl.windows.useWGLVersionOf5WGLGDIFuncSet</code>. * </p> - * + * * @see jogamp.nativewindow.windows.GDI#ChoosePixelFormat(long, PIXELFORMATDESCRIPTOR) * @see jogamp.nativewindow.windows.GDI#DescribePixelFormat(long, int, int, PIXELFORMATDESCRIPTOR) * @see jogamp.nativewindow.windows.GDI#GetPixelFormat(long) @@ -49,7 +49,7 @@ public class WGLUtil { * @see jogamp.nativewindow.windows.GDI#SwapBuffers(long) */ public static final boolean USE_WGLVersion_Of_5WGLGDIFuncSet; - + static { Debug.initSingleton(); USE_WGLVersion_Of_5WGLGDIFuncSet = Debug.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true); @@ -63,34 +63,34 @@ public class WGLUtil { return WGL.wglChoosePixelFormat(hdc, pfd); } else { return GDI.ChoosePixelFormat(hdc, pfd); - } + } } public static int DescribePixelFormat(long hdc, int pfdid, int pfdSize, PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglDescribePixelFormat(hdc, pfdid, pfdSize, pfd); } else { return GDI.DescribePixelFormat(hdc, pfdid, pfdSize, pfd); - } + } } public static int GetPixelFormat(long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglGetPixelFormat(hdc); } else { return GDI.GetPixelFormat(hdc); - } + } } - public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) { + public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSetPixelFormat(hdc, pfdid, pfd); } else { return GDI.SetPixelFormat(hdc, pfdid, pfd); - } + } } - public static boolean SwapBuffers(long hdc) { + public static boolean SwapBuffers(long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSwapBuffers(hdc); } else { return GDI.SwapBuffers(hdc); - } + } } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index 909a017b0..f658a3598 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -63,7 +63,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { private WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface comp) { super(factory, comp, false); } - + protected static WindowsBitmapWGLDrawable create(GLDrawableFactory factory, NativeSurface comp) { final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)comp.getGraphicsConfiguration(); final AbstractGraphicsDevice aDevice = config.getScreen().getDevice(); @@ -102,7 +102,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { public boolean isGLOriented() { return false; } - + private void createBitmap() { int werr; final NativeSurface ns = getNativeSurface(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index a5893775a..966a8b28a 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -56,7 +56,7 @@ import jogamp.nativewindow.windows.GDI; import jogamp.opengl.GLContextShareSet; public class WindowsExternalWGLContext extends WindowsWGLContext { - + private WindowsExternalWGLContext(Drawable drawable, long ctx, WindowsWGLGraphicsConfiguration cfg) { super(drawable, null); this.contextHandle = ctx; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 217ca18e8..2e60c682b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -127,7 +127,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } final int winattrPbuffer = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(false /* onscreen */, false /* fbo */, true /* pbuffer */, false /* bitmap */); - + final IntBuffer iattributes = Buffers.newDirectIntBuffer(2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS); final FloatBuffer fattributes = Buffers.newDirectFloatBuffer(1); int[] floatModeTmp = new int[1]; @@ -162,7 +162,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); for (int i = 0; i < nformats; i++) { - WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pformats.get(i), winattrPbuffer); System.err.println("pixel format " + pformats.get(i) + " (index " + i + "): " + dbgCaps); } @@ -209,7 +209,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // Re-query chosen pixel format { - WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pfdid, winattrPbuffer); if(null == newCaps) { throw new GLException("pbuffer creation error: unable to re-query chosen PFD ID: " + pfdid + ", hdc " + GLDrawableImpl.toHexString(tmpHdc)); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 3fad22d88..d936308af 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -280,7 +280,7 @@ public class WindowsWGLContext extends GLContextImpl { if (DEBUG) { System.err.println(getThreadName() + ": createImpl: START "+glCaps+", share "+shareWith); } - + // Windows can set up sharing of display lists after creation time long share; if ( null != shareWith ) { @@ -405,7 +405,7 @@ public class WindowsWGLContext extends GLContextImpl { protected void makeCurrentImpl() throws GLException { if (WGL.wglGetCurrentContext() != contextHandle) { if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + + throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + ", drawableWrite " + toHexString(drawable.getHandle()) + ", drawableRead "+ toHexString(drawableRead.getHandle()) + @@ -563,13 +563,13 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { return getWGLExt().wglAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } - + @Override public final void glFreeMemoryNV(ByteBuffer pointer) { getWGLExt().wglFreeMemoryNV(pointer); } - + } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index 741e671eb..66071cbe1 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -52,12 +52,12 @@ import jogamp.opengl.GLDynamicLookupHelper; public abstract class WindowsWGLDrawable extends GLDrawableImpl { private static final boolean PROFILING; - + static { Debug.initSingleton(); PROFILING = Debug.isPropertyDefined("jogl.debug.GLDrawable.profiling", true); } - + private static final int PROFILING_TICKS = 200; private int profilingSwapBuffersTicks; private long profilingSwapBuffersTime; @@ -87,11 +87,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } else { t0 = 0; } - + if (!WGLUtil.SwapBuffers(getHandle()) && (GDI.GetLastError() != GDI.ERROR_SUCCESS)) { throw new GLException("Error swapping buffers"); } - + if (PROFILING) { profilingSwapBuffersTime += System.currentTimeMillis() - t0; if (++profilingSwapBuffersTicks == PROFILING_TICKS) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 156e75196..203af110c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -137,8 +137,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { protected final boolean isComplete() { return null != windowsWGLDynamicLookupHelper; } - - + + @Override protected final void destroy() { if(null != sharedResourceRunner) { @@ -216,7 +216,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { private AbstractGraphicsScreen screen; private GLDrawableImpl drawable; private GLContextImpl context; - + SharedResource(WindowsGraphicsDevice dev, AbstractGraphicsScreen scrn, GLDrawableImpl draw, GLContextImpl ctx, boolean arbPixelFormat, boolean arbMultisample, boolean arbPBuffer, boolean arbReadDrawable) { device = dev; @@ -243,7 +243,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final public GLContextImpl getContext() { return context; } @Override public GLRendererQuirks getRendererQuirks() { - return null != context ? context.getRendererQuirks() : null; + return null != context ? context.getRendererQuirks() : null; } final boolean hasARBPixelFormat() { return hasARBPixelFormat; } @@ -276,7 +276,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { public boolean isDeviceSupported(String connection) { return true; } - + @Override public SharedResourceRunner.Resource createSharedResource(String connection) { final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT); @@ -290,7 +290,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final GLCapabilitiesImmutable caps = new GLCapabilities(glp); final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); sharedDrawable.setRealized(true); - + final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null); if (null == sharedContext) { throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); @@ -473,8 +473,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, + protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final WindowsGraphicsDevice device; if(createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice)) { @@ -485,13 +485,13 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen); if(null == config) { - throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); - } + throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); + } return new WrappedSurface(config, 0, upstreamHook, createNewDevice); } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { final WindowsGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice) ) { @@ -502,12 +502,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0); chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(chosenCaps, requestedCaps, chooser, screen); - if(null == config) { + if(null == config) { throw new GLException("Choosing GraphicsConfiguration failed w/ "+chosenCaps+" on "+screen); - } + } return new GDISurface(config, 0, new GDIDummyUpstreamSurfaceHook(width, height), createNewDevice); - } - + } + @Override protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java index 7ec6c50f8..6098cde7f 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.windows.wgl; import jogamp.opengl.*; @@ -41,10 +41,10 @@ public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLi final List<List<String>> libsList = new ArrayList<List<String>>(); final List<String> libsGL = new ArrayList<String>(); libsGL.add("OpenGL32"); - libsList.add(libsGL); + libsList.add(libsGL); return libsList; } - + @Override public final List<String> getToolGetProcAddressFuncNameList() { List<String> res = new ArrayList<String>(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 42b92305a..cb445f005 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -58,7 +58,7 @@ import jogamp.nativewindow.windows.MARGINS; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; import jogamp.opengl.GLGraphicsConfigurationUtil; -public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { +public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { protected static final int MAX_PFORMATS = 256; protected static final int MAX_ATTRIBS = 256; @@ -66,7 +66,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio private boolean isDetermined = false; private boolean isExternal = false; - WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, + WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested); @@ -161,7 +161,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio if (0 == hdc) { throw new GLException("Error: HDC is null"); } - + if (!WGLUtil.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) { throw new GLException("Unable to set pixel format " + caps.getPFDID() + " of " + caps + " for device context " + toHexString(hdc) + @@ -192,7 +192,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } setCapsPFD(caps); } - + /** * Only sets this configuration's capabilities and marks it as determined, * the actual pixelformat is not set. @@ -209,20 +209,20 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * External configuration's HDC pixelformat shall not be modified */ public final boolean isExternal() { return isExternal; } - + final void markExternal() { this.isExternal=true; } - + /** * Determined configuration states set target capabilties via {@link #setCapsPFD(WGLGLCapabilities)}, * but does not imply a set pixelformat. - * - * @see #setPixelFormat(long, WGLGLCapabilities) + * + * @see #setPixelFormat(long, WGLGLCapabilities) * @see #setCapsPFD(WGLGLCapabilities) */ public final boolean isDetermined() { return isDetermined; } - + public final PIXELFORMATDESCRIPTOR getPixelFormat() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFD() : null; } public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; } public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; } @@ -255,7 +255,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } return niattribs; } - + static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) { final IntBuffer out = Buffers.newDirectIntBuffer(1); final IntBuffer in = Buffers.newDirectIntBuffer(1); @@ -270,7 +270,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio static int wglARBPFDIDCount(WindowsWGLContext sharedCtx, long hdc) { final IntBuffer iresults = Buffers.newDirectIntBuffer(1); final IntBuffer iattributes = Buffers.newDirectIntBuffer(1); - iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB); + iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB); WGLExt wglExt = sharedCtx.getWGLExt(); // pfdID shall be ignored here (spec), however, pass a valid pdf index '1' below (possible driver bug) @@ -293,7 +293,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } return pfdIDCount; } - + static int[] wglAllARBPFDIDs(int pfdIDCount) { int[] pfdIDs = new int[pfdIDCount]; for (int i = 0; i < pfdIDCount; i++) { @@ -301,7 +301,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } return pfdIDs; } - + static WGLGLCapabilities wglARBPFID2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, GLProfile glp, long hdc, int pfdID, int winattrbits) { @@ -314,7 +314,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes); if (!((WindowsWGLContext)sharedResource.getContext()).getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0, niattribs, iattributes, iresults)) { - throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format " + pfdID + + throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format " + pfdID + " of device context " + toHexString(hdc) + ", werr " + GDI.GetLastError()); } return AttribList2GLCapabilities(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits); @@ -338,7 +338,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); final IntBuffer pformatsTmp = Buffers.newDirectIntBuffer(WindowsWGLGraphicsConfiguration.MAX_PFORMATS); final IntBuffer numFormatsTmp = Buffers.newDirectIntBuffer(1); - + if ( !wglExt.wglChoosePixelFormatARB(hdc, iattributes, fattributes, WindowsWGLGraphicsConfiguration.MAX_PFORMATS, pformatsTmp, numFormatsTmp) ) { @@ -388,7 +388,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio if(null != caps) { bucket.add(caps); if(DEBUG) { - final int j = bucket.size() - 1; + final int j = bucket.size() - 1; System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> "+j+"]: "+caps); } } else if(DEBUG) { @@ -411,7 +411,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio IntBuffer iattributes, WindowsWGLDrawableFactory.SharedResource sharedResource, int accelerationValue, - int[] floatMode) throws GLException { + int[] floatMode) throws GLException { if (!sharedResource.hasARBPixelFormat()) { return false; } @@ -426,10 +426,10 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } final boolean usePBuffer = caps.isPBuffer() && sharedResource.hasARBPBuffer() ; - + final int surfaceType; if( caps.isOnscreen() ) { - surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB; + surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB; } else if( caps.isFBO() ) { surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB; // native replacement! } else if( usePBuffer ) { @@ -441,7 +441,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } iattributes.put(niattribs++, surfaceType); iattributes.put(niattribs++, GL.GL_TRUE); - + iattributes.put(niattribs++, WGLExt.WGL_DOUBLE_BUFFER_ARB); if (caps.getDoubleBuffered()) { iattributes.put(niattribs++, GL.GL_TRUE); @@ -455,7 +455,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } else { iattributes.put(niattribs++, GL.GL_FALSE); } - + iattributes.put(niattribs++, WGLExt.WGL_RED_BITS_ARB); iattributes.put(niattribs++, caps.getRedBits()); iattributes.put(niattribs++, WGLExt.WGL_GREEN_BITS_ARB); @@ -505,7 +505,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return true; } - static int AttribList2DrawableTypeBits(final IntBuffer iattribs, + static int AttribList2DrawableTypeBits(final IntBuffer iattribs, final int niattribs, final IntBuffer iresults) { int val = 0; @@ -533,7 +533,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return val; } - static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device, + static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, final IntBuffer iattribs, final int niattribs, IntBuffer iresults, final int winattrmask) { final int allDrawableTypeBits = AttribList2DrawableTypeBits(iattribs, niattribs, iresults); @@ -554,7 +554,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp); res.setValuesByARB(iattribs, niattribs, iresults); - return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); + return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } // @@ -608,7 +608,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } if( GLGraphicsConfigurationUtil.BITMAP_BIT == drawableTypeBits ) { // BITMAP exclusive PFD SafeGuard: Only accept BITMAP compatible color formats! - final int pfdColorBits = pfd.getCColorBits(); + final int pfdColorBits = pfd.getCColorBits(); if ( pfdColorBits != 24 || 0 < pfd.getCAlphaBits() ) { // Allowed: RGB888 && !alpha if(DEBUG) { System.err.println("Drop [color bits excl BITMAP]: " + WGLGLCapabilities.PFD2String(pfd, pfdID)); @@ -619,24 +619,24 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp); res.setValuesByGDI(); - return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); + return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) { PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); return PFD2GLCapabilitiesNoCheck(device, glp, pfd, pfdID); } - + static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, GLProfile glp, PIXELFORMATDESCRIPTOR pfd, int pfdID) { if(null == pfd) { return null; } final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp); res.setValuesByGDI(); - - return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res); + + return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res); } - + static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilitiesImmutable caps, PIXELFORMATDESCRIPTOR pfd) { int colorDepth = (caps.getRedBits() + caps.getGreenBits() + @@ -665,7 +665,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio pfdFlags |= GDI.PFD_DOUBLEBUFFER; } } - + if (caps.getStereo()) { pfdFlags |= GDI.PFD_STEREO; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index 3d093b972..9e917a0eb 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -93,7 +93,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - + return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen); } @@ -123,7 +123,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat final GLProfile glp = GLProfile.getDefault(device); List<GLCapabilitiesImmutable> availableCaps = null; - + final GLContext sharedContext; if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); @@ -151,10 +151,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } finally { if ( null != sharedContext ) { - sharedContext.release(); + sharedContext.release(); } else { sharedDrawable.unlockSurface(); - } + } } if( null != availableCaps && availableCaps.size() > 1 ) { @@ -166,7 +166,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, GLProfile glProfile, long hdc) { final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc); final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFDIDs(pfdIDCount); - return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, + return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT); // w/o BITMAP } @@ -175,7 +175,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat int numFormats = pformats.length; List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(numFormats); for (int i = 0; i < numFormats; i++) { - final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i], + final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i], bitmapOnly ? GLGraphicsConfigurationUtil.BITMAP_BIT : GLGraphicsConfigurationUtil.ALL_BITS ); if(null != caps) { bucket.add(caps); @@ -226,7 +226,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat " for device context " + toHexString(hdc) + ": error code " + GDI.GetLastError()); } - set = true; + set = true; } if (DEBUG) { System.err.println("setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set); @@ -332,9 +332,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat final boolean isOpaque = capsChosen.isBackgroundOpaque() && GDI.DwmIsCompositionEnabled(); final int winattrbits = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen) & ~GLGraphicsConfigurationUtil.BITMAP_BIT; // w/o BITMAP final GLProfile glProfile = capsChosen.getGLProfile(); - + final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc); - + if(DEBUG) { System.err.println("updateGraphicsConfigurationARB: hdc "+toHexString(hdc)+", pfdIDCount(hdc) "+pfdIDCount+", capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString()); System.err.println("isOpaque "+isOpaque+" (translucency requested: "+(!capsChosen.isBackgroundOpaque())+", compositioning enabled: "+GDI.DwmIsCompositionEnabled()+")"); @@ -346,7 +346,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } return false; } - + WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps boolean pixelFormatSet = false; // indicates a preset PFD ID [caps] final int presetPFDID = extHDC ? -1 : WGLUtil.GetPixelFormat(hdc) ; @@ -406,9 +406,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - List<GLCapabilitiesImmutable> availableCaps = + List<GLCapabilitiesImmutable> availableCaps = WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, winattrbits); - + if( null == availableCaps || 0 == availableCaps.size() ) { if (DEBUG) { System.err.println("updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with " + pformats.length + " pfd ids"); @@ -467,11 +467,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat // final boolean useFBO = capsChosen.isFBO(); final GLProfile glProfile = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen); - + if(DEBUG) { System.err.println("updateGraphicsConfigurationGDI: capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrmask).toString()); } - + AbstractGraphicsDevice device = config.getScreen().getDevice(); int pfdID; // chosen or preset PFD ID WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps @@ -503,7 +503,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if(null != caps) { availableCaps.add(caps); if(DEBUG) { - final int j = availableCaps.size() - 1; + final int j = availableCaps.size() - 1; System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps); } } else if(DEBUG) { @@ -543,7 +543,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } pixelFormatCaps = (WGLGLCapabilities) availableCaps.get(chosenIndex); if (DEBUG) { - System.err.println("chosen pfdID (GDI): chosenIndex "+ chosenIndex + ", caps " + pixelFormatCaps + + System.err.println("chosen pfdID (GDI): chosenIndex "+ chosenIndex + ", caps " + pixelFormatCaps + " (" + WGLGLCapabilities.PFD2String(pixelFormatCaps.getPFD(), pixelFormatCaps.getPFDID()) +")"); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 3b2ff133a..ddfcbb55b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -65,7 +65,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu public static void registerFactory() { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new WindowsAWTWGLGraphicsConfigurationFactory()); } - private WindowsAWTWGLGraphicsConfigurationFactory() { + private WindowsAWTWGLGraphicsConfigurationFactory() { } protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( @@ -114,7 +114,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen); } - GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); + GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); GraphicsConfiguration chosenGC = null; if ( drawableFactory instanceof WindowsWGLDrawableFactory ) { @@ -138,7 +138,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu } // go on .. } - + if( null == chosenGC ) { // 2nd Choice: Choose and match the GL Visual with AWT: // - collect all AWT PFDs @@ -147,7 +147,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu // The resulting GraphicsConfiguration has to be 'forced' on the AWT native peer, // ie. returned by GLCanvas's getGraphicsConfiguration() befor call by super.addNotify(). // - + // collect all available PFD IDs GraphicsConfiguration[] configs = device.getConfigurations(); int[] pfdIDs = new int[configs.length]; @@ -171,11 +171,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: Found matching AWT PFD ID "+winConfig.getPixelFormatID()+" -> "+winConfig); } } - } + } } else { chosenGC = device.getDefaultConfiguration(); } - + if ( null == chosenGC ) { throw new GLException("Unable to determine GraphicsConfiguration: "+winConfig); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 2c591cfbd..12e3db3bd 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -45,14 +45,14 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; public class GLXUtil { public static final boolean DEBUG = Debug.debug("GLXUtil"); - + public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) { if(null == x11Device) { throw new IllegalArgumentException("null X11GraphicsDevice"); } if(0 == x11Device.getHandle()) { throw new IllegalArgumentException("null X11GraphicsDevice display handle"); - } + } boolean glXAvailable = false; x11Device.lock(); try { @@ -60,17 +60,17 @@ public class GLXUtil { } catch (Throwable t) { /* n/a */ } finally { x11Device.unlock(); - } - return glXAvailable; + } + return glXAvailable; } - + public static String getGLXClientString(X11GraphicsDevice x11Device, int name) { x11Device.lock(); try { return GLX.glXGetClientString(x11Device.getHandle(), name); } finally { x11Device.unlock(); - } + } } public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) { x11Device.lock(); @@ -78,27 +78,27 @@ public class GLXUtil { return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name); } finally { x11Device.unlock(); - } - } + } + } public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) { x11Device.lock(); try { return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx); } finally { x11Device.unlock(); - } + } } - + public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) { final IntBuffer major = Buffers.newDirectIntBuffer(1); final IntBuffer minor = Buffers.newDirectIntBuffer(1); - + x11Device.lock(); try { if (!GLX.glXQueryVersion(x11Device.getHandle(), major, minor)) { throw new GLException("glXQueryVersion failed"); } - + // 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) { @@ -117,7 +117,7 @@ public class GLXUtil { } return new VersionNumber(major.get(0), minor.get(0), 0); } - + public static boolean isMultisampleAvailable(String extensions) { if (extensions != null) { return (extensions.indexOf("GLX_ARB_multisample") >= 0); @@ -142,8 +142,8 @@ public class GLXUtil { public static VersionNumber getClientVersionNumber() { return clientVersionNumber; } - - public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) { + + public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) { if(null != clientVendorName) { return; // already initialized } @@ -152,10 +152,10 @@ public class GLXUtil { } if(0 == x11Device.getHandle()) { throw new IllegalArgumentException("null X11GraphicsDevice display handle"); - } + } 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 String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 72e84b05e..ba88ff3c4 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -79,15 +79,15 @@ public class X11ExternalGLXContext extends X11GLXContext { 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); - + int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); w=val.get(0); GLX.glXQueryDrawable(display, drawable, GLX.GLX_HEIGHT, val); h=val.get(0); - + GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val); X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index fca36c0cc..650fd31d3 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -73,7 +73,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current"); } IntBuffer val = Buffers.newDirectIntBuffer(1); - + GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val); X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 0ecf11a43..22a48e093 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -142,7 +142,7 @@ public class X11GLXContext extends GLContextImpl { if(null != glXServerVersion) { return isGLXVersionGreaterEqualOneThree; } - glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice()); + glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice()); isGLXVersionGreaterEqualOneThree = null != glXServerVersion ? glXServerVersion.compareTo(X11GLXDrawableFactory.versionOneThree) >= 0 : false; return isGLXVersionGreaterEqualOneThree; } @@ -262,7 +262,7 @@ public class X11GLXContext extends GLContextImpl { t.printStackTrace(); } } - + if(0!=ctx) { if (!glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), ctx)) { if(DEBUG) { @@ -419,7 +419,7 @@ public class X11GLXContext extends GLContextImpl { if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context " + toHexString(contextHandle) + + throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + " with display " + toHexString(dpy) + ", drawableWrite " + toHexString(drawable.getHandle()) + @@ -525,7 +525,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected boolean setSwapIntervalImpl(int interval) { - if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; } + if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; } final GLXExt glXExt = getGLXExt(); if(0==hasSwapInterval) { @@ -534,7 +534,7 @@ public class X11GLXContext extends GLContextImpl { if( glXExt.isExtensionAvailable(GLXExtensions.GLX_MESA_swap_control) ) { if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_MESA_swap_control); } hasSwapInterval = 1; - } else */ + } else */ if ( glXExt.isExtensionAvailable(GLXExtensions.GLX_SGI_swap_control) ) { if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_SGI_swap_control); } hasSwapInterval = 2; @@ -542,7 +542,7 @@ public class X11GLXContext extends GLContextImpl { hasSwapInterval = -1; } } catch (Throwable t) { hasSwapInterval=-1; } - } + } /* try { switch( hasSwapInterval ) { case 1: @@ -581,7 +581,7 @@ public class X11GLXContext extends GLContextImpl { try { final IntBuffer maxGroupsNIO = Buffers.newDirectIntBuffer(maxGroups.length - maxGroups_offset); final IntBuffer maxBarriersNIO = Buffers.newDirectIntBuffer(maxBarriers.length - maxBarriers_offset); - + if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(), maxGroupsNIO, maxBarriersNIO) ) { maxGroupsNIO.get(maxGroups, maxGroups_offset, maxGroupsNIO.remaining()); @@ -623,7 +623,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @@ -631,7 +631,7 @@ public class X11GLXContext extends GLContextImpl { public final void glFreeMemoryNV(ByteBuffer pointer) { getGLXExt().glXFreeMemoryNV(pointer); } - + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 5df458b7e..3f0841b6c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -86,7 +86,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { public static final VersionNumber versionOneFour = new VersionNumber(1, 4, 0); static final String GLX_SGIX_pbuffer = "GLX_SGIX_pbuffer"; - + private static DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper = null; public X11GLXDrawableFactory() { @@ -134,7 +134,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { protected final boolean isComplete() { return null != x11GLXDynamicLookupHelper; } - + @Override protected final void destroy() { if(null != sharedResourceRunner) { @@ -205,7 +205,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final public GLContextImpl getContext() { return context; } @Override public GLRendererQuirks getRendererQuirks() { - return null != context ? context.getRendererQuirks() : null; + return null != context ? context.getRendererQuirks() : null; } final String getGLXVendorName() { return glXServerVendorName; } @@ -251,18 +251,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } return res; } - + @Override public SharedResourceRunner.Resource createSharedResource(String connection) { final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); sharedDevice.lock(); try { final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen()); - + GLXUtil.initGLXClientDataSingleton(sharedDevice); final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR); final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS)); - + 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); @@ -283,7 +283,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { if (null == sharedContext) { throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); } - + boolean madeCurrent = false; sharedContext.makeCurrent(); try { @@ -493,12 +493,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; - if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { + if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); } else { device = (X11GraphicsDevice) deviceReq; @@ -506,18 +506,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen()); final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED); if(null == config) { - throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); + throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); } return new WrappedSurface(config, 0, upstreamHook, createNewDevice); } - + @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, + public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); - return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); - } - + 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) { final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java index f25f7ae2c..951174f71 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package jogamp.opengl.x11.glx; import jogamp.opengl.*; @@ -40,8 +40,8 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar public final List<List<String>> getToolLibNames() { final List<List<String>> libsList = new ArrayList<List<String>>(); final List<String> libsGL = new ArrayList<String>(); - - // Be aware that on DRI systems, eg ATI fglrx, etc, + + // Be aware that on DRI systems, eg ATI fglrx, etc, // you have to set LIBGL_DRIVERS_PATH env variable. // Eg on Ubuntu 64bit systems this is: // export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri @@ -55,11 +55,11 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar // last but not least .. the generic one libsGL.add("GL"); - - libsList.add(libsGL); + + libsList.add(libsGL); return libsList; - } - + } + @Override public final List<String> getToolGetProcAddressFuncNameList() { List<String> res = new ArrayList<String>(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index c23bd5337..5aea33f21 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -61,9 +61,9 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable { public static final int MAX_ATTRIBS = 128; - private GLCapabilitiesChooser chooser; + private GLCapabilitiesChooser chooser; - X11GLXGraphicsConfiguration(X11GraphicsScreen screen, + X11GLXGraphicsConfiguration(X11GraphicsScreen screen, X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo()); this.chooser=chooser; @@ -86,8 +86,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem void updateGraphicsConfiguration() { final CapabilitiesImmutable aChosenCaps = getChosenCapabilities(); if( !(aChosenCaps instanceof X11GLCapabilities) || VisualIDHolder.VID_UNDEFINED == aChosenCaps.getVisualID(VIDType.X11_XVISUAL) ) { - // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration - // must be determined _before_ window creation! + // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration + // must be determined _before_ window creation! final X11GLXGraphicsConfiguration newConfig = (X11GLXGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), aChosenCaps).chooseGraphicsConfiguration( aChosenCaps, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); @@ -121,7 +121,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem glp = GLProfile.getDefault(x11Screen.getDevice()); } final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); - final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device)); + final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device)); if(null==caps) { throw new GLException("GLCapabilities null of "+toHexString(fbcfg)); } @@ -130,7 +130,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps, boolean forFBAttr, boolean isMultisampleAvailable, - long display, int screen) + long display, int screen) { int colorDepth = (caps.getRedBits() + caps.getGreenBits() + @@ -143,7 +143,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem if (forFBAttr) { res.put(idx++, GLX.GLX_DRAWABLE_TYPE); - + final int surfaceType; if( caps.isOnscreen() ) { surfaceType = GLX.GLX_WINDOW_BIT; @@ -157,7 +157,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem throw new GLException("no surface type set in caps: "+caps); } res.put(idx++, surfaceType); - + res.put(idx++, GLX.GLX_RENDER_TYPE); res.put(idx++, GLX.GLX_RGBA_BIT); } else { @@ -233,8 +233,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } // FBConfig - - static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { + + static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ; } @@ -278,8 +278,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem int winattrmask, boolean isMultisampleAvailable) { final int allDrawableTypeBits = FBCfgDrawableTypeBits(device, fbcfg); int drawableTypeBits = winattrmask & allDrawableTypeBits; - - final long display = device.getHandle(); + + final long display = device.getHandle(); int fbcfgid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg); XVisualInfo visualInfo = GLX.glXGetVisualFromFBConfig(display, fbcfg); if(null == visualInfo) { @@ -307,8 +307,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setSampleBuffers(glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0); res.setNumSamples (glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLES, tmp)); } - final XRenderDirectFormat xrmask = ( null != visualInfo ) ? - XVisual2XRenderMask( display, visualInfo.getVisual() ) : + final XRenderDirectFormat xrmask = ( null != visualInfo ) ? + XVisual2XRenderMask( display, visualInfo.getVisual() ) : null ; final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0; res.setBackgroundOpaque( 0 >= alphaMask ); @@ -318,7 +318,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setTransparentBlueValue(xrmask.getBlueMask()); res.setTransparentAlphaValue(alphaMask); } - // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples) + // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples) res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp) != 0); res.setStereo (glXGetFBConfig(display, fbcfg, GLX.GLX_STEREO, tmp) != 0); res.setHardwareAccelerated(glXGetFBConfig(display, fbcfg, GLX.GLX_CONFIG_CAVEAT, tmp) != GLX.GLX_SLOW_CONFIG); @@ -332,8 +332,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setAccumAlphaBits(glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_ALPHA_SIZE, tmp)); res.setDepthBits (glXGetFBConfig(display, fbcfg, GLX.GLX_DEPTH_SIZE, tmp)); res.setStencilBits (glXGetFBConfig(display, fbcfg, GLX.GLX_STENCIL_SIZE, tmp)); - - return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); + + return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } private static String glXGetFBConfigErrorCode(int err) { @@ -363,7 +363,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem static long glXFBConfigID2FBConfig(long display, int screen, 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); + count.put(0, -1); PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); if (fbcfgsL == null || fbcfgsL.limit()<1) { return 0; @@ -380,7 +380,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); if (infos == null || infos.length == 0) { return null; - } + } XVisualInfo res = XVisualInfo.create(infos[0]); if (DEBUG) { System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID)); @@ -391,10 +391,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info, final int winattrmask, boolean isMultisampleEnabled) { - final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | + final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT | GLGraphicsConfigurationUtil.FBO_BIT ; - + final int drawableTypeBits = winattrmask & allDrawableTypeBits; if( 0 == drawableTypeBits ) { @@ -425,13 +425,13 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // Note: use of hardware acceleration is determined by // glXCreateContext, not by the XVisualInfo. Optimistically claim // that all GLCapabilities have the capability to be hardware - // accelerated. + // accelerated. if (isMultisampleEnabled) { res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0); res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES, tmp)); } - final XRenderDirectFormat xrmask = ( null != info ) ? - XVisual2XRenderMask( display, info.getVisual() ) : + final XRenderDirectFormat xrmask = ( null != info ) ? + XVisual2XRenderMask( display, info.getVisual() ) : null ; final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0; res.setBackgroundOpaque( 0 >= alphaMask ); @@ -454,7 +454,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp)); res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp)); - return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); + return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } private static String glXGetConfigErrorCode(int err) { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index a7c7d3fe6..abe310a3f 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -109,7 +109,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - + if(!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice)absScreen.getDevice())) { if(null != fallbackX11GraphicsConfigurationFactory) { if(DEBUG) { @@ -118,7 +118,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, VisualIDHolder.VID_UNDEFINED); } throw new InternalError("No GLX and no fallback GraphicsConfigurationFactory available for: "+absScreen); - } + } return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID); } @@ -134,7 +134,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF final GLProfile glp = GLProfile.getDefault(device); List<GLCapabilitiesImmutable> availableCaps = null; - + sharedDevice.lock(); try { if( sharedResource.isGLXVersionGreaterEqualOneThree() ) { @@ -219,9 +219,9 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if (capsChosen == null) { capsChosen = new GLCapabilities(null); } - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); - + capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device); final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer(); @@ -262,7 +262,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return null; } final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); - + final X11GLCapabilities caps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(x11Device)); return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } @@ -280,8 +280,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); long display = x11Device.getHandle(); int screen = x11Screen.getIndex(); - - final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); + + final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device); final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen); final IntBuffer count = Buffers.newDirectIntBuffer(1); @@ -337,14 +337,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } } } - + if(DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: got configs: "+availableCaps.size()); for(int i=0; i<availableCaps.size(); i++) { System.err.println(i+": "+availableCaps.get(i)); } } - + if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { for(int i=0; i<availableCaps.size(); ) { VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i); @@ -363,7 +363,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size()); } } - + int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); if ( 0 > chosenIndex ) { if (DEBUG) { @@ -393,15 +393,15 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); long display = absDevice.getHandle(); int screen = x11Screen.getIndex(); - - final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); - final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice); + + final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); + final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice); final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, false, isMultisampleAvailable, display, screen); XVisualInfo recommendedVis = null; // 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice // skipped if xvisualID is given - if( VisualIDHolder.VID_UNDEFINED == xvisualID ) { + if( VisualIDHolder.VID_UNDEFINED == xvisualID ) { recommendedVis = GLX.glXChooseVisual(display, screen, attribs); if (DEBUG) { System.err.print("glXChooseVisual recommended "); @@ -441,7 +441,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF System.err.println(i+": "+availableCaps.get(i)); } } - + if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { for(int i=0; i<availableCaps.size(); ) { VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i); @@ -453,14 +453,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } if(0==availableCaps.size()) { if(DEBUG) { - System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null"); + System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null"); } return null; } else if(DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size()); } } - + int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex); if ( 0 > chosenIndex ) { if (DEBUG) { |