diff options
643 files changed, 12269 insertions, 12269 deletions
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java index 2b51be164..83f5e4ebd 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java index 60972873e..0a502c123 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -344,7 +344,7 @@ public class Mixer { e.printStackTrace(); } } - + if (directByteBufferConstructor != null) { try { return (ByteBuffer) diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java index c45430d23..01346553c 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java index b57bf1dc6..98a787478 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -151,7 +151,7 @@ public class Track { // These are only for use by the Mixer private float leftGain; private float rightGain; - + void setLeftGain(float leftGain) { this.leftGain = leftGain; } diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java index 1afdaf081..0726e5762 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index b04f35230..8429fbcfd 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.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. */ @@ -67,7 +67,7 @@ public class BuildComposablePipeline { * By extra command-line argument: <code>prolog_xor_downstream</code>. * <p> * If true, either prolog (if exist) is called or downstream's method, but not both. - * By default, both methods would be called. + * By default, both methods would be called. * </p> * <p>Default: false</p> */ @@ -81,7 +81,7 @@ public class BuildComposablePipeline { * <p>Default: false</p> */ public static final int GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS = 1 << 4; - + int mode; private String outputDir; private String outputPackage; diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java index 5298cc357..a5a26d18f 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.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. */ @@ -68,7 +68,7 @@ import java.util.regex.Pattern; * <br> * * <pre> - * + * * #ifndef GL_XXXX * GLAPI <returnType> <APIENTRY|GLAPIENTRY> glFuncName(<params>) * #endif GL_XXXX @@ -78,7 +78,7 @@ import java.util.regex.Pattern; * For example, if it parses the following data: * * <pre> - * + * * #ifndef GL_VERSION_1_3 * GLAPI void APIENTRY glActiveTexture (GLenum); * GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); @@ -89,7 +89,7 @@ import java.util.regex.Pattern; * GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); * GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); * #endif - * + * * </pre> * * It will associate @@ -105,7 +105,7 @@ import java.util.regex.Pattern; * */ public class BuildStaticGLInfo { - // Handles function pointer + // Handles function pointer protected static final int funcIdentifierGroup = 9; protected static Pattern funcPattern = Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s+\\*\\s*|\\s*\\*\\s+|\\s+)?(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)"); @@ -119,7 +119,7 @@ public class BuildStaticGLInfo { Pattern.compile("\\#(elif|else)(.*)"); protected static Pattern endifPattern = Pattern.compile("\\#endif(.*)"); - + protected static final int defineIdentifierGroup = 1; protected static Pattern definePattern = Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)"); @@ -203,7 +203,7 @@ public class BuildStaticGLInfo { Matcher m = null; int block = 0; while ((line = reader.readLine()) != null) { - int type = 0; // 1-define, 2-function + int type = 0; // 1-define, 2-function if ( 0 < block ) { // inside a #ifndef GL_XXX block and matching a function, if block > 0 String identifier = null; if( 2 >= block ) { // not within sub-blocks > 2, i.e. further typedefs @@ -216,9 +216,9 @@ public class BuildStaticGLInfo { } } if ( identifier != null && - activeAssociation != null && - !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_... - ) + activeAssociation != null && + !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_... + ) { addAssociation(identifier, activeAssociation); if (DEBUG) { @@ -243,7 +243,7 @@ public class BuildStaticGLInfo { if (DEBUG) { System.err.println("<"+block+"> END ASSOCIATION BLOCK: <" + activeAssociation + " <-> " + comment + ">"); } - activeAssociation = null; + activeAssociation = null; } else { if (DEBUG) { System.err.println("<"+block+"> END IF BLOCK: <" + comment + ">"); @@ -251,7 +251,7 @@ public class BuildStaticGLInfo { } } } - } else if ((m = associationPattern.matcher(line)).matches()) { + } else if ((m = associationPattern.matcher(line)).matches()) { // found a new #ifndef GL_XXX block activeAssociation = m.group(1).trim(); block++; @@ -387,7 +387,7 @@ public class BuildStaticGLInfo { declarationToExtensionMap.put(identifier, extensions); } extensions.add(association); - + Set<String> identifiers = extensionToDeclarationMap.get(association); if (identifiers == null) { identifiers = new HashSet<String>(); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index a00b19abc..f1a32fa9c 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-2005 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. */ @@ -241,7 +241,7 @@ public class GLConfiguration extends ProcAddressConfiguration { } } if( ignoredExtension ) { - ignoredExtension = !shouldForceExtension( symbol, true, symbol ); + ignoredExtension = !shouldForceExtension( symbol, true, symbol ); if( ignoredExtension ) { final Set<String> origSymbols = getRenamedJavaSymbols( symbol ); if(null != origSymbols) { @@ -251,7 +251,7 @@ public class GLConfiguration extends ProcAddressConfiguration { break; } } - } + } } } if( ignoredExtension ) { @@ -274,7 +274,7 @@ public class GLConfiguration extends ProcAddressConfiguration { } return false; } - + public boolean shouldForceExtension(final String symbol, final boolean criteria, final String renamedSymbol) { if (criteria && glInfo != null) { final Set<String> extensionNames = glInfo.getExtension(symbol); @@ -292,7 +292,7 @@ public class GLConfiguration extends ProcAddressConfiguration { } return true; } - } + } } } return false; @@ -343,9 +343,9 @@ public class GLConfiguration extends ProcAddressConfiguration { public boolean isBufferObjectFunction(String name) { return (getBufferObjectKind(name) != null); } - - public boolean isBufferObjectOnly(String name) { - return bufferObjectOnly.contains(name); + + public boolean isBufferObjectOnly(String name) { + return bufferObjectOnly.contains(name); } /** Parses any GL headers specified in the configuration file for diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index fa95049cc..1af632682 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-2005 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. */ @@ -125,7 +125,7 @@ public class GLEmitter extends ProcAddressEmitter { } if(JavaConfiguration.DEBUG_RENAMES) { System.err.println("RenameExtensionIntoCore: "+extension+" END>"); - } + } } } @@ -279,7 +279,7 @@ public class GLEmitter extends ProcAddressEmitter { int j=0; while( j < bindings.size() ) { final MethodBinding cur = bindings.get(j); - + // Some of these routines (glBitmap) take strongly-typed // primitive pointers as arguments which are expanded into // non-void* arguments @@ -306,7 +306,7 @@ public class GLEmitter extends ProcAddressEmitter { // Now need to flag this MethodBinding so that we generate the // correct flags in the emitters later bufferObjectMethodBindings.put(result, result); - + if( bufferObjectOnly ) { bindings.remove(j); } else { @@ -397,7 +397,7 @@ public class GLEmitter extends ProcAddressEmitter { } private int addExtensionListOfAliasedSymbols2Buffer(BuildStaticGLInfo glInfo, StringBuilder buf, String sep1, String sep2, String name, Collection<String> exclude) { int num = 0; - if(null != name) { + if(null != name) { num += addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, name); // extensions of given name boolean needsSep2 = 0<num; Set<String> origNames = cfg.getRenamedJavaSymbols(name); @@ -406,7 +406,7 @@ public class GLEmitter extends ProcAddressEmitter { if(!exclude.contains(origName)) { if (needsSep2) { buf.append(sep2); // diff-name seperator - } + } int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name needsSep2 = num<num2; num += num2; @@ -416,7 +416,7 @@ public class GLEmitter extends ProcAddressEmitter { } return num; } - + public int addExtensionsOfSymbols2Buffer(StringBuilder buf, String sep1, String sep2, String first, Collection<String> col) { BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); if (null == glInfo) { @@ -469,16 +469,16 @@ public class GLEmitter extends ProcAddressEmitter { /** * {@inheritDoc} - */ + */ @Override protected void endProcAddressTable() throws Exception { PrintWriter w = tableWriter; - + w.println(" @Override"); w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {"); w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);"); w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;"); - w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); + w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); w.println(" public final java.lang.reflect.Field run() {"); w.println(" java.lang.reflect.Field addressField = null;"); @@ -510,7 +510,7 @@ public class GLEmitter extends ProcAddressEmitter { w.println(" \"function\", e);"); w.println(" }"); w.println(" }"); - + w.println(" @Override"); w.println(" public long getAddressFor(String functionNameUsr) throws SecurityException, IllegalArgumentException {"); w.println(" SecurityUtil.checkAllLinkPermission();"); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java index fdfaee8a6..389d35f99 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-2005 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. */ @@ -111,7 +111,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit writer.print("<code> "); writer.print(funcSym.getType().toString(symbolRenamed, tagNativeBinding)); writer.print(" </code> "); - + newComment.append("<br>Part of "); if (0 == glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, binding.getAliasedNames())) { if (glEmitter.getGLConfig().getAllowNonGLExtensions()) { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java index e3e7cb970..b98f17117 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java @@ -55,13 +55,13 @@ import org.apache.tools.ant.util.JavaEnvUtils; /** * <p>An <a href="http://ant.apache.org">ANT</a> {@link org.apache.tools.ant.Task} * for using {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}.</p> - * + * * <p>Usage:</p> * <pre> - <staticglgen package="[generated files package]" + <staticglgen package="[generated files package]" headers="[file pattern of GL headers]" outputdir="[directory to output the generated files]" /> - * </pre> + * </pre> * * @author Rob Grzywinski <a href="mailto:[email protected]">[email protected]</a> */ @@ -72,7 +72,7 @@ public class StaticGLGenTask extends Task * <p>The {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} classname.</p> */ private static final String GL_GEN = "com.jogamp.gluegen.opengl.BuildStaticGLInfo"; - + // ========================================================================= /** * <p>The {@link org.apache.tools.ant.types.CommandlineJava} that is used @@ -90,12 +90,12 @@ public class StaticGLGenTask extends Task * <p>The output directory.</p> */ private String outputDirectory; - + /** * <p>The {@link org.apache.tools.ant.types.FileSet} of GL headers.</p> */ private FileSet headerSet = new FileSet(); - + // ========================================================================= /** * <p>Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.</p> @@ -104,7 +104,7 @@ public class StaticGLGenTask extends Task { // create the CommandlineJava that will be used to call BuildStaticGLInfo glgenCommandline = new CommandlineJava(); - + // set the VM and classname in the commandline glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java")); glgenCommandline.setClassname(GL_GEN); @@ -114,7 +114,7 @@ public class StaticGLGenTask extends Task // ANT getters and setters /** * <p>Set the package name for the generated files. This is called by ANT.</p> - * + * * @param packageName the name of the package for the generated files */ public void setPackage(String packageName) @@ -125,12 +125,12 @@ public class StaticGLGenTask extends Task /** * <p>Set the output directory. This is called by ANT.</p> - * + * * @param directory the output directory */ public void setOutputDir(String directory) { - log( ("Setting output directory to: " + directory), + log( ("Setting output directory to: " + directory), Project.MSG_VERBOSE); this.outputDirectory = directory; } @@ -138,7 +138,7 @@ public class StaticGLGenTask extends Task /** * <p>Add a header file to the list. This is called by ANT for a nested * element.</p> - * + * * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} */ public PatternSet.NameEntry createHeader() @@ -149,7 +149,7 @@ public class StaticGLGenTask extends Task /** * <p>Add a header file to the list. This is called by ANT for a nested * element.</p> - * + * * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry} */ public PatternSet.NameEntry createHeadersFile() @@ -171,7 +171,7 @@ public class StaticGLGenTask extends Task /** * <p>Add an optional classpath that defines the location of {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} * and <code>BuildStaticGLInfo</code>'s dependencies.</p> - * + * * @returns {@link org.apache.tools.ant.types.Path} */ public Path createClasspath() @@ -183,23 +183,23 @@ public class StaticGLGenTask extends Task /** * <p>Run the task. This involves validating the set attributes, creating * the command line to be executed and finally executing the command.</p> - * + * * @see org.apache.tools.ant.Task#execute() */ - public void execute() - throws BuildException + public void execute() + throws BuildException { // validate that all of the required attributes have been set validateAttributes(); - + // TODO: add logic to determine if the generated file needs to be // regenerated - + // add the attributes to the CommandlineJava addAttributes(); log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE); - + // execute the command and throw on error final int error = execute(glgenCommandline.getCommandline()); if(error == 1) @@ -208,11 +208,11 @@ public class StaticGLGenTask extends Task /** * <p>Ensure that the user specified all required arguments.</p> - * - * @throws BuildException if there are required arguments that are not + * + * @throws BuildException if there are required arguments that are not * present or not valid */ - private void validateAttributes() + private void validateAttributes() throws BuildException { // validate that the package name is set @@ -223,29 +223,29 @@ public class StaticGLGenTask extends Task // TODO: switch to file and ensure that it exists if(!isValid(outputDirectory)) throw new BuildException("Invalid output directory name: " + outputDirectory); - + // TODO: validate that there are headers set } /** * <p>Is the specified string valid? A valid string is non-<code>null</code> * and has a non-zero length.</p> - * + * * @param string the string to be tested for validity * @return <code>true</code> if the string is valid. <code>false</code> - * otherwise. + * otherwise. */ private boolean isValid(String string) { // check for null if(string == null) return false; - + // ensure that the string has a non-zero length // NOTE: must trim() to remove leading and trailing whitespace if(string.trim().length() < 1) return false; - + // the string is valid return true; } @@ -258,10 +258,10 @@ public class StaticGLGenTask extends Task { // add the package name glgenCommandline.createArgument().setValue(packageName); - + // add the output directory name glgenCommandline.createArgument().setValue(outputDirectory); - + // add the header -files- from the FileSet headerSet.setDir(getProject().getBaseDir()); DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject()); @@ -272,25 +272,25 @@ public class StaticGLGenTask extends Task } } - /** - * <p>Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a + /** + * <p>Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a * forked JVM.</p> - * + * * @throws BuildException */ - private int execute(String[] command) + private int execute(String[] command) throws BuildException { // create the object that will perform the command execution Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, - Project.MSG_WARN), + Project.MSG_WARN), null); - + // set the project and command line execute.setAntRun(project); execute.setCommandline(command); execute.setWorkingDirectory( project.getBaseDir() ); - + // execute the command try { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java index adb1c2ae0..4ac9ae3f3 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.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. */ @@ -55,8 +55,8 @@ import java.util.Set; /** * Emitter producing NativeSignature attributes. - * - * Review: This Package/Class is not used and subject to be deleted. + * + * Review: This Package/Class is not used and subject to be deleted. */ public class NativeSignatureEmitter extends GLEmitter { diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java index e98478b6e..a17657382 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.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. */ @@ -182,14 +182,14 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding // Always emit outgoing "this" argument writer.print("long "); - writer.print(javaThisArgumentName()); + writer.print(javaThisArgumentName()); ++numEmitted; needComma = true; } for (int i = 0; i < binding.getNumArguments(); i++) { JavaType type = binding.getJavaArgumentType(i); - if (type.isVoid()) { + if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. if (binding.getNumArguments() != 1) { @@ -198,7 +198,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding "multi-argument function \"" + binding + "\""); } continue; - } + } if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { // Don't need to expose these at the Java level @@ -229,7 +229,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding if (type.isNIOBuffer()) { writer.print(", int " + byteOffsetArgName(i)); } else if (type.isNIOBufferArray()) { - writer.print(", int[] " + + writer.print(", int[] " + byteOffsetArrayArgName(i)); } } @@ -246,7 +246,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding writer.print(" "); JavaType returnType = binding.getJavaReturnType(); boolean needsResultAssignment = false; - + if (!returnType.isVoid()) { if (returnType.isCompoundTypeWrapper() || returnType.isNIOByteBuffer()) { @@ -375,7 +375,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding // there's something wrong with our parsing of the headers. assert(binding.getNumArguments() == 1); continue; - } + } if (needComma) { writer.print(", "); diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java index 92554776a..9b57a2f2d 100644 --- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java +++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-2005 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. - * + * */ package com.jogamp.gluegen.runtime.opengl; @@ -43,12 +43,12 @@ public class GLNameResolver { //GL_XYZ : GL_XYZ, GL_GL2_XYZ, GL_ARB_XYZ, GL_OES_XYZ, GL_OML_XYZ // // Pass-1 Unify ARB extensions with the same value - // Pass-2 Unify vendor extensions, + // Pass-2 Unify vendor extensions, // if exist as an ARB extension with the same value. // Pass-3 Emit public static final String[] extensionsARB = { "ARB", "GL2", "OES", "KHR", "OML" }; - public static final String[] extensionsVEN = { "3DFX", + public static final String[] extensionsVEN = { "3DFX", "AMD", "ANGLE", "ARM", @@ -158,7 +158,7 @@ public class GLNameResolver { return str; } public static final boolean isExtension(String str, boolean isGLFunc) { - return isExtension(extensionsARB, str, isGLFunc) || + return isExtension(extensionsARB, str, isGLFunc) || isExtension(extensionsVEN, str, isGLFunc); } diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java index 9775de491..f8406075c 100644 --- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java +++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.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. */ - + /* * Created on Saturday, April 24 2010 16:44 */ diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index a3749788b..cb2885e0f 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -42,13 +42,13 @@ import com.jogamp.opengl.math.geom.AABBox; /** A Generic shape objects which is defined by a list of Outlines. * This Shape can be transformed to Triangulations. * The list of triangles generated are render-able by a Region object. - * The triangulation produced by this Shape will define the + * The triangulation produced by this Shape will define the * closed region defined by the outlines. - * + * * One or more OutlineShape Object can be associated to a region * this is left as a high-level representation of the Objects. For * optimizations, flexibility requirements for future features. - * + * * <br><br> * Example to creating an Outline Shape: * <pre> @@ -60,18 +60,18 @@ import com.jogamp.opengl.math.geom.AABBox; addVertex(...) addVertex(...) * </pre> - * - * The above will create two outlines each with three vertices. By adding these two outlines to + * + * The above will create two outlines each with three vertices. By adding these two outlines to * the OutlineShape, we are stating that the combination of the two outlines represent the shape. * <br> - * - * To specify that the shape is curved at a region, the on-curve flag should be set to false + * + * To specify that the shape is curved at a region, the on-curve flag should be set to false * for the vertex that is in the middle of the curved region (if the curved region is defined by 3 * vertices (quadratic curve). * <br> - * In case the curved region is defined by 4 or more vertices the middle vertices should both have + * In case the curved region is defined by 4 or more vertices the middle vertices should both have * the on-curve flag set to false. - * + * * <br>Example: <br> * <pre> addVertex(0,0, true); @@ -79,16 +79,16 @@ import com.jogamp.opengl.math.geom.AABBox; addVertex(1,1, false); addVertex(1,0, true); * </pre> - * - * The above snippet defines a cubic nurbs curve where (0,1 and 1,1) + * + * The above snippet defines a cubic nurbs curve where (0,1 and 1,1) * do not belong to the final rendered shape. - * + * * <i>Implementation Notes:</i><br> * <ul> * <li> The first vertex of any outline belonging to the shape should be on-curve</li> * <li> Intersections between off-curved parts of the outline is not handled</li> * </ul> - * + * * @see Outline * @see Region */ @@ -104,21 +104,21 @@ public class OutlineShape implements Comparable<OutlineShape> { VerticesState(int state){ this.state = state; } - } + } public static final int DIRTY_BOUNDS = 1 << 0; private final Vertex.Factory<? extends Vertex> vertexFactory; private VerticesState outlineState; - /** The list of {@link Outline}s that are part of this + /** The list of {@link Outline}s that are part of this * outline shape. */ private ArrayList<Outline> outlines; private AABBox bbox; /** dirty bits DIRTY_BOUNDS */ - private int dirtyBits; + private int dirtyBits; /** Create a new Outline based Shape */ @@ -128,7 +128,7 @@ public class OutlineShape implements Comparable<OutlineShape> { this.outlines.add(new Outline()); this.outlineState = VerticesState.UNDEFINED; this.bbox = new AABBox(); - this.dirtyBits = 0; + this.dirtyBits = 0; } /** Clears all data and reset all states as if this instance was newly created */ @@ -137,7 +137,7 @@ public class OutlineShape implements Comparable<OutlineShape> { outlines.add(new Outline()); outlineState = VerticesState.UNDEFINED; bbox.reset(); - dirtyBits = 0; + dirtyBits = 0; } /** Returns the associated vertex factory of this outline shape @@ -149,10 +149,10 @@ public class OutlineShape implements Comparable<OutlineShape> { return outlines.size(); } - /** Add a new empty {@link Outline} + /** Add a new empty {@link Outline} * to the end of this shape's outline list. * <p>If the {@link #getLastOutline()} is empty already, no new one will be added.</p> - * + * * After a call to this function all new vertices added * will belong to the new outline */ @@ -164,26 +164,26 @@ public class OutlineShape implements Comparable<OutlineShape> { /** Appends the {@link Outline} element to the end, * ensuring a clean tail. - * + * * <p>A clean tail is ensured, no double empty Outlines are produced * and a pre-existing empty outline will be replaced with the given one. </p> - * + * * @param outline Outline object to be added - * @throws NullPointerException if the {@link Outline} element is null + * @throws NullPointerException if the {@link Outline} element is null */ public void addOutline(Outline outline) throws NullPointerException { addOutline(outlines.size(), outline); } /** Insert the {@link Outline} element at the given {@code position}. - * + * * <p>If the {@code position} indicates the end of this list, * a clean tail is ensured, no double empty Outlines are produced * and a pre-existing empty outline will be replaced with the given one. </p> - * + * * @param position of the added Outline * @param outline Outline object to be added - * @throws NullPointerException if the {@link Outline} element is null + * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber()) */ public void addOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException { @@ -213,7 +213,7 @@ public class OutlineShape implements Comparable<OutlineShape> { * using {@link #addOutline(Outline)} for each element. * <p>Closes the current last outline via {@link #closeLastOutline()} before adding the new ones.</p> * @param outlineShape OutlineShape elements to be added. - * @throws NullPointerException if the {@link OutlineShape} is null + * @throws NullPointerException if the {@link OutlineShape} is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber()) */ public void addOutlineShape(OutlineShape outlineShape) throws NullPointerException { @@ -228,10 +228,10 @@ public class OutlineShape implements Comparable<OutlineShape> { /** Replaces the {@link Outline} element at the given {@code position}. * <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p> - * + * * @param position of the replaced Outline - * @param outline replacement Outline object - * @throws NullPointerException if the {@link Outline} element is null + * @param outline replacement Outline object + * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ public void setOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException { @@ -244,7 +244,7 @@ public class OutlineShape implements Comparable<OutlineShape> { /** Removes the {@link Outline} element at the given {@code position}. * <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p> - * + * * @param position of the to be removed Outline * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ @@ -261,15 +261,15 @@ public class OutlineShape implements Comparable<OutlineShape> { return outlines.get(outlines.size()-1); } - /** @return the {@code Outline} at {@code position} + /** @return the {@code Outline} at {@code position} * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ public Outline getOutline(int position) throws IndexOutOfBoundsException { return outlines.get(position); - } + } /** Adds a vertex to the last open outline in the - * shape. + * shape. * @param v the vertex to be added to the OutlineShape */ public final void addVertex(Vertex v) { @@ -280,9 +280,9 @@ public class OutlineShape implements Comparable<OutlineShape> { } } - /** Adds a vertex to the last open outline in the shape. - * at {@code position} - * @param position indx at which the vertex will be added + /** Adds a vertex to the last open outline in the shape. + * at {@code position} + * @param position indx at which the vertex will be added * @param v the vertex to be added to the OutlineShape */ public final void addVertex(int position, Vertex v) { @@ -295,7 +295,7 @@ public class OutlineShape implements Comparable<OutlineShape> { /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute * of the vertex. The 2D vertex will be represented as Z=0. - * + * * @param x the x coordinate * @param y the y coordniate * @param onCurve flag if this vertex is on the final curve or defines a curved region @@ -317,10 +317,10 @@ public class OutlineShape implements Comparable<OutlineShape> { addVertex(vertexFactory.create(x, y, z, onCurve)); } - /** Add a vertex to the last outline by passing a float array and specifying the - * offset and length in which. The attributes of the vertex are located. + /** Add a vertex to the last outline by passing a float array and specifying the + * offset and length in which. The attributes of the vertex are located. * The attributes should be continuous (stride = 0). - * Attributes which value are not set (when length less than 3) + * Attributes which value are not set (when length less than 3) * are set implicitly to zero. * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from * @param offset the offset in the buffer to the x coordinate @@ -330,11 +330,11 @@ public class OutlineShape implements Comparable<OutlineShape> { */ public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) { addVertex(vertexFactory.create(coordsBuffer, offset, length, onCurve)); - } + } /** Closes the last outline in the shape. * <p>If last vertex is not equal to first vertex. - * A new temp vertex is added at the end which + * A new temp vertex is added at the end which * is equal to the first.</p> */ public void closeLastOutline() { @@ -351,7 +351,7 @@ public class OutlineShape implements Comparable<OutlineShape> { /** Ensure the outlines represent * the specified destinationType. * and removes all overlaps in boundary triangles - * @param destinationType the target outline's vertices state. Currently only + * @param destinationType the target outline's vertices state. Currently only * {@link OutlineShape.VerticesState#QUADRATIC_NURBS} are supported. */ public void transformOutlines(VerticesState destinationType) { @@ -371,7 +371,7 @@ public class OutlineShape implements Comparable<OutlineShape> { float[] v2 = VectorUtil.mid(v1, v3); //drop off-curve vertex to image on the curve - b.setCoord(v2, 0, 3); + b.setCoord(v2, 0, 3); b.setOnCurve(true); outline.addVertex(index, vertexFactory.create(v1, 0, 3, false)); @@ -379,19 +379,19 @@ public class OutlineShape implements Comparable<OutlineShape> { } /** Check overlaps between curved triangles - * first check if any vertex in triangle a is in triangle b + * first check if any vertex in triangle a is in triangle b * second check if edges of triangle a intersect segments of triangle b * if any of the two tests is true we divide current triangle * and add the other to the list of overlaps - * + * * Loop until overlap array is empty. (check only in first pass) */ - private void checkOverlaps() { + private void checkOverlaps() { ArrayList<Vertex> overlaps = new ArrayList<Vertex>(3); int count = getOutlineNumber(); boolean firstpass = true; do { - for (int cc = 0; cc < count; cc++) { + for (int cc = 0; cc < count; cc++) { final Outline outline = getOutline(cc); int vertexCount = outline.getVertexCount(); for(int i=0; i < outline.getVertexCount(); i++) { @@ -429,7 +429,7 @@ public class OutlineShape implements Comparable<OutlineShape> { private Vertex checkTriOverlaps(Vertex a, Vertex b, Vertex c) { int count = getOutlineNumber(); - for (int cc = 0; cc < count; cc++) { + for (int cc = 0; cc < count; cc++) { final Outline outline = getOutline(cc); int vertexCount = outline.getVertexCount(); for(int i=0; i < vertexCount; i++) { @@ -451,7 +451,7 @@ public class OutlineShape implements Comparable<OutlineShape> { return current; } - if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current) + if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current) || VectorUtil.tri2SegIntersection(a, b, c, current, nextV) || VectorUtil.tri2SegIntersection(a, b, c, prevV, nextV)) { return current; @@ -463,7 +463,7 @@ public class OutlineShape implements Comparable<OutlineShape> { private void transformOutlines2Quadratic() { int count = getOutlineNumber(); - for (int cc = 0; cc < count; cc++) { + for (int cc = 0; cc < count; cc++) { final Outline outline = getOutline(cc); int vertexCount = outline.getVertexCount(); @@ -471,13 +471,13 @@ public class OutlineShape implements Comparable<OutlineShape> { final Vertex currentVertex = outline.getVertex(i); final Vertex nextVertex = outline.getVertex((i+1)%vertexCount); if ( !currentVertex.isOnCurve() && !nextVertex.isOnCurve() ) { - final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), + final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord()); final Vertex v = vertexFactory.create(newCoords, 0, 3, true); i++; vertexCount++; outline.addVertex(i, v); - } + } } if(vertexCount <= 0) { outlines.remove(outline); @@ -487,7 +487,7 @@ public class OutlineShape implements Comparable<OutlineShape> { } if( vertexCount > 0 ) { - if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(), + if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(), outline.getLastVertex().getCoord())) { outline.removeVertex(vertexCount-1); } @@ -508,7 +508,7 @@ public class OutlineShape implements Comparable<OutlineShape> { } } - /** @return the list of concatenated vertices associated with all + /** @return the list of concatenated vertices associated with all * {@code Outline}s of this object */ public ArrayList<Vertex> getVertices() { @@ -551,7 +551,7 @@ public class OutlineShape implements Comparable<OutlineShape> { } /** Compare two outline shapes with Bounding Box area - * as criteria. + * as criteria. * @see java.lang.Comparable#compareTo(java.lang.Object) */ public final int compareTo(OutlineShape outline) { @@ -579,12 +579,12 @@ public class OutlineShape implements Comparable<OutlineShape> { validateBoundingBox(); } return bbox; - } + } /** * @param obj the Object to compare this OutlineShape with - * @return true if {@code obj} is an OutlineShape, not null, - * same outlineState, equal bounds and equal outlines in the same order + * @return true if {@code obj} is an OutlineShape, not null, + * same outlineState, equal bounds and equal outlines in the same order */ public boolean equals(Object obj) { if( obj == this) { @@ -592,7 +592,7 @@ public class OutlineShape implements Comparable<OutlineShape> { } if( null == obj || !(obj instanceof OutlineShape) ) { return false; - } + } final OutlineShape o = (OutlineShape) obj; if(getOutlineState() != o.getOutlineState()) { return false; @@ -625,5 +625,5 @@ public class OutlineShape implements Comparable<OutlineShape> { o.outlines.add(outlines.get(i).clone()); } return o; - } + } } diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 8b6d000fa..a9779523a 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -38,48 +38,48 @@ import com.jogamp.opengl.math.geom.AABBox; /** Abstract Outline shape GL representation * define the method an OutlineShape(s) is * binded rendered. - * + * * @see GLRegion */ public abstract class Region { - + /** Debug flag for region impl (graph.curve) */ public static final boolean DEBUG = Debug.debug("graph.curve"); - + public static final boolean DEBUG_INSTANCE = false; - /** View based Anti-Aliasing, A Two pass region rendering, slower - * and more resource hungry (FBO), but AA is perfect. - * Otherwise the default fast one pass MSAA region rendering is being used. + /** View based Anti-Aliasing, A Two pass region rendering, slower + * and more resource hungry (FBO), but AA is perfect. + * Otherwise the default fast one pass MSAA region rendering is being used. */ public static final int VBAA_RENDERING_BIT = 1 << 0; /** Use non uniform weights [0.0 .. 1.9] for curve region rendering. - * Otherwise the default weight 1.0 for uniform curve region rendering is being applied. + * Otherwise the default weight 1.0 for uniform curve region rendering is being applied. */ public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 1; public static final int TWO_PASS_DEFAULT_TEXTURE_UNIT = 0; private final int renderModes; - private boolean dirty = true; - protected int numVertices = 0; + private boolean dirty = true; + protected int numVertices = 0; protected final AABBox box = new AABBox(); protected ArrayList<Triangle> triangles = new ArrayList<Triangle>(); protected ArrayList<Vertex> vertices = new ArrayList<Vertex>(); - public static boolean isVBAA(int renderModes) { - return 0 != ( renderModes & Region.VBAA_RENDERING_BIT ); + public static boolean isVBAA(int renderModes) { + return 0 != ( renderModes & Region.VBAA_RENDERING_BIT ); } /** Check if render mode capable of non uniform weights - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, - * {@link Region#VBAA_RENDERING_BIT} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, + * {@link Region#VBAA_RENDERING_BIT} * @return true of capable of non uniform weights */ - public static boolean isNonUniformWeight(int renderModes) { - return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT ); + public static boolean isNonUniformWeight(int renderModes) { + return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT ); } protected Region(int regionRenderModes) { @@ -87,28 +87,28 @@ public abstract class Region { } /** Get current Models - * @return bit-field of render modes + * @return bit-field of render modes */ - public final int getRenderModes() { - return renderModes; + public final int getRenderModes() { + return renderModes; } /** Check if current Region is using VBAA * @return true if capable of two pass rendering - VBAA */ - public boolean isVBAA() { - return Region.isVBAA(renderModes); + public boolean isVBAA() { + return Region.isVBAA(renderModes); } - /** Check if current instance uses non uniform weights + /** Check if current instance uses non uniform weights * @return true if capable of nonuniform weights */ - public boolean isNonUniformWeight() { - return Region.isNonUniformWeight(renderModes); + public boolean isNonUniformWeight() { + return Region.isNonUniformWeight(renderModes); } /** Get the current number of vertices associated - * with this region. This number is not necessary equal to + * with this region. This number is not necessary equal to * the OGL bound number of vertices. * @return vertices count */ @@ -117,10 +117,10 @@ public abstract class Region { } /** Adds a {@link Triangle} object to the Region - * This triangle will be bound to OGL objects + * This triangle will be bound to OGL objects * on the next call to {@code update} * @param tri a triangle object - * + * * @see update(GL2ES2) */ public void addTriangle(Triangle tri) { @@ -129,10 +129,10 @@ public abstract class Region { } /** Adds a list of {@link Triangle} objects to the Region - * These triangles are to be binded to OGL objects + * These triangles are to be binded to OGL objects * on the next call to {@code update} * @param tris an arraylist of triangle objects - * + * * @see update(GL2ES2) */ public void addTriangles(ArrayList<Triangle> tris) { @@ -141,10 +141,10 @@ public abstract class Region { } /** Adds a {@link Vertex} object to the Region - * This vertex will be bound to OGL objects + * This vertex will be bound to OGL objects * on the next call to {@code update} * @param vert a vertex objects - * + * * @see update(GL2ES2) */ public void addVertex(Vertex vert) { @@ -154,10 +154,10 @@ public abstract class Region { } /** Adds a list of {@link Vertex} objects to the Region - * These vertices are to be binded to OGL objects + * These vertices are to be binded to OGL objects * on the next call to {@code update} * @param verts an arraylist of vertex objects - * + * * @see update(GL2ES2) */ public void addVertices(ArrayList<Vertex> verts) { @@ -175,10 +175,10 @@ public abstract class Region { } /** Check if this region is dirty. A region is marked dirty - * when new Vertices, Triangles, and or Lines are added after a + * when new Vertices, Triangles, and or Lines are added after a * call to update() * @return true if region is Dirty, false otherwise - * + * * @see update(GL2ES2) */ public final boolean isDirty() { diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java index 63713887b..dfb7a95b3 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -41,32 +41,32 @@ import jogamp.graph.curve.opengl.RegionFactory; /** A GLRegion is the OGL binding of one or more OutlineShapes
* Defined by its vertices and generated triangles. The Region
- * defines the final shape of the OutlineShape(s), which shall produced a shaded
+ * defines the final shape of the OutlineShape(s), which shall produced a shaded
* region on the screen.
- *
- * Implementations of the GLRegion shall take care of the OGL
+ *
+ * Implementations of the GLRegion shall take care of the OGL
* binding of the depending on its context, profile.
- *
+ *
* @see Region, RegionFactory, OutlineShape
*/
-public abstract class GLRegion extends Region {
-
+public abstract class GLRegion extends Region {
+
/** Create an ogl {@link GLRegion} defining the list of {@link OutlineShape}.
* Combining the Shapes into single buffers.
* @return the resulting Region inclusive the generated region
*/
public static GLRegion create(OutlineShape[] outlineShapes, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
int numVertices = region.getNumVertices();
-
+
for(int index=0; index<outlineShapes.length; index++) {
OutlineShape outlineShape = outlineShapes[index];
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
-
+
ArrayList<Triangle> triangles = outlineShape.triangulate();
region.addTriangles(triangles);
-
+
ArrayList<Vertex> vertices = outlineShape.getVertices();
for(int pos=0; pos < vertices.size(); pos++){
Vertex vert = vertices.get(pos);
@@ -74,42 +74,42 @@ public abstract class GLRegion extends Region { }
region.addVertices(vertices);
}
-
+
return region;
}
- /**
+ /**
* Create an ogl {@link GLRegion} defining this {@link OutlineShape}
* @return the resulting Region.
*/
public static GLRegion create(OutlineShape outlineShape, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate();
ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
region.addVertices(vertices);
region.addTriangles(triangles);
return region;
- }
-
+ }
+
protected GLRegion(int renderModes) {
super(renderModes);
}
-
+
/** Updates a graph region by updating the ogl related
* objects for use in rendering if {@link #isDirty()}.
- * <p>Allocates the ogl related data and initializes it the 1st time.<p>
+ * <p>Allocates the ogl related data and initializes it the 1st time.<p>
* <p>Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.</p>
* @param rs TODO
*/
protected abstract void update(GL2ES2 gl, RenderState rs);
-
+
/** Delete and clean the associated OGL
* objects
*/
public abstract void destroy(GL2ES2 gl, RenderState rs);
-
+
/** Renders the associated OGL objects specifying
* current width/hight of window for multi pass rendering
* of the region.
@@ -117,13 +117,13 @@ public abstract class GLRegion extends Region { * @param rs the RenderState to be used
* @param vp_width current screen width
* @param vp_height current screen height
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
*/
public final void draw(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
update(gl, rs);
drawImpl(gl, rs, vp_width, vp_height, texWidth);
}
-
+
protected abstract void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java index 2f078d7bb..f7d4bfd2f 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -35,26 +35,26 @@ import com.jogamp.graph.curve.Region; public abstract class RegionRenderer extends Renderer { - /** + /** * Create a Hardware accelerated Region Renderer. - * @param rs the used {@link RenderState} - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} + * @param rs the used {@link RenderState} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} * @return an instance of Region Renderer */ public static RegionRenderer create(RenderState rs, int renderModes) { return new jogamp.graph.curve.opengl.RegionRendererImpl01(rs, renderModes); } - + protected RegionRenderer(RenderState rs, int renderModes) { super(rs, renderModes); } - - + + /** Render an {@link OutlineShape} in 3D space at the position provided * the triangles of the shapes will be generated, if not yet generated * @param region the OutlineShape to Render. - * @param position the initial translation of the outlineShape. - * @param texWidth desired texture width for multipass-rendering. + * @param position the initial translation of the outlineShape. + * @param texWidth desired texture width for multipass-rendering. * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. * @throws Exception if HwRegionRenderer not initialized */ @@ -65,10 +65,10 @@ public abstract class RegionRenderer extends Renderer { if( !areRenderModesCompatible(region) ) { throw new GLException("Incompatible render modes, : region modes "+region.getRenderModes()+ " doesn't contain renderer modes "+this.getRenderModes()); - } + } drawImpl(gl, region, position, texWidth); } - + /** * Usually just dispatched the draw call to the Region's draw implementation, * e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int[]) GLRegion#draw(GL2ES2, RenderState, int, int, int[])}. @@ -79,6 +79,6 @@ public abstract class RegionRenderer extends Renderer { protected void destroyImpl(GL2ES2 gl) { // nop } - - + + } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java index 5e305d664..9c833fd24 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -40,7 +40,7 @@ import com.jogamp.opengl.util.glsl.ShaderState; public abstract class RenderState { private static final String thisKey = "jogamp.graph.curve.RenderState" ; - + public static RenderState createRenderState(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) { return new RenderStateImpl(st, pointFactory); } @@ -48,42 +48,42 @@ public abstract class RenderState { public static RenderState createRenderState(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) { return new RenderStateImpl(st, pointFactory, pmvMatrix); } - + public static final RenderState getRenderState(GL2ES2 gl) { return (RenderState) gl.getContext().getAttachedObject(thisKey); } - + protected final ShaderState st; protected final Vertex.Factory<? extends Vertex> vertexFactory; protected final PMVMatrix pmvMatrix; - protected final GLUniformData gcu_PMVMatrix; - + protected final GLUniformData gcu_PMVMatrix; + protected RenderState(ShaderState st, Vertex.Factory<? extends Vertex> vertexFactory, PMVMatrix pmvMatrix) { this.st = st; this.vertexFactory = vertexFactory; - this.pmvMatrix = pmvMatrix; + this.pmvMatrix = pmvMatrix; this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf()); - st.ownUniform(gcu_PMVMatrix); + st.ownUniform(gcu_PMVMatrix); } - + public final ShaderState getShaderState() { return st; } public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; } public final PMVMatrix pmvMatrix() { return pmvMatrix; } public final GLUniformData getPMVMatrix() { return gcu_PMVMatrix; } - + public void destroy(GL2ES2 gl) { st.destroy(gl); } - + public abstract GLUniformData getWeight(); public abstract GLUniformData getAlpha(); public abstract GLUniformData getColorStatic(); // public abstract GLUniformData getStrength(); - + public final RenderState attachTo(GL2ES2 gl) { return (RenderState) gl.getContext().attachObject(thisKey, this); } - + public final boolean detachFrom(GL2ES2 gl) { RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey); if(_rs == this) { @@ -91,8 +91,8 @@ public abstract class RenderState { return true; } return false; - } - + } + public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) { if(null==sb) { sb = new StringBuilder(); @@ -104,8 +104,8 @@ public abstract class RenderState { return sb; } - + public String toString() { return toString(null, false).toString(); - } + } } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java index 998129551..c642fb652 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java @@ -52,8 +52,8 @@ public abstract class Renderer { protected int vp_height; protected boolean initialized; protected final RenderState rs; - private boolean vboSupported = false; - + private boolean vboSupported = false; + public final boolean isInitialized() { return initialized; } public final int getWidth() { return vp_width; } @@ -62,29 +62,29 @@ public abstract class Renderer { public float getWeight() { return rs.getWeight().floatValue(); } public float getAlpha() { return rs.getAlpha().floatValue(); } public final PMVMatrix getMatrix() { return rs.pmvMatrix(); } - + /** * Implementation shall load, compile and link the shader program and leave it active. * @param gl referencing the current GLContext to which the ShaderState is bound to * @return */ protected abstract boolean initShaderProgram(GL2ES2 gl); - + protected abstract void destroyImpl(GL2ES2 gl); - + /** - * @param rs the used {@link RenderState} + * @param rs the used {@link RenderState} * @param renderModes bit-field of modes */ protected Renderer(RenderState rs, int renderModes) { this.rs = rs; this.renderModes = renderModes; } - + public final int getRenderModes() { return renderModes; } - + public boolean usesVariableCurveWeight() { return Region.isNonUniformWeight(renderModes); } /** @@ -93,17 +93,17 @@ public abstract class Renderer { */ public final boolean areRenderModesCompatible(Region region) { final int cleanRenderModes = getRenderModes() & ( Region.VARIABLE_CURVE_WEIGHT_BIT ); - return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes ); + return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes ); } - + public final boolean isVBOSupported() { return vboSupported; } - - /** + + /** * Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext * if not initialized yet. * <p>Leaves the renderer enabled, ie ShaderState.</p> * <p>Shall be called by a {@code draw()} method, e.g. {@link RegionRenderer#draw(GL2ES2, Region, float[], int)}</p> - * + * * @param gl referencing the current GLContext to which the ShaderState is bound to * @throws GLException if initialization failed */ @@ -117,48 +117,48 @@ public abstract class Renderer { gl.isFunctionAvailable("glDrawElements") && gl.isFunctionAvailable("glVertexAttribPointer") && gl.isFunctionAvailable("glDeleteBuffers"); - + if(DEBUG) { System.err.println("TextRendererImpl01: VBO Supported = " + isVBOSupported()); } - + if(!vboSupported){ throw new GLException("VBO not supported"); } - + rs.attachTo(gl); - + gl.glEnable(GL2ES2.GL_BLEND); gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); // FIXME: alpha blending stage ? - + initialized = initShaderProgram(gl); if(!initialized) { throw new GLException("Shader initialization failed"); } - + if(!rs.getShaderState().uniform(gl, rs.getPMVMatrix())) { throw new GLException("Error setting PMVMatrix in shader: "+rs.getShaderState()); } - + if( Region.isNonUniformWeight( getRenderModes() ) ) { if(!rs.getShaderState().uniform(gl, rs.getWeight())) { throw new GLException("Error setting weight in shader: "+rs.getShaderState()); } } - + if(!rs.getShaderState().uniform(gl, rs.getAlpha())) { throw new GLException("Error setting global alpha in shader: "+rs.getShaderState()); - } - + } + if(!rs.getShaderState().uniform(gl, rs.getColorStatic())) { throw new GLException("Error setting global color in shader: "+rs.getShaderState()); - } + } } - public final void flushCache(GL2ES2 gl) { + public final void flushCache(GL2ES2 gl) { // FIXME: REMOVE ! } - + public void destroy(GL2ES2 gl) { if(!initialized){ if(DEBUG_INSTANCE) { @@ -169,13 +169,13 @@ public abstract class Renderer { rs.getShaderState().useProgram(gl, false); destroyImpl(gl); rs.destroy(gl); - initialized = false; + initialized = false; } - + public final RenderState getRenderState() { return rs; } public final ShaderState getShaderState() { return rs.getShaderState(); } - - public final void enable(GL2ES2 gl, boolean enable) { + + public final void enable(GL2ES2 gl, boolean enable) { rs.getShaderState().useProgram(gl, enable); } @@ -188,7 +188,7 @@ public abstract class Renderer { rs.getShaderState().uniform(gl, rs.getWeight()); } } - + public void setAlpha(GL2ES2 gl, float alpha_t) { rs.getAlpha().setData(alpha_t); if(null != gl && rs.getShaderState().inUse()) { @@ -199,11 +199,11 @@ public abstract class Renderer { public void getColorStatic(GL2ES2 gl, float[] rgb) { FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer(); - rgb[0] = fb.get(0); - rgb[1] = fb.get(1); - rgb[2] = fb.get(2); + rgb[0] = fb.get(0); + rgb[1] = fb.get(1); + rgb[2] = fb.get(2); } - + public void setColorStatic(GL2ES2 gl, float r, float g, float b){ FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer(); fb.put(0, r); @@ -213,7 +213,7 @@ public abstract class Renderer { rs.getShaderState().uniform(gl, rs.getColorStatic()); } } - + public void rotate(GL2ES2 gl, float angle, float x, float y, float z) { rs.pmvMatrix().glRotatef(angle, x, y, z); updateMatrix(gl); @@ -223,7 +223,7 @@ public abstract class Renderer { rs.pmvMatrix().glTranslatef(x, y, z); updateMatrix(gl); } - + public void scale(GL2ES2 gl, float x, float y, float z) { rs.pmvMatrix().glScalef(x, y, z); updateMatrix(gl); @@ -261,15 +261,15 @@ public abstract class Renderer { p.glLoadIdentity(); p.glOrthof(0, width, 0, height, near, far); updateMatrix(gl); - return true; + return true; } protected String getVertexShaderName() { return "curverenderer" + getImplVersion(); } - + protected String getFragmentShaderName() { - final String version = getImplVersion(); + final String version = getImplVersion(); final String pass = Region.isVBAA(renderModes) ? "-2pass" : "-1pass" ; final String weight = Region.isNonUniformWeight(renderModes) ? "-weight" : "" ; return "curverenderer" + version + pass + weight; @@ -277,7 +277,7 @@ public abstract class Renderer { // FIXME: Really required to have sampler2D def. precision ? If not, we can drop getFragmentShaderPrecision(..) and use default ShaderCode .. public static final String es2_precision_fp = "\nprecision mediump float;\nprecision mediump int;\nprecision mediump sampler2D;\n"; - + protected String getFragmentShaderPrecision(GL2ES2 gl) { if( gl.isGLES2() ) { return es2_precision_fp; @@ -287,7 +287,7 @@ public abstract class Renderer { } return null; } - + protected String getImplVersion() { return "01"; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java index 8dc41b0c0..f6ce852d8 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java @@ -38,28 +38,28 @@ import jogamp.graph.curve.text.GlyphString; import com.jogamp.graph.font.Font; public abstract class TextRenderer extends Renderer { - /** + /** * Create a Hardware accelerated Text Renderer. - * @param rs the used {@link RenderState} + * @param rs the used {@link RenderState} * @param renderModes either {@link com.jogamp.graph.curve.opengl.GLRegion#SINGLE_PASS} or {@link com.jogamp.graph.curve.Region#VBAA_RENDERING_BIT} */ public static TextRenderer create(RenderState rs, int renderModes) { return new jogamp.graph.curve.opengl.TextRendererImpl01(rs, renderModes); } - + protected TextRenderer(RenderState rs, int type) { super(rs, type); } - + /** Render the String in 3D space wrt to the font provided at the position provided * the outlines will be generated, if not yet generated * @param gl the current GL state * @param font {@link Font} to be used - * @param str text to be rendered - * @param position the lower left corner of the string + * @param str text to be rendered + * @param position the lower left corner of the string * @param fontSize font size - * @param texWidth desired texture width for multipass-rendering. + * @param texWidth desired texture width for multipass-rendering. * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. * @throws Exception if TextRenderer not initialized */ @@ -77,11 +77,11 @@ public abstract class TextRenderer extends Renderer { if(DEBUG_INSTANCE) { System.err.println("createString: "+getCacheSize()+"/"+getCacheLimit()+" - "+Font.NAME_UNIQUNAME + " - " + str + " - " + size); } - final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str); - glyphString.createRegion(gl, renderModes); + final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str); + glyphString.createRegion(gl, renderModes); return glyphString; } - + /** FIXME public void flushCache(GL2ES2 gl) { Iterator<GlyphString> iterator = stringCacheMap.values().iterator(); @@ -89,10 +89,10 @@ public abstract class TextRenderer extends Renderer { GlyphString glyphString = iterator.next(); glyphString.destroy(gl, rs); } - stringCacheMap.clear(); + stringCacheMap.clear(); stringCacheArray.clear(); } */ - + @Override protected void destroyImpl(GL2ES2 gl) { // fluchCache(gl) already called @@ -101,42 +101,42 @@ public abstract class TextRenderer extends Renderer { GlyphString glyphString = iterator.next(); glyphString.destroy(gl, rs); } - stringCacheMap.clear(); + stringCacheMap.clear(); stringCacheArray.clear(); } - + /** * <p>Sets the cache limit for reusing GlyphString's and their Region. * Default is {@link #DEFAULT_CACHE_LIMIT}, -1 unlimited, 0 turns cache off, >0 limited </p> - * + * * <p>The cache will be validate when the next string rendering happens.</p> - * + * * @param newLimit new cache size - * + * * @see #DEFAULT_CACHE_LIMIT */ public final void setCacheLimit(int newLimit ) { stringCacheLimit = newLimit; } - + /** * Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache. - * + * * @see #setCacheLimit(int) - * + * * @param gl current GL used to remove cached objects if required * @param newLimit new cache size */ public final void setCacheLimit(GL2ES2 gl, int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); } - + /** * @return the current cache limit */ public final int getCacheLimit() { return stringCacheLimit; } - - /** + + /** * @return the current utilized cache size, <= {@link #getCacheLimit()} */ public final int getCacheSize() { return stringCacheArray.size(); } - + protected final void validateCache(GL2ES2 gl, int space) { if ( getCacheLimit() > 0 ) { while ( getCacheSize() + space > getCacheLimit() ) { @@ -144,7 +144,7 @@ public abstract class TextRenderer extends Renderer { } } } - + protected final GlyphString getCachedGlyphString(Font font, String str, int fontSize) { return stringCacheMap.get(getKey(font, str, fontSize)); } @@ -160,13 +160,13 @@ public abstract class TextRenderer extends Renderer { } /// else overwrite is nop .. } } - + protected final void removeCachedGlyphString(GL2ES2 gl, Font font, String str, int fontSize) { final String key = getKey(font, str, fontSize); GlyphString glyphString = stringCacheMap.remove(key); if(null != glyphString) { glyphString.destroy(gl, rs); - } + } stringCacheArray.remove(key); } @@ -177,7 +177,7 @@ public abstract class TextRenderer extends Renderer { glyphString.destroy(gl, rs); } } - + protected final String getKey(Font font, String str, int fontSize) { final StringBuilder sb = new StringBuilder(); return font.getName(sb, Font.NAME_UNIQUNAME) @@ -186,8 +186,8 @@ public abstract class TextRenderer extends Renderer { /** Default cache limit, see {@link #setCacheLimit(int)} */ public static final int DEFAULT_CACHE_LIMIT = 256; - + private HashMap<String, GlyphString> stringCacheMap = new HashMap<String, GlyphString>(DEFAULT_CACHE_LIMIT); private ArrayList<String> stringCacheArray = new ArrayList<String>(DEFAULT_CACHE_LIMIT); - private int stringCacheLimit = DEFAULT_CACHE_LIMIT; + private int stringCacheLimit = DEFAULT_CACHE_LIMIT; }
\ No newline at end of file diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java index 7728efcaf..ae2849536 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java +++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java @@ -33,7 +33,7 @@ import jogamp.graph.curve.tess.CDTriangulator2D; public class Triangulation { /** Create a new instance of a triangulation. - * Currently only a modified version of Constraint Delaunay + * Currently only a modified version of Constraint Delaunay * is implemented. * @return instance of a triangulator * @see Triangulator diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java index 1ffaccebc..4e8c400e0 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java +++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java @@ -36,32 +36,32 @@ import com.jogamp.graph.geom.Triangle; /** Interface to the triangulation algorithms provided * A triangulation of 2D outlines where you can * provides an easy one or more outlines to be triangulated - * + * * example usage: * addCurve(o1); * addCurve(o2); * addCurve(o3); * generate(); * reset(); - * + * * @see Outline * @see Triangulation */ public interface Triangulator { - + /** Add a curve to the list of Outlines * describing the shape * @param outline a bounding {@link Outline} */ public void addCurve(Outline outline); - - /** Generate the triangulation of the provided + + /** Generate the triangulation of the provided * List of {@link Outline}s * @return an arraylist of {@link Triangle}s resembling the * final shape. */ public ArrayList<Triangle> generate(); - + /** Reset the triangulation to initial state * Clearing cached data */ diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java index 64a3a3e6c..82211da92 100644 --- a/src/jogl/classes/com/jogamp/graph/font/Font.java +++ b/src/jogl/classes/com/jogamp/graph/font/Font.java @@ -31,10 +31,10 @@ import com.jogamp.opengl.math.geom.AABBox; /** * Interface wrapper for font implementation. - * + * * TrueType Font Specification: * http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html - * + * * TrueType Font Table Introduction: * http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08 */ @@ -50,22 +50,22 @@ public interface Font { public static final int NAME_VERSION = 5; public static final int NAME_MANUFACTURER = 8; public static final int NAME_DESIGNER = 9; - - + + /** * Metrics for font - * + * * Depending on the font's direction, horizontal or vertical, * the following tables shall be used: - * + * * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html * Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html */ - public interface Metrics { + public interface Metrics { float getAscent(float pixelSize); float getDescent(float pixelSize); float getLineGap(float pixelSize); - float getMaxExtend(float pixelSize); + float getMaxExtend(float pixelSize); float getScale(float pixelSize); AABBox getBBox(float pixelSize); } @@ -74,12 +74,12 @@ public interface Font { * Glyph for font */ public interface Glyph { - // reserved special glyph IDs + // reserved special glyph IDs // http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08#ba57949e public static final int ID_UNKNOWN = 0; public static final int ID_CR = 2; public static final int ID_SPACE = 3; - + public Font getFont(); public char getSymbol(); public AABBox getBBox(float pixelSize); @@ -89,25 +89,25 @@ public interface Font { public String getName(int nameIndex); public StringBuilder getName(StringBuilder string, int nameIndex); - + /** Shall return the family and subfamily name, separated a dash. * <p>{@link #getName(StringBuilder, int)} w/ {@link #NAME_FAMILY} and {@link #NAME_SUBFAMILY}</p> * <p>Example: "{@code Ubuntu-Regular}"</p> */ public StringBuilder getFullFamilyName(StringBuilder buffer); - + public StringBuilder getAllNames(StringBuilder string, String separator); - + public float getAdvanceWidth(int i, float pixelSize); public Metrics getMetrics(); public Glyph getGlyph(char symbol); public int getNumGlyphs(); - + public float getStringWidth(CharSequence string, float pixelSize); public float getStringHeight(CharSequence string, float pixelSize); public AABBox getStringBounds(CharSequence string, float pixelSize); - - public boolean isPrintableChar( char c ); - + + public boolean isPrintableChar( char c ); + /** Shall return {@link #getFullFamilyName()} */ public String toString(); }
\ No newline at end of file diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index d2824b9dc..884662e6e 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -49,13 +49,13 @@ import jogamp.graph.font.UbuntuFontLoader; public class FontFactory { private static final String FontConstructorPropKey = "jogamp.graph.font.ctor"; private static final String DefaultFontConstructor = "jogamp.graph.font.typecast.TypecastFontConstructor"; - + /** Ubuntu is the default font family */ public static final int UBUNTU = 0; - + /** Java fonts are optional */ public static final int JAVA = 1; - + private static final FontConstructor fontConstr; static { @@ -63,18 +63,18 @@ public class FontFactory { * For example: * "jogamp.graph.font.typecast.TypecastFontFactory" (default) * "jogamp.graph.font.ttf.TTFFontImpl" - */ + */ String fontImplName = PropertyAccess.getProperty(FontConstructorPropKey, true); if(null == fontImplName) { fontImplName = DefaultFontConstructor; } fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader()); } - + public static final FontSet getDefault() { return get(UBUNTU); } - + public static final FontSet get(int font) { switch (font) { case JAVA: @@ -83,15 +83,15 @@ public class FontFactory { return UbuntuFontLoader.get(); } } - + public static final Font get(File file) throws IOException { return fontConstr.create(file); } public static final Font get(final URLConnection conn) throws IOException { return fontConstr.create(conn); - } - + } + public static boolean isPrintableChar( char c ) { if( Character.isWhitespace(c) ) { return true; @@ -101,5 +101,5 @@ public class FontFactory { } final Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); return block != null && block != Character.UnicodeBlock.SPECIALS; - } + } } diff --git a/src/jogl/classes/com/jogamp/graph/font/FontSet.java b/src/jogl/classes/com/jogamp/graph/font/FontSet.java index d376922ab..17b8b2136 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontSet.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontSet.java @@ -34,29 +34,29 @@ public interface FontSet { /** Font family REGULAR **/ public static final int FAMILY_REGULAR = 0; - + /** Font family LIGHT **/ public static final int FAMILY_LIGHT = 1; - + /** Font family MEDIUM **/ public static final int FAMILY_MEDIUM = 2; - + /** Font family CONDENSED **/ public static final int FAMILY_CONDENSED = 3; - + /** Font family MONO **/ public static final int FAMILY_MONOSPACED = 4; - + /** SERIF style/family bit flag. Fallback to Sans Serif. */ public static final int STYLE_SERIF = 1 << 1; - + /** BOLD style bit flag */ public static final int STYLE_BOLD = 1 << 2; - + /** ITALIC style bit flag */ public static final int STYLE_ITALIC = 1 << 3; Font getDefault() throws IOException ; - + Font get(int family, int stylebits) throws IOException ; } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java index 12c45860b..dfa6a8635 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java @@ -36,12 +36,12 @@ import com.jogamp.opengl.math.geom.AABBox; /** Define a single continuous stroke by control vertices. - * The vertices define the shape of the region defined by this + * The vertices define the shape of the region defined by this * outline. The Outline can contain a list of off-curve and on-curve * vertices which define curved regions. - * + * * Note: An outline should be closed to be rendered as a region. - * + * * @see OutlineShape, Region */ public class Outline implements Cloneable, Comparable<Outline> { @@ -55,7 +55,7 @@ public class Outline implements Cloneable, Comparable<Outline> { * An outline can contain off Curve vertices which define curved * regions in the outline. */ - public Outline() { + public Outline() { } public final int getVertexCount() { @@ -64,7 +64,7 @@ public class Outline implements Cloneable, Comparable<Outline> { /** Appends a vertex to the outline loop/strip. * @param vertex Vertex to be added - * @throws NullPointerException if the {@link Vertex} element is null + * @throws NullPointerException if the {@link Vertex} element is null */ public final void addVertex(Vertex vertex) throws NullPointerException { addVertex(vertices.size(), vertex); @@ -73,7 +73,7 @@ public class Outline implements Cloneable, Comparable<Outline> { /** Insert the {@link Vertex} element at the given {@code position} to the outline loop/strip. * @param position of the added Vertex * @param vertex Vertex object to be added - * @throws NullPointerException if the {@link Vertex} element is null + * @throws NullPointerException if the {@link Vertex} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getVertexNumber()) */ public final void addVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { @@ -88,10 +88,10 @@ public class Outline implements Cloneable, Comparable<Outline> { /** Replaces the {@link Vertex} element at the given {@code position}. * <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p> - * + * * @param position of the replaced Vertex - * @param vertex replacement Vertex object - * @throws NullPointerException if the {@link Outline} element is null + * @param vertex replacement Vertex object + * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber()) */ public final void setVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { @@ -112,12 +112,12 @@ public class Outline implements Cloneable, Comparable<Outline> { /** Removes the {@link Vertex} element at the given {@code position}. * <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p> - * + * * @param position of the to be removed Vertex * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber()) */ public final Vertex removeVertex(int position) throws IndexOutOfBoundsException { - dirtyBBox = true; + dirtyBBox = true; return vertices.remove(position); } @@ -139,7 +139,7 @@ public class Outline implements Cloneable, Comparable<Outline> { /** * Use the given outline loop/strip. * <p>Validates the bounding box.</p> - * + * * @param vertices the new outline loop/strip */ public final void setVertices(ArrayList<Vertex> vertices) { @@ -152,7 +152,7 @@ public class Outline implements Cloneable, Comparable<Outline> { } /** define if this outline is closed or not. - * if set to closed, checks if the last vertex is + * if set to closed, checks if the last vertex is * equal to the first vertex. If not Equal adds a * vertex at the end to the list. * @param closed @@ -170,7 +170,7 @@ public class Outline implements Cloneable, Comparable<Outline> { } /** Compare two outlines with Bounding Box area - * as criteria. + * as criteria. * @see java.lang.Comparable#compareTo(java.lang.Object) */ public final int compareTo(Outline outline) { @@ -198,11 +198,11 @@ public class Outline implements Cloneable, Comparable<Outline> { validateBoundingBox(); } return bbox; - } + } /** * @param obj the Object to compare this Outline with - * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order + * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order */ public boolean equals(Object obj) { if( obj == this) { @@ -210,7 +210,7 @@ public class Outline implements Cloneable, Comparable<Outline> { } if( null == obj || !(obj instanceof Outline) ) { return false; - } + } final Outline o = (Outline) obj; if(getVertexCount() != o.getVertexCount()) { return false; @@ -240,5 +240,5 @@ public class Outline implements Cloneable, Comparable<Outline> { o.vertices.add(vertices.get(i).clone()); } return o; - } + } } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java index fb34de221..bd0900495 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java @@ -48,11 +48,11 @@ public class Triangle { public Vertex[] getVertices() { return vertices; } - + public boolean isEdgesBoundary() { return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2]; } - + public boolean isVerticesBoundary() { return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2]; } @@ -60,11 +60,11 @@ public class Triangle { public void setEdgesBoundary(boolean[] boundary) { this.boundaryEdges = boundary; } - + public boolean[] getEdgeBoundary() { return boundaryEdges; } - + public boolean[] getVerticesBoundary() { return boundaryVertices; } @@ -72,7 +72,7 @@ public class Triangle { public void setVerticesBoundary(boolean[] boundaryVertices) { this.boundaryVertices = boundaryVertices; } - + public String toString() { return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2]; } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java index e3df86de1..40048235e 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java @@ -30,7 +30,7 @@ package com.jogamp.graph.geom; import com.jogamp.opengl.math.Vert3fImmutable; /** - * A Vertex with custom memory layout using custom factory. + * A Vertex with custom memory layout using custom factory. */ public interface Vertex extends Vert3fImmutable, Cloneable { @@ -39,16 +39,16 @@ public interface Vertex extends Vert3fImmutable, Cloneable { T create(float x, float y, float z, boolean onCurve); - T create(float[] coordsBuffer, int offset, int length, boolean onCurve); + T create(float[] coordsBuffer, int offset, int length, boolean onCurve); } - + void setCoord(float x, float y, float z); /** * @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException */ void setCoord(float[] coordsBuffer, int offset, int length); - + void setX(float x); void setY(float y); @@ -60,24 +60,24 @@ public interface Vertex extends Vert3fImmutable, Cloneable { void setOnCurve(boolean onCurve); int getId(); - + void setId(int id); - + float[] getTexCoord(); - + void setTexCoord(float s, float t); - + /** * @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException */ void setTexCoord(float[] texCoordsBuffer, int offset, int length); - + /** * @param obj the Object to compare this Vertex with - * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords. + * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords. */ boolean equals(Object obj); - + /** * @return deep clone of this Vertex */ diff --git a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java index 97e438b63..6b07688a7 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java @@ -39,11 +39,11 @@ public class SVertex implements Vertex { protected float[] coord = new float[3]; protected boolean onCurve; private float[] texCoord = new float[2]; - + static final Factory factory = new Factory(); - - public static Factory factory() { return factory; } - + + public static Factory factory() { return factory; } + public static class Factory implements Vertex.Factory<SVertex> { public SVertex create() { return new SVertex(); @@ -55,9 +55,9 @@ public class SVertex implements Vertex { public SVertex create(float[] coordsBuffer, int offset, int length, boolean onCurve) { return new SVertex(coordsBuffer, offset, length, onCurve); - } + } } - + public SVertex() { } @@ -65,19 +65,19 @@ public class SVertex implements Vertex { setCoord(x, y, z); setOnCurve(onCurve); } - + public SVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) { setCoord(coordsBuffer, offset, length); setOnCurve(onCurve); } - - public SVertex(float[] coordsBuffer, int offset, int length, + + public SVertex(float[] coordsBuffer, int offset, int length, float[] texCoordsBuffer, int offsetTC, int lengthTC, boolean onCurve) { setCoord(coordsBuffer, offset, length); setTexCoord(texCoordsBuffer, offsetTC, lengthTC); setOnCurve(onCurve); } - + public final void setCoord(float x, float y, float z) { this.coord[0] = x; this.coord[1] = y; @@ -87,12 +87,12 @@ public class SVertex implements Vertex { public final void setCoord(float[] coordsBuffer, int offset, int length) { System.arraycopy(coordsBuffer, offset, coord, 0, length); } - + @Override public int getCoordCount() { return 3; } - + @Override public final float[] getCoord() { return coord; @@ -133,11 +133,11 @@ public class SVertex implements Vertex { public final int getId(){ return id; } - + public final void setId(int id){ this.id = id; } - + public boolean equals(Object obj) { if( obj == this) { return true; @@ -146,12 +146,12 @@ public class SVertex implements Vertex { return false; } final Vertex v = (Vertex) obj; - return this == v || - isOnCurve() == v.isOnCurve() && + return this == v || + isOnCurve() == v.isOnCurve() && VectorUtil.checkEqualityVec2(getTexCoord(), v.getTexCoord()) && VectorUtil.checkEquality(getCoord(), v.getCoord()) ; } - + public final float[] getTexCoord() { return texCoord; } @@ -164,16 +164,16 @@ public class SVertex implements Vertex { public final void setTexCoord(float[] texCoordsBuffer, int offset, int length) { System.arraycopy(texCoordsBuffer, offset, texCoord, 0, length); } - + /** * @return deep clone of this Vertex, but keeping the id blank */ public SVertex clone(){ return new SVertex(this.coord, 0, 3, this.texCoord, 0, 2, this.onCurve); } - + public String toString() { - return "[ID: " + id + ", onCurve: " + onCurve + + return "[ID: " + id + ", onCurve: " + onCurve + ": p " + coord[0] + ", " + coord[1] + ", " + coord[2] + ", t " + texCoord[0] + ", " + texCoord[1] + "]"; } diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 7060bb7d1..c78b2b83d 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -46,7 +46,7 @@ import com.jogamp.opengl.FBObject.Attachment.Type; /** * Core utility class simplifying usage of framebuffer objects (FBO) - * with all {@link GLProfile}s. + * with all {@link GLProfile}s. * <p> * Supports on-the-fly reconfiguration of dimension and multisample buffers via {@link #reset(GL, int, int, int, boolean)} * while preserving the {@link Attachment} references. @@ -55,50 +55,50 @@ import com.jogamp.opengl.FBObject.Attachment.Type; * Integrates default read/write framebuffers via {@link GLContext#getDefaultReadFramebuffer()} and {@link GLContext#getDefaultReadFramebuffer()}, * which is being hooked at {@link GL#glBindFramebuffer(int, int)} when the default (<code>zero</code>) framebuffer is selected. * </p> - * + * * <p>FIXME: Implement support for {@link Type#DEPTH_TEXTURE}, {@link Type#STENCIL_TEXTURE} .</p> */ public class FBObject { protected static final boolean DEBUG = Debug.debug("FBObject"); private static final boolean FBOResizeQuirk = false; - + private static enum DetachAction { NONE, DISPOSE, RECREATE }; - - /** + + /** * Marker interface, denotes a color buffer attachment. * <p>Always an instance of {@link Attachment}.</p> - * <p>Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.</b> + * <p>Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.</b> */ - public static interface Colorbuffer { - /** + public static interface Colorbuffer { + /** * Initializes the color buffer and set it's parameter, if uninitialized, i.e. name is <code>zero</code>. * @return <code>true</code> if newly initialized, otherwise <code>false</code>. - * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case. + * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case. */ public boolean initialize(GL gl) throws GLException; - - /** + + /** * Releases the color buffer if initialized, i.e. name is not <code>zero</code>. - * @throws GLException if buffer release fails. + * @throws GLException if buffer release fails. */ public void free(GL gl) throws GLException; - + /** * Writes the internal format to the given GLCapabilities object. * @param caps the destination for format bits * @param rgba8Avail whether rgba8 is available */ - public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail); + public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail); } - + /** Common super class of all attachments */ public static abstract class Attachment { - public enum Type { + public enum Type { NONE, DEPTH, STENCIL, DEPTH_STENCIL, COLOR, COLOR_TEXTURE, DEPTH_TEXTURE, STENCIL_TEXTURE; - - /** + + /** * Returns {@link #COLOR}, {@link #DEPTH}, {@link #STENCIL} or {@link #DEPTH_STENCIL} - * @throws IllegalArgumentException if <code>format</code> cannot be handled. + * @throws IllegalArgumentException if <code>format</code> cannot be handled. */ public static Type determine(int format) throws IllegalArgumentException { switch(format) { @@ -120,20 +120,20 @@ public class FBObject { return Type.DEPTH_STENCIL; default: throw new IllegalArgumentException("format invalid: "+toHexString(format)); - } + } } }; - + /** immutable type [{@link #COLOR}, {@link #DEPTH}, {@link #STENCIL}, {@link #COLOR_TEXTURE}, {@link #DEPTH_TEXTURE}, {@link #STENCIL_TEXTURE} ] */ public final Type type; - + /** immutable the internal format */ public final int format; - + private int width, height; - + private int name; - + protected Attachment(Type type, int iFormat, int width, int height, int name) { this.type = type; this.format = iFormat; @@ -141,18 +141,18 @@ public class FBObject { this.height = height; this.name = name; } - + /** * Writes the internal format to the given GLCapabilities object. * @param caps the destination for format bits * @param rgba8Avail whether rgba8 is available */ - public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) { + public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) { final int _format; switch(format) { case GL.GL_RGBA: case 4: - _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4; + _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4; break; case GL.GL_RGB: case 3: @@ -191,7 +191,7 @@ public class FBObject { caps.setGreenBits(8); caps.setBlueBits(8); caps.setAlphaBits(8); - break; + break; case GL.GL_DEPTH_COMPONENT16: caps.setDepthBits(16); break; @@ -218,18 +218,18 @@ public class FBObject { throw new IllegalArgumentException("format invalid: "+toHexString(format)); } } - + /** width of attachment */ public final int getWidth() { return width; } /** height of attachment */ public final int getHeight() { return height; } /* pp */ final void setSize(int w, int h) { width = w; height = h; } - + /** buffer name [1..max], maybe a texture or renderbuffer name, depending on type. */ - public final int getName() { return name; } + public final int getName() { return name; } /* pp */ final void setName(int n) { name = n; } - - /** + + /** * Initializes the attachment and set it's parameter, if uninitialized, i.e. name is <code>zero</code>. * <pre> final boolean init = 0 == name; @@ -239,11 +239,11 @@ public class FBObject { return init; * </pre> * @return <code>true</code> if newly initialized, otherwise <code>false</code>. - * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case. + * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case. */ public abstract boolean initialize(GL gl) throws GLException; - - /** + + /** * Releases the attachment if initialized, i.e. name is not <code>zero</code>. * <pre> if(0 != name) { @@ -251,10 +251,10 @@ public class FBObject { name = 0; } * </pre> - * @throws GLException if buffer release fails. + * @throws GLException if buffer release fails. */ public abstract void free(GL gl) throws GLException; - + /** * <p> * Comparison by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}. @@ -272,7 +272,7 @@ public class FBObject { height== a.height && name == a.name ; } - + /** * <p> * Hashed by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}. @@ -289,14 +289,14 @@ public class FBObject { hash = ((hash << 5) - hash) + name; return hash; } - + int objectHashCode() { return super.hashCode(); } - + public String toString() { return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", "+width+"x"+height+ "; name "+toHexString(name)+", obj "+toHexString(objectHashCode())+"]"; } - + public static Type getType(int attachmentPoint, int maxColorAttachments) { if( GL.GL_COLOR_ATTACHMENT0 <= attachmentPoint && attachmentPoint < GL.GL_COLOR_ATTACHMENT0+maxColorAttachments ) { return Type.COLOR; @@ -304,9 +304,9 @@ public class FBObject { switch(attachmentPoint) { case GL.GL_DEPTH_ATTACHMENT: return Type.DEPTH; - case GL.GL_STENCIL_ATTACHMENT: + case GL.GL_STENCIL_ATTACHMENT: return Type.STENCIL; - default: + default: throw new IllegalArgumentException("Invalid attachment point "+toHexString(attachmentPoint)); } } @@ -315,7 +315,7 @@ public class FBObject { /** Other renderbuffer attachment which maybe a colorbuffer, depth or stencil. */ public static class RenderAttachment extends Attachment { private int samples; - + /** * @param type allowed types are {@link Type#DEPTH_STENCIL} {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#COLOR} * @param iFormat @@ -328,11 +328,11 @@ public class FBObject { super(validateType(type), iFormat, width, height, name); this.samples = samples; } - + /** number of samples, or zero for no multisampling */ public final int getSamples() { return samples; } /* pp */ final void setSamples(int s) { samples = s; } - + private static Type validateType(Type type) { switch(type) { case DEPTH_STENCIL: @@ -340,11 +340,11 @@ public class FBObject { case STENCIL: case COLOR: return type; - default: + default: throw new IllegalArgumentException("Invalid type: "+type); } } - + /** * <p> * Comparison by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}. @@ -358,7 +358,7 @@ public class FBObject { return super.equals(o) && samples == ((RenderAttachment)o).samples; } - + /** * <p> * Hashed by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}. @@ -378,14 +378,14 @@ public class FBObject { final boolean init = 0 == getName(); if( init ) { checkPreGLError(gl); - + final int[] name = new int[] { -1 }; gl.glGenRenderbuffers(1, name, 0); setName(name[0]); - + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, getName()); if( samples > 0 ) { - ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight()); + ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight()); } else { gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight()); } @@ -401,7 +401,7 @@ public class FBObject { } return init; } - + @Override public void free(GL gl) { final int[] name = new int[] { getName() }; @@ -413,20 +413,20 @@ public class FBObject { setName(0); } } - + public String toString() { return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", samples "+samples+", "+getWidth()+"x"+getHeight()+ ", name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]"; } } - + /** Color render buffer attachment */ public static class ColorAttachment extends RenderAttachment implements Colorbuffer { public ColorAttachment(int iFormat, int samples, int width, int height, int name) { super(Type.COLOR, iFormat, samples, width, height, name); - } + } } - + /** Texture attachment */ public static class TextureAttachment extends Attachment implements Colorbuffer { /** details of the texture setup */ @@ -445,7 +445,7 @@ public class FBObject { * @param wrapT * @param name */ - public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType, + public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType, int magFilter, int minFilter, int wrapS, int wrapT, int name) { super(validateType(type), iFormat, width, height, name); this.dataFormat = dataFormat; @@ -455,35 +455,35 @@ public class FBObject { this.wrapS = wrapS; this.wrapT = wrapT; } - + private static Type validateType(Type type) { switch(type) { case COLOR_TEXTURE: case DEPTH_TEXTURE: case STENCIL_TEXTURE: return type; - default: + default: throw new IllegalArgumentException("Invalid type: "+type); } } - - /** + + /** * Initializes the texture and set it's parameter, if uninitialized, i.e. name is <code>zero</code>. - * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case. + * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case. */ @Override public boolean initialize(GL gl) throws GLException { final boolean init = 0 == getName(); if( init ) { checkPreGLError(gl); - - final int[] name = new int[] { -1 }; + + final int[] name = new int[] { -1 }; gl.glGenTextures(1, name, 0); if(0 == name[0]) { throw new GLException("null texture, "+this); } setName(name[0]); - + gl.glBindTexture(GL.GL_TEXTURE_2D, name[0]); if( 0 < magFilter ) { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, magFilter); @@ -495,7 +495,7 @@ public class FBObject { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, wrapS); } if( 0 < wrapT ) { - gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT); + gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT); } boolean preTexImage2D = true; int glerr = gl.glGetError(); @@ -534,50 +534,50 @@ public class FBObject { "; min/mag "+toHexString(minFilter)+"/"+toHexString(magFilter)+ ", wrap S/T "+toHexString(wrapS)+"/"+toHexString(wrapT)+ "; name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]"; - } + } } static String toHexString(int v) { return "0x"+Integer.toHexString(v); } - + /** - * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}, + * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}, * selecting the texture data type and format automatically. - * + * * <p>Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.</p> - * + * * @param glp the chosen {@link GLProfile} * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; - * @param width texture width + * @param width texture width * @param height texture height * @return the created and uninitialized color {@link TextureAttachment} */ public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height) { return createColorTextureAttachment(glp, alpha, width, height, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); } - + /** - * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}, + * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}, * selecting the texture data type and format automatically. - * + * * @param glp the chosen {@link GLProfile} * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; - * @param width texture width + * @param width texture width * @param height texture height * @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER} - * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} + * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} * @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S} * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return the created and uninitialized color {@link TextureAttachment} */ - public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height, + public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height, int magFilter, int minFilter, int wrapS, int wrapT) { final int textureInternalFormat, textureDataFormat, textureDataType; - if(glp.isGLES()) { + if(glp.isGLES()) { textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB; textureDataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB; textureDataType = GL.GL_UNSIGNED_BYTE; - } else { + } else { textureInternalFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8; // textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB; // textureInternalFormat = alpha ? 4 : 3; @@ -586,27 +586,27 @@ public class FBObject { } return createColorTextureAttachment(textureInternalFormat, width, height, textureDataFormat, textureDataType, magFilter, minFilter, wrapS, wrapT); } - + /** - * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}. + * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}. * * @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} - * @param width texture width + * @param width texture width * @param height texture height * @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} * @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} * @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER} - * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} + * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} * @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S} * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return the created and uninitialized color {@link TextureAttachment} */ public static final TextureAttachment createColorTextureAttachment(int internalFormat, int width, int height, int dataFormat, int dataType, int magFilter, int minFilter, int wrapS, int wrapT) { - return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType, + return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT, 0 /* name */); } - + private static boolean hasAlpha(int format) { switch(format) { case GL.GL_RGBA8: @@ -619,7 +619,7 @@ public class FBObject { return false; } } - + private boolean initialized; private boolean fullFBOSupport; private boolean rgba8Avail; @@ -629,7 +629,7 @@ public class FBObject { private boolean stencil04Avail; private boolean stencil08Avail; private boolean stencil16Avail; - private boolean packedDepthStencilAvail; + private boolean packedDepthStencilAvail; private int maxColorAttachments, maxSamples, maxTextureSize, maxRenderbufferSize; private int width, height, samples; @@ -639,21 +639,21 @@ public class FBObject { private boolean bound; private int colorAttachmentCount; - private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points + private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points private RenderAttachment depth, stencil; // depth and stencil maybe equal in case of packed-depth-stencil private FBObject samplingSink; // MSAA sink - private TextureAttachment samplingSinkTexture; + private TextureAttachment samplingSinkTexture; private boolean samplingSinkDirty; // // ColorAttachment helper .. // - + private final void validateColorAttachmentPointRange(int point) { if(!initialized) { throw new GLException("FBO not initialized"); - } + } if(maxColorAttachments != colorAttachmentPoints.length) { throw new InternalError("maxColorAttachments "+maxColorAttachments+", array.lenght "+colorAttachmentPoints); } @@ -661,14 +661,14 @@ public class FBObject { throw new IllegalArgumentException("attachment point out of range: "+point+", should be within [0.."+(maxColorAttachments-1)+"], "+this); } } - + private final void validateAddColorAttachment(int point, Colorbuffer ca) { validateColorAttachmentPointRange(point); if( null != colorAttachmentPoints[point] ) { throw new IllegalArgumentException("Cannot attach "+ca+", attachment point already in use by "+colorAttachmentPoints[point]+", "+this); - } + } } - + private final void addColorAttachment(int point, Colorbuffer ca) { validateColorAttachmentPointRange(point); final Colorbuffer c = colorAttachmentPoints[point]; @@ -678,7 +678,7 @@ public class FBObject { colorAttachmentPoints[point] = ca; colorAttachmentCount++; } - + private final void removeColorAttachment(int point, Colorbuffer ca) { validateColorAttachmentPointRange(point); final Colorbuffer c = colorAttachmentPoints[point]; @@ -688,20 +688,20 @@ public class FBObject { colorAttachmentPoints[point] = null; colorAttachmentCount--; } - + /** * Return the {@link Colorbuffer} attachment at <code>attachmentPoint</code> if it is attached to this FBO, otherwise null. - * + * * @see #attachColorbuffer(GL, boolean) * @see #attachColorbuffer(GL, boolean) * @see #attachTexture2D(GL, int, boolean, int, int, int, int) - * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int) + * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int) */ public final Colorbuffer getColorbuffer(int attachmentPoint) { - validateColorAttachmentPointRange(attachmentPoint); + validateColorAttachmentPointRange(attachmentPoint); return colorAttachmentPoints[attachmentPoint]; } - + /** * Finds the passed {@link Colorbuffer} within the valid range of attachment points * using <i>reference</i> comparison only. @@ -709,36 +709,36 @@ public class FBObject { * Note: Slow. Implementation uses a logN array search to save resources, i.e. not using a HashMap. * </p> * @param ca the {@link Colorbuffer} to look for. - * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1] + * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1] */ public final int getColorbufferAttachmentPoint(Colorbuffer ca) { for(int i=0; i<colorAttachmentPoints.length; i++) { if( colorAttachmentPoints[i] == ca ) { - return i; + return i; } } return -1; } - + /** * Returns the passed {@link Colorbuffer} if it is attached to this FBO, otherwise null. * Implementation compares the <i>reference</i> only. - * + * * <p> * Note: Slow. Uses {@link #getColorbufferAttachmentPoint(Colorbuffer)} to determine it's attachment point * to be used for {@link #getColorbuffer(int)} * </p> - * + * * @see #attachColorbuffer(GL, boolean) * @see #attachColorbuffer(GL, boolean) * @see #attachTexture2D(GL, int, boolean, int, int, int, int) - * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int) + * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int) */ public final Colorbuffer getColorbuffer(Colorbuffer ca) { final int p = getColorbufferAttachmentPoint(ca); return p>=0 ? getColorbuffer(p) : null; } - + /** * Creates an uninitialized FBObject instance. * <p> @@ -747,7 +747,7 @@ public class FBObject { */ public FBObject() { this.initialized = false; - + // TBD @ init this.fullFBOSupport = false; this.rgba8Avail = false; @@ -762,7 +762,7 @@ public class FBObject { this.maxSamples=-1; this.maxTextureSize = 0; this.maxRenderbufferSize = 0; - + this.width = 0; this.height = 0; this.samples = 0; @@ -770,17 +770,17 @@ public class FBObject { this.ignoreStatus = false; this.fbName = 0; this.bound = false; - + this.colorAttachmentPoints = null; // at init .. this.colorAttachmentCount = 0; this.depth = null; - this.stencil = null; - + this.stencil = null; + this.samplingSink = null; this.samplingSinkTexture = null; this.samplingSinkDirty = true; } - + private void init(GL gl, int width, int height, int samples) throws GLException { if(initialized) { throw new GLException("FBO already initialized"); @@ -788,8 +788,8 @@ public class FBObject { if( !gl.hasBasicFBOSupport() ) { throw new GLException("FBO not supported w/ context: "+gl.getContext()+", "+this); } - fullFBOSupport = gl.hasFullFBOSupport(); - + fullFBOSupport = gl.hasFullFBOSupport(); + rgba8Avail = gl.isGL2GL3() || gl.isExtensionAvailable(GLExtensions.OES_rgb8_rgba8); depth24Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth24); depth32Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth32); @@ -797,15 +797,15 @@ public class FBObject { stencil04Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_stencil4); stencil08Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_stencil8); stencil16Avail = fullFBOSupport; - + packedDepthStencilAvail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_packed_depth_stencil) || gl.isExtensionAvailable(GLExtensions.EXT_packed_depth_stencil) ; - + final boolean NV_fbo_color_attachments = gl.isExtensionAvailable(GLExtensions.NV_fbo_color_attachments); - + int val[] = new int[1]; - + checkPreGLError(gl); int realMaxColorAttachments = 1; @@ -818,24 +818,24 @@ public class FBObject { } catch (GLException gle) { gle.printStackTrace(); } } maxColorAttachments = realMaxColorAttachments <= 8 ? realMaxColorAttachments : 8; // cap to limit array size - + colorAttachmentPoints = new Colorbuffer[maxColorAttachments]; colorAttachmentCount = 0; - + maxSamples = gl.getMaxRenderbufferSamples(); gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, val, 0); maxTextureSize = val[0]; gl.glGetIntegerv(GL.GL_MAX_RENDERBUFFER_SIZE, val, 0); maxRenderbufferSize = val[0]; - + checkPreGLError(gl); - + if( 0 >= width ) { width = 1; } if( 0 >= height ) { height = 1; } this.width = width; this.height = height; this.samples = samples <= maxSamples ? samples : maxSamples; - + if(DEBUG) { System.err.println("FBObject "+width+"x"+height+", "+samples+" -> "+this.samples+" samples"); System.err.println("fullFBOSupport: "+fullFBOSupport); @@ -856,16 +856,16 @@ public class FBObject { System.err.println(JoglVersion.getGLStrings(gl, null).toString()); System.err.println(gl.getContext()); } - + checkNoError(null, gl.glGetError(), "FBObject Init.pre"); // throws GLException if error - + if(width > 2 + maxTextureSize || height> 2 + maxTextureSize || width > maxRenderbufferSize || height> maxRenderbufferSize ) { throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]"); } resetSamplingSink(gl); - + // generate fbo .. gl.glGenFramebuffers(1, val, 0); fbName = val[0]; @@ -874,15 +874,15 @@ public class FBObject { } // bind fbo .. - gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fbName); - checkNoError(gl, gl.glGetError(), "FBObject Init.bindFB"); // throws GLException if error + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fbName); + checkNoError(gl, gl.glGetError(), "FBObject Init.bindFB"); // throws GLException if error if(!gl.glIsFramebuffer(fbName)) { checkNoError(gl, GL.GL_INVALID_VALUE, "FBObject Init.isFB"); // throws GLException } bound = true; samplingSinkDirty = true; initialized = true; - + vStatus = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; // always incomplete w/o attachments! if(DEBUG) { System.err.println("FBObject.init(): "+this); @@ -900,9 +900,9 @@ public class FBObject { * Incompatibility and hence recreation is forced if * the size or sample count doesn't match for subsequent calls. * </p> - * + * * <p>Leaves the FBO bound state untouched</p> - * + * * @param gl the current GL context * @param newWidth * @param newHeight @@ -911,7 +911,7 @@ public class FBObject { public final void reset(GL gl, int newWidth, int newHeight) { reset(gl, newWidth, newHeight, 0, false); } - + /** * Initializes or resets this FBO's instance. * <p> @@ -920,21 +920,21 @@ public class FBObject { * to match the new given parameters. * </p> * <p> - * Currently incompatibility and hence recreation of the attachments will be performed + * Currently incompatibility and hence recreation of the attachments will be performed * if the size or sample count doesn't match for subsequent calls. * </p> - * + * * <p>Leaves the FBO bound state untouched</p> - * + * * @param gl the current GL context * @param newWidth the new width, it's minimum is capped to 1 * @param newHeight the new height, it's minimum is capped to 1 * @param newSamples if > 0, MSAA will be used, otherwise no multisampling. Will be capped to {@link #getMaxSamples()}. - * @param resetSamplingSink <code>true</code> calls {@link #resetSamplingSink(GL)} immediatly. + * @param resetSamplingSink <code>true</code> calls {@link #resetSamplingSink(GL)} immediatly. * <code>false</code> postpones resetting the sampling sink until {@link #use(GL, TextureAttachment)} or {@link #syncSamplingSink(GL)}, - * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit - * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer. - * + * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit + * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer. + * * @throws GLException in case of an error, i.e. size too big, etc .. */ public final void reset(GL gl, int newWidth, int newHeight, int newSamples, boolean resetSamplingSink) { @@ -942,9 +942,9 @@ public class FBObject { init(gl, newWidth, newHeight, newSamples); return; } - + newSamples = newSamples <= maxSamples ? newSamples : maxSamples; // clamp - + if( newWidth != width || newHeight != height || newSamples != samples ) { if( 0 >= newWidth ) { newWidth = 1; } if( 0 >= newHeight ) { newHeight = 1; } @@ -952,39 +952,39 @@ public class FBObject { newWidth > maxRenderbufferSize || newHeight > maxRenderbufferSize ) { throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]"); } - + if(DEBUG) { System.err.println("FBObject.reset - START - "+width+"x"+height+", "+samples+" -> "+newWidth+"x"+newHeight+", "+newSamples+"; "+this); - } - + } + final boolean wasBound = isBound(); - + width = newWidth; height = newHeight; samples = newSamples; - + if(0 < samples && null == samplingSink ) { // needs valid samplingSink for detach*() -> bind() samplingSink = new FBObject(); samplingSink.init(gl, width, height, 0); } - detachAllImpl(gl, true , true); + detachAllImpl(gl, true , true); if(resetSamplingSink) { resetSamplingSink(gl); } - + samplingSinkDirty = true; if(!wasBound) { unbind(gl); } - + if(DEBUG) { System.err.println("FBObject.reset - END - "+this); } - } + } } - + /** * Writes the internal format of the attachments to the given GLCapabilities object. * @param caps the destination for format bits @@ -994,11 +994,11 @@ public class FBObject { caps.setNumSamples(samples); caps.setDepthBits(0); caps.setStencilBits(0); - + final Colorbuffer cb = samples > 0 ? getSamplingSink() : getColorbuffer(0); if(null != cb) { cb.formatToGLCapabilities(caps, rgba8Avail); - } + } if(null != depth) { depth.formatToGLCapabilities(caps, rgba8Avail); } @@ -1006,11 +1006,11 @@ public class FBObject { stencil.formatToGLCapabilities(caps, rgba8Avail); } } - - /** + + /** * Note that the status may reflect an incomplete state during transition of attachments. * @return The FB status. {@link GL.GL_FRAMEBUFFER_COMPLETE} if ok, otherwise return GL FBO error state or -1 - * @see #validateStatus() + * @see #validateStatus() */ public final int getStatus() { return vStatus; @@ -1020,15 +1020,15 @@ public class FBObject { public final String getStatusString() { return getStatusString(vStatus); } - + public static final String getStatusString(int fbStatus) { switch(fbStatus) { case -1: return "NOT A FBO"; - + case GL.GL_FRAMEBUFFER_COMPLETE: return "OK"; - + case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: return("FBO incomplete attachment\n"); case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: @@ -1043,21 +1043,21 @@ public class FBObject { return("FBO missing read buffer"); case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: return("FBO missing multisample buffer"); - case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: + case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: return("FBO missing layer targets"); - + case GL.GL_FRAMEBUFFER_UNSUPPORTED: return("Unsupported FBO format"); case GL2GL3.GL_FRAMEBUFFER_UNDEFINED: return("FBO undefined"); - + case 0: return("FBO implementation fault"); default: return("FBO incomplete, implementation ERROR "+toHexString(fbStatus)); } } - + /** * The status may even be valid if incomplete during transition of attachments. * @see #getStatus() @@ -1066,7 +1066,7 @@ public class FBObject { switch(vStatus) { case GL.GL_FRAMEBUFFER_COMPLETE: return true; - + case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: @@ -1079,29 +1079,29 @@ public class FBObject { // we are in transition return true; } - + case GL.GL_FRAMEBUFFER_UNSUPPORTED: case GL2GL3.GL_FRAMEBUFFER_UNDEFINED: - - case 0: + + case 0: default: if(DEBUG) { - System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) + + System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) + " : " + getStatusString(vStatus)); } return false; } } - + private static int checkPreGLError(GL gl) { int glerr = gl.glGetError(); if(DEBUG && GL.GL_NO_ERROR != glerr) { System.err.println("Pre-existing GL error: "+toHexString(glerr)); Thread.dumpStack(); } - return glerr; + return glerr; } - + private final boolean checkNoError(GL gl, int err, String exceptionMessage) throws GLException { if(GL.GL_NO_ERROR != err) { if(null != gl) { @@ -1118,17 +1118,17 @@ public class FBObject { private final void checkInitialized() throws GLException { if(!initialized) { throw new GLException("FBO not initialized, call init(GL) first."); - } + } } - + /** * Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point, * selecting the texture data type and format automatically. - * + * * <p>Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.</p> - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; @@ -1140,18 +1140,18 @@ public class FBObject { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(gl.getGLProfile(), alpha, width, height)); } - + /** * Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point, * selecting the texture data type and format automatically. - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; * @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER} - * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} + * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} * @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S} * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown @@ -1162,19 +1162,19 @@ public class FBObject { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(gl.getGLProfile(), alpha, width, height, magFilter, minFilter, wrapS, wrapT)); } - + /** * Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point. - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] * @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} * @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} * @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)} * @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER} - * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} + * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER} * @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S} * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown @@ -1187,10 +1187,10 @@ public class FBObject { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT)); } - + /** * Creates a {@link ColorAttachment}, selecting the format automatically. - * + * * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; * @return uninitialized ColorAttachment instance describing the new attached colorbuffer */ @@ -1203,13 +1203,13 @@ public class FBObject { } return new ColorAttachment(internalFormat, samples, width, height, 0); } - + /** * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point, * selecting the format automatically. - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] * @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>; @@ -1220,15 +1220,15 @@ public class FBObject { public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, boolean alpha) throws GLException { return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, createColorAttachment(alpha)); } - + /** * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point. - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] - * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8} + * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8} * @return ColorAttachment instance describing the new attached colorbuffer if bound and configured successfully, otherwise GLException is thrown * @throws GLException in case the colorbuffer couldn't be allocated * @throws IllegalArgumentException if <code>internalFormat</code> doesn't reflect a colorbuffer @@ -1238,28 +1238,28 @@ public class FBObject { if( Attachment.Type.COLOR != atype ) { throw new IllegalArgumentException("colorformat invalid: "+toHexString(internalFormat)+", "+this); } - + return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, new ColorAttachment(internalFormat, samples, width, height, 0)); } - + /** - * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}, + * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}, * to this FBO's instance at the given attachment point. - * + * * <p> * If {@link Colorbuffer} is a {@link TextureAttachment} and is uninitialized, i.e. it's texture name is <code>zero</code>, * a new texture name is generated and setup w/ the texture parameter.<br/> * Otherwise, i.e. texture name is not <code>zero</code>, the passed TextureAttachment <code>texA</code> is - * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue. + * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue. * </p> - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl * @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1] - * @param colbuf the to be attached {@link Colorbuffer} + * @param colbuf the to be attached {@link Colorbuffer} * @return newly attached {@link Colorbuffer} instance if bound and configured successfully, otherwise GLException is thrown - * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment} + * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment} */ public final Colorbuffer attachColorbuffer(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException { bind(gl); @@ -1268,13 +1268,13 @@ public class FBObject { private final Colorbuffer attachColorbufferImpl(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException { validateAddColorAttachment(attachmentPoint, colbuf); - + final boolean initializedColorbuf = colbuf.initialize(gl); addColorAttachment(attachmentPoint, colbuf); - + if(colbuf instanceof TextureAttachment) { final TextureAttachment texA = (TextureAttachment) colbuf; - + if(samples>0) { removeColorAttachment(attachmentPoint, texA); if(initializedColorbuf) { @@ -1282,14 +1282,14 @@ public class FBObject { } throw new GLException("Texture2D not supported w/ MSAA. If you have enabled MSAA with exisiting texture attachments, you may want to detach them via detachAllTexturebuffer(gl)."); } - + // Set up the color buffer for use as a renderable texture: gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + attachmentPoint, GL.GL_TEXTURE_2D, texA.getName(), 0); - + if(!ignoreStatus) { - updateStatus(gl); + updateStatus(gl); if(!isStatusValid()) { detachColorbuffer(gl, attachmentPoint, true); throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this); @@ -1297,12 +1297,12 @@ public class FBObject { } } else if(colbuf instanceof ColorAttachment) { final ColorAttachment colA = (ColorAttachment) colbuf; - + // Attach the color buffer - gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, - GL.GL_COLOR_ATTACHMENT0 + attachmentPoint, + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, + GL.GL_COLOR_ATTACHMENT0 + attachmentPoint, GL.GL_RENDERBUFFER, colA.getName()); - + if(!ignoreStatus) { updateStatus(gl); if(!isStatusValid()) { @@ -1316,7 +1316,7 @@ public class FBObject { } return colbuf; } - + /** * Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, * selecting the internalFormat automatically. @@ -1325,30 +1325,30 @@ public class FBObject { * </p> * <p> * In case the desired type or bit-number is not supported, the next available one is chosen. - * </p> + * </p> * <p> * Use {@link #getDepthAttachment()} and/or {@link #getStencilAttachment()} to retrieve details * about the attached buffer. The details cannot be returned, since it's possible 2 buffers * are being created, depth and stencil. * </p> - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl - * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL} + * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL} * @param reqBits desired bits for depth or -1 for default (24 bits) * @throws GLException in case the renderbuffer couldn't be allocated or one is already attached. * @throws IllegalArgumentException * @see #getDepthAttachment() * @see #getStencilAttachment() */ - public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException { + public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException { if( 0 > reqBits ) { reqBits = 24; - } + } final int internalFormat; int internalStencilFormat = -1; - + switch ( atype ) { case DEPTH: if( 32 <= reqBits && depth32Avail ) { @@ -1356,10 +1356,10 @@ public class FBObject { } else if( 24 <= reqBits && depth24Avail ) { internalFormat = GL.GL_DEPTH_COMPONENT24; } else { - internalFormat = GL.GL_DEPTH_COMPONENT16; + internalFormat = GL.GL_DEPTH_COMPONENT16; } break; - + case STENCIL: if( 16 <= reqBits && stencil16Avail ) { internalFormat = GL2GL3.GL_STENCIL_INDEX16; @@ -1370,10 +1370,10 @@ public class FBObject { } else if( 1 <= reqBits && stencil01Avail ) { internalFormat = GL.GL_STENCIL_INDEX1; } else { - throw new GLException("stencil buffer n/a"); + throw new GLException("stencil buffer n/a"); } break; - + case DEPTH_STENCIL: if( packedDepthStencilAvail ) { internalFormat = GL.GL_DEPTH24_STENCIL8; @@ -1381,7 +1381,7 @@ public class FBObject { if( 24 <= reqBits && depth24Avail ) { internalFormat = GL.GL_DEPTH_COMPONENT24; } else { - internalFormat = GL.GL_DEPTH_COMPONENT16; + internalFormat = GL.GL_DEPTH_COMPONENT16; } if( stencil08Avail ) { internalStencilFormat = GL.GL_STENCIL_INDEX8; @@ -1397,17 +1397,17 @@ public class FBObject { default: throw new IllegalArgumentException("only depth/stencil types allowed, was "+atype+", "+this); } - + attachRenderbufferImpl(gl, atype, internalFormat); - + if(0<=internalStencilFormat) { attachRenderbufferImpl(gl, Attachment.Type.STENCIL, internalStencilFormat); } } - + /** * Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance, - * depending on the <code>internalFormat</code>. + * depending on the <code>internalFormat</code>. * <p> * Stencil and depth buffer can be attached only once. * </p> @@ -1416,9 +1416,9 @@ public class FBObject { * about the attached buffer. The details cannot be returned, since it's possible 2 buffers * are being created, depth and stencil. * </p> - * + * * <p>Leaves the FBO bound.</p> - * + * * @param gl the current GL context * @param internalFormat {@link GL#GL_DEPTH_COMPONENT16}, {@link GL#GL_DEPTH_COMPONENT24}, {@link GL#GL_DEPTH_COMPONENT32}, * {@link GL#GL_STENCIL_INDEX1}, {@link GL#GL_STENCIL_INDEX4}, {@link GL#GL_STENCIL_INDEX8} @@ -1435,19 +1435,19 @@ public class FBObject { } attachRenderbufferImpl(gl, atype, internalFormat); } - + protected final void attachRenderbufferImpl(GL gl, Attachment.Type atype, int internalFormat) throws GLException { if( null != depth && ( Attachment.Type.DEPTH == atype || Attachment.Type.DEPTH_STENCIL == atype ) ) { throw new GLException("FBO depth buffer already attached (rb "+depth+"), type is "+atype+", "+toHexString(internalFormat)+", "+this); - } + } if( null != stencil && ( Attachment.Type.STENCIL== atype || Attachment.Type.DEPTH_STENCIL == atype ) ) { throw new GLException("FBO stencil buffer already attached (rb "+stencil+"), type is "+atype+", "+toHexString(internalFormat)+", "+this); } bind(gl); - + attachRenderbufferImpl2(gl, atype, internalFormat); } - + private final void attachRenderbufferImpl2(GL gl, Attachment.Type atype, int internalFormat) throws GLException { if( Attachment.Type.DEPTH == atype ) { if(null == depth) { @@ -1486,10 +1486,10 @@ public class FBObject { } else if( Attachment.Type.STENCIL == atype ) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, stencil.getName()); } else if( Attachment.Type.DEPTH_STENCIL == atype ) { - gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, depth.getName()); + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, depth.getName()); gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, stencil.getName()); } - + if(!ignoreStatus) { updateStatus(gl); if( !isStatusValid() ) { @@ -1500,13 +1500,13 @@ public class FBObject { if(DEBUG) { System.err.println("FBObject.attachRenderbuffer.X: [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"]: "+this); - } + } } - + /** - * Detaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}. + * Detaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}. * <p>Leaves the FBO bound!</p> - * + * * @param gl * @param attachmentPoint * @param dispose true if the Colorbuffer shall be disposed @@ -1515,26 +1515,26 @@ public class FBObject { */ public final Colorbuffer detachColorbuffer(GL gl, int attachmentPoint, boolean dispose) throws IllegalArgumentException { bind(gl); - + final Colorbuffer res = detachColorbufferImpl(gl, attachmentPoint, dispose ? DetachAction.DISPOSE : DetachAction.NONE); if(null == res) { - throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this); + throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this); } if(DEBUG) { System.err.println("FBObject.detachColorbuffer.X: [attachmentPoint "+attachmentPoint+", dispose "+dispose+"]: "+res+", "+this); } return res; } - + private final Colorbuffer detachColorbufferImpl(GL gl, int attachmentPoint, DetachAction detachAction) { Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here - + if(null == colbuf) { return null; } - + removeColorAttachment(attachmentPoint, colbuf); - + if(colbuf instanceof TextureAttachment) { final TextureAttachment texA = (TextureAttachment) colbuf; if( 0 != texA.getName() ) { @@ -1553,7 +1553,7 @@ public class FBObject { if(DetachAction.RECREATE == detachAction) { if(samples == 0) { // stay non MSAA - texA.setSize(width, height); + texA.setSize(width, height); } else { // switch to MSAA colbuf = createColorAttachment(hasAlpha(texA.format)); @@ -1563,8 +1563,8 @@ public class FBObject { } else if(colbuf instanceof ColorAttachment) { final ColorAttachment colA = (ColorAttachment) colbuf; if( 0 != colA.getName() ) { - gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, - GL.GL_COLOR_ATTACHMENT0+attachmentPoint, + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, + GL.GL_COLOR_ATTACHMENT0+attachmentPoint, GL.GL_RENDERBUFFER, 0); switch(detachAction) { case DISPOSE: @@ -1582,9 +1582,9 @@ public class FBObject { } else { // switch to non MSAA if(null != samplingSinkTexture) { - colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height, - samplingSinkTexture.dataFormat, samplingSinkTexture.dataType, - samplingSinkTexture.magFilter, samplingSinkTexture.minFilter, + colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height, + samplingSinkTexture.dataFormat, samplingSinkTexture.dataType, + samplingSinkTexture.magFilter, samplingSinkTexture.minFilter, samplingSinkTexture.wrapS, samplingSinkTexture.wrapT); } else { colbuf = createColorTextureAttachment(gl.getGLProfile(), true, width, height); @@ -1595,15 +1595,15 @@ public class FBObject { } return colbuf; } - + private final void freeAllColorbufferImpl(GL gl) { for(int i=0; i<maxColorAttachments; i++) { final Colorbuffer colbuf = colorAttachmentPoints[i]; // shortcut, don't validate here - + if(null == colbuf) { return; } - + if(colbuf instanceof TextureAttachment) { final TextureAttachment texA = (TextureAttachment) colbuf; if( 0 != texA.getName() ) { @@ -1616,29 +1616,29 @@ public class FBObject { } else if(colbuf instanceof ColorAttachment) { final ColorAttachment colA = (ColorAttachment) colbuf; if( 0 != colA.getName() ) { - gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, - GL.GL_COLOR_ATTACHMENT0 + i, + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, + GL.GL_COLOR_ATTACHMENT0 + i, GL.GL_RENDERBUFFER, 0); } colA.free(gl); } } } - + /** - * + * * @param gl * @param dispose true if the Colorbuffer shall be disposed - * @param reqAType {@link Type#DEPTH}, {@link Type#DEPTH} or {@link Type#DEPTH_STENCIL} + * @param reqAType {@link Type#DEPTH}, {@link Type#DEPTH} or {@link Type#DEPTH_STENCIL} */ public final void detachRenderbuffer(GL gl, Attachment.Type atype, boolean dispose) throws IllegalArgumentException { - bind(gl); + bind(gl); detachRenderbufferImpl(gl, atype, dispose ? DetachAction.DISPOSE : DetachAction.NONE); if(DEBUG) { System.err.println("FBObject.detachRenderbuffer.X: [attachmentType "+atype+", dispose "+dispose+"]: "+this); - } + } } - + public final boolean isDepthStencilPackedFormat() { final boolean res = null != depth && null != stencil && depth.format == stencil.format ; @@ -1652,19 +1652,19 @@ public class FBObject { } return res; } - + private final void detachRenderbufferImpl(GL gl, Attachment.Type atype, DetachAction detachAction) throws IllegalArgumentException { switch ( atype ) { case DEPTH: case STENCIL: - case DEPTH_STENCIL: + case DEPTH_STENCIL: break; default: throw new IllegalArgumentException("only depth/stencil types allowed, was "+atype+", "+this); - } + } if( null == depth && null == stencil ) { return ; // nop - } + } final boolean packed = isDepthStencilPackedFormat(); if( packed ) { // Note: DEPTH_STENCIL shares buffer w/ depth and stencil @@ -1734,7 +1734,7 @@ public class FBObject { if(packed) { stencil = null; } - } + } } if( !packed && null != stencil ) { final int format = stencil.format; @@ -1756,17 +1756,17 @@ public class FBObject { } break; default: // handled - } + } } - + private final void freeAllRenderbufferImpl(GL gl) throws IllegalArgumentException { // Note: DEPTH_STENCIL shares buffer w/ depth and stencil final boolean packed = isDepthStencilPackedFormat(); - if( null != depth ) { + if( null != depth ) { if(0 != depth.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, 0); if(packed) { - gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); + gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); } depth.free(gl); } @@ -1774,49 +1774,49 @@ public class FBObject { if( !packed && null != stencil ) { if(0 != stencil.getName()) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0); - stencil.free(gl); + stencil.free(gl); } } } - - /** + + /** * Detaches all {@link ColorAttachment}s, {@link TextureAttachment}s and {@link RenderAttachment}s * and disposes them. * <p>Leaves the FBO bound, if initialized!</p> * <p> * An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}. - * </p> + * </p> * @param gl the current GL context */ public final void detachAll(GL gl) { if(null != samplingSink) { samplingSink.detachAll(gl); - } + } detachAllImpl(gl, true/* detachNonColorbuffer */, false /* recreate */); } - - /** - * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s + + /** + * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s * and disposes them. * <p>Leaves the FBO bound, if initialized!</p> * <p> * An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}. - * </p> + * </p> * @param gl the current GL context */ public final void detachAllColorbuffer(GL gl) { if(null != samplingSink) { samplingSink.detachAllColorbuffer(gl); - } + } detachAllImpl(gl, false/* detachNonColorbuffer */, false /* recreate */); } - - /** + + /** * Detaches all {@link TextureAttachment}s and disposes them. * <p>Leaves the FBO bound, if initialized!</p> * <p> * An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}. - * </p> + * </p> * @param gl the current GL context */ public final void detachAllTexturebuffer(GL gl) { @@ -1826,7 +1826,7 @@ public class FBObject { if(null != samplingSink) { samplingSink.detachAllTexturebuffer(gl); } - bind(gl); + bind(gl); for(int i=0; i<maxColorAttachments; i++) { if(colorAttachmentPoints[i] instanceof TextureAttachment) { detachColorbufferImpl(gl, i, DetachAction.DISPOSE); @@ -1836,7 +1836,7 @@ public class FBObject { System.err.println("FBObject.detachAllTexturebuffer.X: "+this); } } - + public final void detachAllRenderbuffer(GL gl) { if( !isInitialized() ) { return; @@ -1844,10 +1844,10 @@ public class FBObject { if(null != samplingSink) { samplingSink.detachAllRenderbuffer(gl); } - bind(gl); + bind(gl); detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, DetachAction.DISPOSE); } - + private final void detachAllImpl(GL gl, boolean detachNonColorbuffer, boolean recreate) { if( !isInitialized() ) { return; @@ -1868,7 +1868,7 @@ public class FBObject { if( !recreate && colorAttachmentCount>0 ) { throw new InternalError("Non zero ColorAttachments "+this); } - + if(detachNonColorbuffer) { detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, recreate ? DetachAction.RECREATE : DetachAction.DISPOSE); } @@ -1888,7 +1888,7 @@ public class FBObject { System.err.println("FBObject.detachAll.X: [resetNonColorbuffer "+detachNonColorbuffer+", recreate "+recreate+"]: "+this); } } - + /** * @param gl the current GL context */ @@ -1903,9 +1903,9 @@ public class FBObject { if( null != samplingSink && samplingSink.isInitialized() ) { samplingSink.destroy(gl); } - + detachAllImpl(gl, true /* detachNonColorbuffer */, false /* recreate */); - + // cache FB names, preset exposed to zero, // braking ties w/ GL/GLContext link to getReadFramebuffer()/getWriteFramebuffer() final int fb_cache = fbName; @@ -1915,7 +1915,7 @@ public class FBObject { if(0!=fb_cache) { name[0] = fb_cache; gl.glDeleteFramebuffers(1, name, 0); - } + } initialized = false; bound = false; if(DEBUG) { @@ -1933,14 +1933,14 @@ public class FBObject { final boolean depthMismatch = ( null != depth && null == samplingSink.depth ) || ( null != depth && null != samplingSink.depth && depth.format != samplingSink.depth.format ); - + final boolean stencilMismatch = ( null != stencil && null == samplingSink.stencil ) || ( null != stencil && null != samplingSink.stencil && - stencil.format != samplingSink.stencil.format ); - - return depthMismatch || stencilMismatch; + stencil.format != samplingSink.stencil.format ); + + return depthMismatch || stencilMismatch; } - + /** * Manually reset the MSAA sampling sink, if used. * <p> @@ -1948,7 +1948,7 @@ public class FBObject { * a new sampling sink is being created. * </p> * <p> - * Automatically called by {@link #reset(GL, int, int, int, boolean)} + * Automatically called by {@link #reset(GL, int, int, int, boolean)} * and {@link #syncSamplingSink(GL)}. * </p> * <p> @@ -1967,58 +1967,58 @@ public class FBObject { } return; } - + if(null == samplingSink ) { samplingSink = new FBObject(); } - + if(!samplingSink.initialized) { samplingSink.init(gl, width, height, 0); } - + boolean sampleSinkSizeMismatch = sampleSinkSizeMismatch(); boolean sampleSinkTexMismatch = sampleSinkTexMismatch(); boolean sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch(); - + /** if(DEBUG) { System.err.println("FBObject.resetSamplingSink.0: \n\tTHIS "+this+",\n\tSINK "+samplesSink+ "\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch); } */ - + if(!sampleSinkSizeMismatch && !sampleSinkTexMismatch && !sampleSinkDepthStencilMismatch) { - // all properties match .. - return; + // all properties match .. + return; } - + unbind(gl); - + if(DEBUG) { System.err.println("FBObject.resetSamplingSink: BEGIN\n\tTHIS "+this+",\n\tSINK "+samplingSink+ "\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch); } - + if( sampleSinkDepthStencilMismatch ) { samplingSink.detachAllRenderbuffer(gl); } - + if( sampleSinkSizeMismatch ) { samplingSink.reset(gl, width, height); } - + if(null == samplingSinkTexture) { samplingSinkTexture = samplingSink.attachTexture2D(gl, 0, true); } else if( 0 == samplingSinkTexture.getName() ) { samplingSinkTexture.setSize(width, height); samplingSink.attachColorbuffer(gl, 0, samplingSinkTexture); } - + if( sampleSinkDepthStencilMismatch ) { samplingSink.attachRenderbuffer(gl, depth.format); if( null != stencil && !isDepthStencilPackedFormat() ) { samplingSink.attachRenderbuffer(gl, stencil.format); } - } - + } + sampleSinkSizeMismatch = sampleSinkSizeMismatch(); sampleSinkTexMismatch = sampleSinkTexMismatch(); sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch(); @@ -2026,21 +2026,21 @@ public class FBObject { throw new InternalError("Samples sink mismatch after reset: \n\tTHIS "+this+",\n\t SINK "+samplingSink+ "\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch); } - + if(DEBUG) { System.err.println("FBObject.resetSamplingSink: END\n\tTHIS "+this+",\n\tSINK "+samplingSink+ "\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch); } } - + /** * Setting this FBO sampling sink. * @param newSamplingSink the new FBO sampling sink to use, or null to remove current sampling sink - * @return the previous sampling sink or null if none was attached + * @return the previous sampling sink or null if none was attached * @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself */ public FBObject setSamplingSink(FBObject newSamplingSink) throws GLException { - final FBObject prev = samplingSink; + final FBObject prev = samplingSink; if( null == newSamplingSink) { samplingSink = null; samplingSinkTexture = null; @@ -2056,14 +2056,14 @@ public class FBObject { samplingSinkDirty = true; return prev; } - - /** + + /** * Bind this FBO, i.e. bind write framebuffer to {@link #getWriteFramebuffer()}. - * - * <p>If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()}, + * + * <p>If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()}, * if full FBO is supported.</p> - * - * <p> + * + * <p> * In case you have attached more than one color buffer, * you may want to setup {@link GL2GL3#glDrawBuffers(int, int[], int)}. * </p> @@ -2079,7 +2079,7 @@ public class FBObject { gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, getReadFramebuffer()); } else { // one for all - gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer()); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer()); } bound = true; @@ -2087,29 +2087,29 @@ public class FBObject { } } - /** + /** * Unbind this FBO, i.e. bind read and write framebuffer to default, see {@link GLBase#getDefaultDrawFramebuffer()}. - * - * <p>If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing + * + * <p>If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing * an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()}</p> - * + * * @param gl the current GL context * @throws GLException */ public final void unbind(GL gl) throws GLException { if(bound) { if(fullFBOSupport) { - // default read/draw buffers, may utilize GLContext/GLDrawable override of + // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); } else { - gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } bound = false; } } - + /** * Method simply marks this FBO unbound w/o interfering w/ the bound framebuffer as perfomed by {@link #unbind(GL)}. * <p> @@ -2121,22 +2121,22 @@ public class FBObject { bound = false; } - /** + /** * Returns <code>true</code> if framebuffer object is bound via {@link #bind(GL)}, otherwise <code>false</code>. * <p> * Method verifies the bound state via {@link GL#getBoundFramebuffer(int)}. * </p> * @param gl the current GL context */ - public final boolean isBound(GL gl) { + public final boolean isBound(GL gl) { bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER) ; return bound; } - + /** Returns <code>true</code> if framebuffer object is bound via {@link #bind(GL)}, otherwise <code>false</code>. */ public final boolean isBound() { return bound; } - - /** + + /** * If multisampling is being used and flagged dirty by a previous call of {@link #bind(GL)} or after initialization, * the msaa-buffers are sampled to it's sink {@link #getSamplingSink()}. * <p> @@ -2147,7 +2147,7 @@ public class FBObject { * </p> * <p> * Method always resets the framebuffer binding to default in the end. - * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing + * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing * an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()} * </p> * <p> @@ -2155,10 +2155,10 @@ public class FBObject { * you may want to call {@link GL#glBindFramebuffer(int, int) glBindFramebuffer}({@link GL2GL3#GL_READ_FRAMEBUFFER}, {@link #getReadFramebuffer()}); * </p> * <p>Leaves the FBO unbound.</p> - * + * * @param gl the current GL context * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)} - * @throws IllegalArgumentException + * @throws IllegalArgumentException */ public final void syncSamplingSink(GL gl) { markUnbound(); @@ -2170,30 +2170,30 @@ public class FBObject { gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer()); ((GL2GL3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2GL3 is OK GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST); - checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error + checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error } if(fullFBOSupport) { - // default read/draw buffers, may utilize GLContext/GLDrawable override of + // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); } else { - gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } } - - /** + + /** * Bind the given texture colorbuffer. - * + * * <p>If using multiple texture units, ensure you call {@link GL#glActiveTexture(int)} first!</p> - * + * * <p>{@link #syncSamplingSink(GL)} is being called</p> - * + * * <p>Leaves the FBO unbound!</p> - * + * * @param gl the current GL context * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)} - * @throws IllegalArgumentException + * @throws IllegalArgumentException */ public final void use(GL gl, TextureAttachment ta) throws IllegalArgumentException { if(null == ta) { throw new IllegalArgumentException("Null TextureAttachment, this: "+toString()); } @@ -2201,26 +2201,26 @@ public class FBObject { gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it .. } - /** + /** * Unbind texture, ie bind 'non' texture 0 - * + * * <p>Leaves the FBO unbound.</p> - */ + */ public final void unuse(GL gl) { unbind(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it } - /** @see GL#hasFullFBOSupport() */ + /** @see GL#hasFullFBOSupport() */ public final boolean hasFullFBOSupport() throws GLException { checkInitialized(); return this.fullFBOSupport; } - - /** + + /** * Returns <code>true</code> if renderbuffer accepts internal format {@link GL#GL_RGB8} and {@link GL#GL_RGBA8}, otherwise <code>false</code>. * @throws GLException if {@link #init(GL)} hasn't been called. */ public final boolean supportsRGBA8() throws GLException { checkInitialized(); return rgba8Avail; } - - /** + + /** * Returns <code>true</code> if {@link GL#GL_DEPTH_COMPONENT16}, {@link GL#GL_DEPTH_COMPONENT24} or {@link GL#GL_DEPTH_COMPONENT32} is supported, otherwise <code>false</code>. * @param bits 16, 24 or 32 bits * @throws GLException if {@link #init(GL)} hasn't been called. @@ -2228,14 +2228,14 @@ public class FBObject { public final boolean supportsDepth(int bits) throws GLException { checkInitialized(); switch(bits) { - case 16: return true; + case 16: return true; case 24: return depth24Avail; case 32: return depth32Avail; - default: return false; + default: return false; } } - - /** + + /** * Returns <code>true</code> if {@link GL#GL_STENCIL_INDEX1}, {@link GL#GL_STENCIL_INDEX4}, {@link GL#GL_STENCIL_INDEX8} or {@link GL2GL3#GL_STENCIL_INDEX16} is supported, otherwise <code>false</code>. * @param bits 1, 4, 8 or 16 bits * @throws GLException if {@link #init(GL)} hasn't been called. @@ -2243,34 +2243,34 @@ public class FBObject { public final boolean supportsStencil(int bits) throws GLException { checkInitialized(); switch(bits) { - case 1: return stencil01Avail; + case 1: return stencil01Avail; case 4: return stencil04Avail; case 8: return stencil08Avail; case 16: return stencil16Avail; - default: return false; + default: return false; } } - - /** + + /** * Returns <code>true</code> if {@link GL#GL_DEPTH24_STENCIL8} is supported, otherwise <code>false</code>. * @throws GLException if {@link #init(GL)} hasn't been called. */ public final boolean supportsPackedDepthStencil() throws GLException { checkInitialized(); return packedDepthStencilAvail; } - + /** * Returns the maximum number of colorbuffer attachments. * @throws GLException if {@link #init(GL)} hasn't been called. */ public final int getMaxColorAttachments() throws GLException { checkInitialized(); return maxColorAttachments; } - + public final int getMaxTextureSize() throws GLException { checkInitialized(); return this.maxTextureSize; } public final int getMaxRenderbufferSize() throws GLException { checkInitialized(); return this.maxRenderbufferSize; } - + /** @see GL#getMaxRenderbufferSamples() */ public final int getMaxSamples() throws GLException { checkInitialized(); return this.maxSamples; } - + /** - * Returns <code>true</code> if this instance has been initialized with {@link #reset(GL, int, int)} + * Returns <code>true</code> if this instance has been initialized with {@link #reset(GL, int, int)} * or {@link #reset(GL, int, int, int, boolean)}, otherwise <code>false</code> */ public final boolean isInitialized() { return initialized; } @@ -2283,43 +2283,43 @@ public class FBObject { /** Returns the framebuffer name to render to. */ public final int getWriteFramebuffer() { return fbName; } /** Returns the framebuffer name to read from. Depending on multisampling, this may be a different framebuffer. */ - public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; } - public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; } + public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; } + public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; } /** Return the number of color/texture attachments */ public final int getColorAttachmentCount() { return colorAttachmentCount; } - /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */ + /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */ public final RenderAttachment getStencilAttachment() { return stencil; } - /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */ + /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */ public final RenderAttachment getDepthAttachment() { return depth; } - - /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */ + + /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */ public final FBObject getSamplingSinkFBO() { return samplingSink; } - - /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */ + + /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */ public final TextureAttachment getSamplingSink() { return samplingSinkTexture; } - /** - * Returns <code>true</code> if the multisampling colorbuffer (msaa-buffer) + /** + * Returns <code>true</code> if the multisampling colorbuffer (msaa-buffer) * has been flagged dirty by a previous call of {@link #bind(GL)}, * otherwise <code>false</code>. */ public final boolean isSamplingBufferDirty() { return samplingSinkDirty; } - + int objectHashCode() { return super.hashCode(); } - + public final String toString() { - final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ; + final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ; return "FBO[name r/w "+fbName+"/"+getReadFramebuffer()+", init "+initialized+", bound "+bound+", size "+width+"x"+height+ ", samples "+samples+"/"+maxSamples+", depth "+depth+", stencil "+stencil+ ", color attachments: "+colorAttachmentCount+"/"+maxColorAttachments+ ": "+caps+", msaa-sink "+samplingSinkTexture+", hasSamplesSink "+(null != samplingSink)+ ", state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]"; } - + private final void updateStatus(GL gl) { if( 0 == fbName ) { vStatus = -1; } else { vStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); } - } + } } diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java index bec05a0bd..ce58d29c1 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.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 com.jogamp.opengl; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -58,14 +58,14 @@ import jogamp.opengl.GLDrawableImpl; * </ul> * and setup a {@link com.jogamp.newt.Window#setWindowDestroyNotifyAction(Runnable) custom toolkit destruction} issuing {@link #windowDestroyNotifyOp()}. * </p> - * <p> + * <p> * See example {@link com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT TestGLAutoDrawableDelegateNEWT}. * </p> */ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable { /** * @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 @@ -84,7 +84,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto this.upstreamWidget = upstreamWidget; this.lock = ( null != lock ) ? lock : LockFactory.createRecursiveLock() ; } - + // // expose default methods // @@ -93,40 +93,40 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto public final void windowRepaintOp() { super.defaultWindowRepaintOp(); } - + /** Implementation to handle resize events from the windowing system. All required locks are being claimed. */ public final void windowResizedOp(int newWidth, int newHeight) { super.defaultWindowResizedOp(newWidth, newHeight); } - - /** + + /** * 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> */ public final void windowDestroyNotifyOp() { super.defaultWindowDestroyNotifyOp(); } - + // // Complete GLAutoDrawable // - + private Object upstreamWidget; private final RecursiveLock lock; - + @Override protected final RecursiveLock getLock() { return lock; } - + @Override public final Object getUpstreamWidget() { return upstreamWidget; } - + /** * Set the upstream UI toolkit object. * @see #getUpstreamWidget() @@ -134,7 +134,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto public final void setUpstreamWidget(Object newUpstreamWidget) { upstreamWidget = newUpstreamWidget; } - + /** * {@inheritDoc} * <p> @@ -142,7 +142,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto * </p> * <p> * User still needs to destroy the upstream window, which details are hidden from this aspect. - * This can be performed by overriding {@link #destroyImplInLock()}. + * This can be performed by overriding {@link #destroyImplInLock()}. * </p> */ @Override @@ -154,29 +154,29 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto protected void destroyImplInLock() { super.destroyImplInLock(); } - + @Override - public void display() { + public void display() { defaultDisplay(); } - + // // GLDrawable delegation // - + @Override public final GLDrawableFactory getFactory() { return drawable.getFactory(); } - + @Override public final void swapBuffers() throws GLException { defaultSwapBuffers(); } - + @Override public String toString() { return getClass().getSimpleName()+"[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable + ", \n\tContext: " + context + ", \n\tUpstreamWidget: "+upstreamWidget+ /** ", \n\tFactory: "+factory+ */ "]"; - } + } } diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java index 21dafecb1..1b4187668 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.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. @@ -48,7 +48,7 @@ import jogamp.opengl.Debug; import com.jogamp.nativewindow.MutableGraphicsConfiguration; /** - * GLEventListenerState is holding {@link GLAutoDrawable} components crucial + * GLEventListenerState is holding {@link GLAutoDrawable} components crucial * to relocating all its {@link GLEventListener} w/ their operating {@link GLContext}, etc. * The components are: * <ul> @@ -69,8 +69,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; */ public class GLEventListenerState { private static final boolean DEBUG = Debug.debug("GLDrawable") || Debug.debug("GLEventListenerState"); - - private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device, + + private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLContext context, int count, GLAnimatorControl anim, boolean animStarted) { this.upstreamDevice = upstreamDevice; @@ -82,19 +82,19 @@ public class GLEventListenerState { this.listenersInit = new boolean[count]; this.anim = anim; this.animStarted = animStarted; - + this.owner = true; } /** - * Returns <code>true</code>, if this instance is the current owner of the components, + * Returns <code>true</code>, if this instance is the current owner of the components, * otherwise <code>false</code>. * <p> * Ownership is lost if {@link #moveTo(GLAutoDrawable)} is being called successfully - * and all components are transferred to the new {@link GLAutoDrawable}. + * and all components are transferred to the new {@link GLAutoDrawable}. * </p> */ public final boolean isOwner() { return owner; } - + public final int listenerCount() { return listeners.length; } public final AbstractGraphicsDevice upstreamDevice; @@ -103,10 +103,10 @@ public class GLEventListenerState { public final GLCapabilitiesImmutable caps; public final GLContext context; public final GLEventListener[] listeners; - public final boolean[] listenersInit; + public final boolean[] listenersInit; public final GLAnimatorControl anim; public final boolean animStarted; - + private boolean owner; /** @@ -127,25 +127,25 @@ public class GLEventListenerState { private static AbstractGraphicsDevice cloneDevice(AbstractGraphicsDevice aDevice) { return (AbstractGraphicsDevice) aDevice.clone(); } - + /** - * Moves all GLEventListenerState components from the given {@link GLAutoDrawable} + * Moves all GLEventListenerState components from the given {@link GLAutoDrawable} * to a newly created instance. * <p> * Note that all components are removed from the {@link GLAutoDrawable}, * i.e. the {@link GLContext}, all {@link GLEventListener}. * </p> - * <p> + * <p> * If the {@link GLAutoDrawable} was added to a {@link GLAnimatorControl}, it is removed * and the {@link GLAnimatorControl} added to the GLEventListenerState. * </p> * <p> - * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}. + * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}. * </p> - * + * * @param a {@link GLAutoDrawable} source to move components from * @return new GLEventListenerState instance {@link #isOwner() owning} moved components. - * + * * @see #moveTo(GLAutoDrawable) */ public static GLEventListenerState moveFrom(GLAutoDrawable a) { @@ -154,16 +154,16 @@ public class GLEventListenerState { if( null != aAnim ) { aAnimStarted = aAnim.isStarted(); aAnim.remove(a); // also handles ECT - } else { + } else { aAnimStarted = false; } - + final GLEventListenerState glls; final NativeSurface aSurface = a.getNativeSurface(); final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface(); try { final int aSz = a.getGLEventListenerCount(); - + // Create new AbstractGraphicsScreen w/ cloned AbstractGraphicsDevice for future GLAutoDrawable // allowing this AbstractGraphicsDevice to loose ownership -> not closing display/device! final AbstractGraphicsConfiguration aCfg = aSurface.getGraphicsConfiguration(); @@ -171,7 +171,7 @@ public class GLEventListenerState { final AbstractGraphicsDevice aDevice1 = aCfg.getScreen().getDevice(); final AbstractGraphicsDevice aDevice2 = cloneDevice(aDevice1); aDevice1.clearHandleOwner(); // don't close device handle - if( DEBUG ) { + if( DEBUG ) { System.err.println("GLEventListenerState.moveFrom.0a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1); System.err.println("GLEventListenerState.moveFrom.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2); System.err.println("GLEventListenerState.moveFrom.1: "+aSurface.getClass().getName()/*+", "+aSurface*/); @@ -203,9 +203,9 @@ public class GLEventListenerState { } aUpDevice2 = _aUpDevice2; } - - glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted); - + + glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted); + // // remove and cache all GLEventListener and their init-state // @@ -213,41 +213,41 @@ public class GLEventListenerState { final GLEventListener l = a.getGLEventListener(0); glls.listenersInit[i] = a.getGLEventListenerInitState(l); glls.listeners[i] = a.removeGLEventListener( l ); - } - + } + // // trigger glFinish to sync GL ctx // a.invoke(true, glFinish); - + a.setContext( null, false ); - + } finally { if( surfaceLocked ) { aSurface.unlockSurface(); } - } - + } + return glls; } /** - * Moves all GLEventListenerState components to the given {@link GLAutoDrawable} + * Moves all GLEventListenerState components to the given {@link GLAutoDrawable} * from this instance, while loosing {@link #isOwner() ownership}. - * <p> + * <p> * If the previous {@link GLAutoDrawable} was removed from a {@link GLAnimatorControl} by previous {@link #moveFrom(GLAutoDrawable)}, * the given {@link GLAutoDrawable} is added to the cached {@link GLAnimatorControl}. - * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance. + * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance. * </p> * <p> - * Note: After this operation, the GLEventListenerState reference should be released. + * Note: After this operation, the GLEventListenerState reference should be released. * </p> - * + * * @param a {@link GLAutoDrawable} destination to move GLEventListenerState components to - * + * * <!-- @throws GLException if the {@link GLAutoDrawable}'s configuration is incompatible, i.e. different {@link GLCapabilitiesImmutable}. --> * @throws GLException if this preserved {@link AbstractGraphicsDevice} is incompatible w/ the given destination one. - * + * * @see #moveFrom(GLAutoDrawable) * @see #isOwner() */ @@ -261,22 +261,22 @@ public class GLEventListenerState { if( aPaused ) { aAnim.resume(); } - } else { + } else { aPaused = false; } - + final List<GLRunnable> aGLCmds = new ArrayList<GLRunnable>(); final int aSz = listenerCount(); - + final NativeSurface aSurface = a.getNativeSurface(); final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface(); final boolean aRealized; try { - + final MutableGraphicsConfiguration aCfg = (MutableGraphicsConfiguration) aSurface.getGraphicsConfiguration(); /** final GLCapabilitiesImmutable aCaps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities(); - if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) || + if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) || caps.getVisualID(VisualIDHolder.VIDType.NATIVE) != aCaps.getVisualID(VisualIDHolder.VIDType.NATIVE) ) { throw new GLException("Incompatible Capabilities - Prev-Holder: "+caps+", New-Holder "+caps); } */ @@ -285,8 +285,8 @@ public class GLEventListenerState { if( !aDevice1.getUniqueID().equals( aDevice2.getUniqueID() ) ) { throw new GLException("Incompatible devices: Preserved <"+aDevice2.getUniqueID()+">, target <"+aDevice1.getUniqueID()+">"); } - - // collect optional upstream surface info + + // collect optional upstream surface info final ProxySurface aProxy; final NativeSurface aUpSurface; if(aSurface instanceof ProxySurface) { @@ -302,8 +302,8 @@ public class GLEventListenerState { } if( null==aUpSurface && null != upstreamDevice ) { throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = true, New-Holder = false"); - } - + } + // Destroy and remove currently associated GLContext, if any (will be replaced) a.setContext( null, true ); aRealized = a.isRealized(); @@ -311,7 +311,7 @@ public class GLEventListenerState { // Unrealize due to device dependencies of an upstream surface, e.g. EGLUpstreamSurfaceHook a.getDelegatedDrawable().setRealized(false); } - + // Set new Screen and close previous one { if( DEBUG ) { @@ -319,13 +319,13 @@ public class GLEventListenerState { System.err.println("GLEventListenerState.moveTo.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2); } DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aDevice1, aDevice2); - aDevice2.close(); + aDevice2.close(); if( DEBUG ) { System.err.println("GLEventListenerState.moveTo.1a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1); System.err.println("GLEventListenerState.moveTo.1b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2); } } - + // If using a ProxySurface w/ an upstream surface, set new Screen and close previous one on it if( null != aUpSurface ) { final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration(); @@ -339,9 +339,9 @@ public class GLEventListenerState { System.err.println("GLEventListenerState.moveTo.2a: up-orig 0x"+Integer.toHexString(aUpDevice1.hashCode())+", "+aUpDevice1); System.err.println("GLEventListenerState.moveTo.2b: up-pres 0x"+Integer.toHexString(aUpDevice2.hashCode())+", "+aUpDevice2); System.err.println("GLEventListenerState.moveTo.2c: "+aUpSurface.getClass().getName()/*+", "+aUpSurface+", "*/+aProxy.getUpstreamOptionBits(null).toString()); - } + } DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aUpDevice1, aUpDevice2); - aUpDevice2.close(); + aUpDevice2.close(); if( proxyOwnsUpstreamDevice ) { aProxy.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); } @@ -354,7 +354,7 @@ public class GLEventListenerState { throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true"); } } - + if( aRealized && null != aUpSurface ) { a.getDelegatedDrawable().setRealized(true); } @@ -369,7 +369,7 @@ public class GLEventListenerState { } } owner = false; - + // // Trigger GL-Viewport reset and reshape of all initialized GLEventListeners // @@ -389,7 +389,7 @@ public class GLEventListenerState { a.setGLEventListenerInitState(l, listenersInit[i]); listeners[i] = null; } - + if( hasAnimator ) { // prefer already bound animator aAnim.add(a); @@ -410,7 +410,7 @@ public class GLEventListenerState { public boolean run(GLAutoDrawable drawable) { drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); return true; - } + } }; public static GLRunnable glFinish = new GLRunnable() { @@ -418,7 +418,7 @@ public class GLEventListenerState { public boolean run(GLAutoDrawable drawable) { drawable.getGL().glFinish(); return true; - } + } }; public static class ReshapeGLEventListener implements GLRunnable { @@ -430,6 +430,6 @@ public class GLEventListenerState { public boolean run(GLAutoDrawable drawable) { listener.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); return true; - } + } } } diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java index 14f4be96a..c7aadcd14 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java +++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java @@ -28,17 +28,17 @@ package com.jogamp.opengl; /** - * Class holding OpenGL extension strings, commonly used by JOGL's implementation. + * Class holding OpenGL extension strings, commonly used by JOGL's implementation. */ public class GLExtensions { public static final String VERSION_1_2 = "GL_VERSION_1_2"; public static final String VERSION_1_4 = "GL_VERSION_1_4"; public static final String VERSION_1_5 = "GL_VERSION_1_5"; public static final String VERSION_2_0 = "GL_VERSION_2_0"; - + public static final String ARB_debug_output = "GL_ARB_debug_output"; public static final String AMD_debug_output = "GL_AMD_debug_output"; - + public static final String ARB_framebuffer_object = "GL_ARB_framebuffer_object"; public static final String OES_framebuffer_object = "GL_OES_framebuffer_object"; public static final String EXT_framebuffer_object = "GL_EXT_framebuffer_object"; @@ -49,17 +49,17 @@ public class GLExtensions { public static final String OES_depth32 = "GL_OES_depth32"; public static final String OES_packed_depth_stencil = "GL_OES_packed_depth_stencil"; public static final String NV_fbo_color_attachments = "GL_NV_fbo_color_attachments"; - + public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility"; public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility"; - + public static final String EXT_abgr = "GL_EXT_abgr"; public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8"; public static final String OES_stencil1 = "GL_OES_stencil1"; public static final String OES_stencil4 = "GL_OES_stencil4"; public static final String OES_stencil8 = "GL_OES_stencil8"; public static final String APPLE_float_pixels = "GL_APPLE_float_pixels"; - + public static final String ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two"; public static final String ARB_texture_rectangle = "GL_ARB_texture_rectangle"; public static final String EXT_texture_rectangle = "GL_EXT_texture_rectangle"; @@ -72,15 +72,15 @@ public class GLExtensions { public static final String OES_read_format = "GL_OES_read_format"; public static final String OES_single_precision = "GL_OES_single_precision"; public static final String OES_EGL_image_external = "GL_OES_EGL_image_external"; - + public static final String ARB_gpu_shader_fp64 = "GL_ARB_gpu_shader_fp64"; - public static final String ARB_shader_objects = "GL_ARB_shader_objects"; + public static final String ARB_shader_objects = "GL_ARB_shader_objects"; public static final String ARB_geometry_shader4 = "GL_ARB_geometry_shader4"; - + // // Aliased GLX/WGL/.. extensions // - - public static final String ARB_pixel_format = "GL_ARB_pixel_format"; + + public static final String ARB_pixel_format = "GL_ARB_pixel_format"; public static final String ARB_pbuffer = "GL_ARB_pbuffer"; } diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 6ef1e0805..ee77f8d2d 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -29,20 +29,20 @@ package com.jogamp.opengl; import java.util.List; -/** - * GLRendererQuirks contains information of known bugs of various GL renderer. +/** + * GLRendererQuirks contains information of known bugs of various GL renderer. * This information allows us to workaround them. * <p> * Using centralized quirk identifier enables us to - * locate code dealing w/ it and hence eases it's maintenance. + * locate code dealing w/ it and hence eases it's maintenance. * </p> * <p> * <i>Some</i> <code>GL_VENDOR</code> and <code>GL_RENDERER</code> strings are - * listed here <http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR>. + * listed here <http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR>. * </p> */ public class GLRendererQuirks { - /** + /** * Crashes XServer when using double buffered PBuffer with GL_RENDERER: * <ul> * <li>Mesa DRI Intel(R) Sandybridge Desktop</li> @@ -52,23 +52,23 @@ public class GLRendererQuirks { * For now, it is safe to disable it w/ hw-acceleration. */ public static final int NoDoubleBufferedPBuffer = 0; - + /** On Windows no double buffered bitmaps are guaranteed to be available. */ public static final int NoDoubleBufferedBitmap = 1; /** Crashes application when trying to set EGL swap interval on Android 4.0.3 / Pandaboard ES / PowerVR SGX 540 */ public static final int NoSetSwapInterval = 2; - + /** No offscreen bitmap available, currently true for JOGL's OSX implementation. */ public static final int NoOffscreenBitmap = 3; - + /** SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) */ public static final int NoSetSwapIntervalPostRetarget = 4; /** GLSL <code>discard</code> command leads to undefined behavior or won't get compiled if being used. Appears to <i>have</i> happened on Nvidia Tegra2, but seems to be fine now. FIXME: Constrain version. */ public static final int GLSLBuggyDiscard = 5; - - /** + + /** * Non compliant GL context due to a buggy implementation not suitable for use. * <p> * Currently, Mesa >= 9.1.3 (may extend back as far as 9.0) OpenGL 3.1 compatibility @@ -82,19 +82,19 @@ public class GLRendererQuirks { * </ul> * </p> * <p> - * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought. + * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought. */ public static final int GLNonCompliant = 6; - + /** * The OpenGL Context needs a <code>glFlush()</code> before releasing it, otherwise driver may freeze: * <ul> * <li>OSX < 10.7.3 - NVidia Driver. Bug 533 and Bug 548 @ https://jogamp.org/bugzilla/.</li> - * </ul> + * </ul> */ public static final int GLFlushBeforeRelease = 7; - - /** + + /** * Closing X11 displays may cause JVM crashes or X11 errors with some buggy drivers * while being used in concert w/ OpenGL. * <p> @@ -123,14 +123,14 @@ public class GLRendererQuirks { * </p> */ public static final int DontCloseX11Display = 8; - + /** - * Need current GL Context when calling new ARB <i>pixel format query</i> functions, + * Need current GL Context when calling new ARB <i>pixel format query</i> functions, * otherwise driver crashes the VM. * <p> * Drivers known exposing such bug: * <ul> - * <li>ATI proprietary Catalyst driver on Windows version ≤ XP. + * <li>ATI proprietary Catalyst driver on Windows version ≤ XP. * TODO: Validate if bug actually relates to 'old' ATI Windows drivers for old GPU's like X300 * regardless of the Windows version.</li> * </ul> @@ -139,7 +139,7 @@ public class GLRendererQuirks { * </p> */ public static final int NeedCurrCtx4ARBPixFmtQueries = 9; - + /** * Need current GL Context when calling new ARB <i>CreateContext</i> function, * otherwise driver crashes the VM. @@ -159,14 +159,14 @@ public class GLRendererQuirks { * </p> */ public static final int NeedCurrCtx4ARBCreateContext = 10; - + /** * No full FBO support, i.e. not compliant w/ - * <ul> + * <ul> * <li>GL_ARB_framebuffer_object</li> - * <li>EXT_framebuffer_object</li> - * <li>EXT_framebuffer_multisample</li> - * <li>EXT_framebuffer_blit</li> + * <li>EXT_framebuffer_object</li> + * <li>EXT_framebuffer_multisample</li> + * <li>EXT_framebuffer_blit</li> * <li>EXT_packed_depth_stencil</li> * </ul>. * Drivers known exposing such bug: @@ -180,18 +180,18 @@ public class GLRendererQuirks { * Quirk can also be enabled via property: <code>jogl.fbo.force.min</code>. */ public static final int NoFullFBOSupport = 11; - + /** * GLSL is not compliant or even not stable (crash) * <ul> * <li>OSX < 10.7.0 (?) - NVidia Driver. Bug 818 @ https://jogamp.org/bugzilla/.</li> - * </ul> + * </ul> */ public static final int GLSLNonCompliant = 12; - + /** Number of quirks known. */ public static final int COUNT = 13; - + private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard", "GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display", @@ -218,7 +218,7 @@ public class GLRendererQuirks { bitmask |= 1 << quirk; } _bitmask = bitmask; - } + } /** * @param quirks a list of valid quirks @@ -233,7 +233,7 @@ public class GLRendererQuirks { } _bitmask = bitmask; } - + /** * @param quirk the quirk to be tested * @return true if quirk exist, otherwise false @@ -261,7 +261,7 @@ public class GLRendererQuirks { sb.append("]"); return sb; } - + public final String toString() { return toString(null).toString(); } @@ -273,7 +273,7 @@ public class GLRendererQuirks { public static void validateQuirk(int quirk) throws IllegalArgumentException { if( !( 0 <= quirk && quirk < COUNT ) ) { throw new IllegalArgumentException("Quirks must be in range [0.."+COUNT+"[, but quirk: "+quirk); - } + } } /** diff --git a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java index 321d4ee57..b98c4431d 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java +++ b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.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. @@ -31,12 +31,12 @@ package com.jogamp.opengl; * Interface adding a {@link GLEventListenerState} protocol to {@link GLAutoDrawable}s * or other self-contained compound types combining {@link GLDrawable}, {@link GLContext} and {@link GLEventListener}. * <p> - * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation - * of the {@link GLContext} state and it's associated {@link GLEventListener}. - * </p> + * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation + * of the {@link GLContext} state and it's associated {@link GLEventListener}. + * </p> */ public interface GLStateKeeper { - + /** Listener for preserve and restore notifications. */ public static interface Listener { /** Invoked before preservation. */ @@ -44,14 +44,14 @@ public interface GLStateKeeper { /** Invoked after restoration. */ void glStateRestored(GLStateKeeper glsk); } - - /** + + /** * Sets a {@link Listener}, overriding the old one. * @param l the new {@link Listener}. * @return the previous {@link Listener}. */ public Listener setGLStateKeeperListener(Listener l); - + /** * @return <code>true</code> if GL state preservation is supported in implementation and on current platform, <code>false</code> otherwise. * @see #preserveGLStateAtDestroy(boolean) @@ -59,7 +59,7 @@ public interface GLStateKeeper { * @see #clearPreservedGLState() */ public boolean isGLStatePreservationSupported(); - + /** * If set to <code>true</code>, the next {@link GLAutoDrawable#destroy()} operation will * {@link #pullGLEventListenerState() pull} to preserve the {@link GLEventListenerState}. @@ -68,8 +68,8 @@ public interface GLStateKeeper { * the flag is cleared. * </p> * <p> - * A preserved {@link GLEventListenerState} will be {@link #pushGLEventListenerState() pushed} - * if realized again. + * A preserved {@link GLEventListenerState} will be {@link #pushGLEventListenerState() pushed} + * if realized again. * </p> * @return <code>true</code> if supported and successful, <code>false</code> otherwise. * @see #isGLStatePreservationSupported() @@ -77,21 +77,21 @@ public interface GLStateKeeper { * @see #clearPreservedGLState() */ public boolean preserveGLStateAtDestroy(boolean value); - + /** * Returns the preserved {@link GLEventListenerState} if preservation was performed, - * otherwise <code>null</code>. + * otherwise <code>null</code>. * @see #isGLStatePreservationSupported() * @see #preserveGLStateAtDestroy(boolean) * @see #clearPreservedGLState() */ public GLEventListenerState getPreservedGLState(); - + /** * Clears the preserved {@link GLEventListenerState} from this {@link GLStateKeeper}, without destroying it. - * + * * @return the preserved and cleared {@link GLEventListenerState} if preservation was performed, - * otherwise <code>null</code>. + * otherwise <code>null</code>. * @see #isGLStatePreservationSupported() * @see #preserveGLStateAtDestroy(boolean) * @see #getPreservedGLState() diff --git a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java index 73ec10886..3693f647a 100644 --- a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java +++ b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.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. @@ -37,7 +37,7 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser; * otherwise uses {@link DefaultGLCapabilitiesChooser} implementation. */ public class GenericGLCapabilitiesChooser extends DefaultGLCapabilitiesChooser { - + @Override public int chooseCapabilities(final CapabilitiesImmutable desired, final List<? extends CapabilitiesImmutable> available, diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index 1f0189aa3..1f715c21a 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.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 com.jogamp.opengl; import com.jogamp.common.GlueGenVersion; @@ -90,16 +90,16 @@ public class JoglVersion extends JogampVersion { sb.append("\tnone").append(Platform.getNewline()); } sb.append(Platform.getNewline()); - return sb; + return sb; } - + public static StringBuilder getAllAvailableCapabilitiesInfo(AbstractGraphicsDevice device, StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } if(null == device) { device = GLProfile.getDefaultDevice(); - } + } sb.append(Platform.getNewline()).append(Platform.getNewline()); sb.append("Desktop Capabilities: ").append(Platform.getNewline()); getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb); @@ -107,7 +107,7 @@ public class JoglVersion extends JogampVersion { getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb); return sb; } - + public static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, boolean withCapabilitiesInfo) { if(null==sb) { sb = new StringBuilder(); @@ -126,7 +126,7 @@ public class JoglVersion extends JogampVersion { } return sb; } - + public static StringBuilder getGLInfo(GL gl, StringBuilder sb) { return getGLInfo(gl, sb, false); } @@ -136,26 +136,26 @@ public class JoglVersion extends JogampVersion { if(null==sb) { sb = new StringBuilder(); } - + sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline()); sb.append(device.getClass().getSimpleName()).append("[type ") .append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ").append(Platform.getNewline()); - GLProfile.glAvailabilityToString(device, sb, "\t", 1); + GLProfile.glAvailabilityToString(device, sb, "\t", 1); sb.append(Platform.getNewline()); sb = getGLStrings(gl, sb, withCapabilitiesAndExtensionInfo); - + if( withCapabilitiesAndExtensionInfo ) { - sb = getAllAvailableCapabilitiesInfo(device, sb); + sb = getAllAvailableCapabilitiesInfo(device, sb); } return sb; } - + public static StringBuilder getGLStrings(GL gl, StringBuilder sb) { return getGLStrings(gl, sb, true); } - - public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) { + + public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) { if(null==sb) { sb = new StringBuilder(); } @@ -175,7 +175,7 @@ public class JoglVersion extends JogampVersion { sb.append("GL_RENDERER ").append(gl.glGetString(GL.GL_RENDERER)); sb.append(Platform.getNewline()); sb.append("GL_VERSION ").append(gl.glGetString(GL.GL_VERSION)); - sb.append(Platform.getNewline()); + sb.append(Platform.getNewline()); sb.append("GLSL ").append(gl.hasGLSL()).append(", has-compiler-func: ").append(gl.isFunctionAvailable("glCompileShader")); if(gl.hasGLSL()) { sb.append(", version: ").append(gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION)).append(" / ").append(ctx.getGLSLVersionNumber()); @@ -200,7 +200,7 @@ public class JoglVersion extends JogampVersion { return sb; } - public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) { + public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } @@ -216,7 +216,7 @@ public class JoglVersion extends JogampVersion { sb.append(Platform.getNewline()); return sb; } - + public static void main(String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java index ca4846939..8d2d07d58 100644 --- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.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 com.jogamp.opengl.cg; import com.jogamp.common.jvm.JNILibLoaderBase; @@ -45,15 +45,15 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { Platform.initSingleton(); - + if(TempJarCache.isInitialized()) { // only: jogl-cg.jar -> jogl-cg-natives-<os.and.arch>.jar [atomic JAR files only] - JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { CgDynamicLibraryBundleInfo.class }, null, null ); + JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { CgDynamicLibraryBundleInfo.class }, null, null ); } return null; } }); - + glueLibNames = new ArrayList<String>(); // glueLibNames.addAll(getGlueLibNamesPreload()); glueLibNames.add("jogl_cg"); @@ -76,7 +76,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf * <p> * Returns <code>false</code>. * </p> - */ + */ @Override public final boolean shallLookupGlobal() { return false; } @@ -91,7 +91,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { return 0; } - + @Override public final boolean useToolGetProcAdressFirst(String funcName) { return false; @@ -103,7 +103,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf final List<String> libsCg = new ArrayList<String>(); libsCg.add("Cg"); libsList.add(libsCg); - + final List<String> libsCgGL = new ArrayList<String>(); libsCgGL.add("CgGL"); libsList.add(libsCgGL); @@ -119,7 +119,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf @Override public final RunnableExecutor getLibLoaderExecutor() { return DynamicLibraryBundle.getDefaultRunnableExecutor(); - } + } } diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java index 8bfd9e23e..3e42f4d70 100644 --- a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java +++ b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java index e0acfec28..b7dbf183f 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2009 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,7 +28,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 com.jogamp.opengl.math; diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java index f3f44f15a..191a83241 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java @@ -40,7 +40,7 @@ import com.jogamp.common.os.Platform; * <p> * Derived from ProjectFloat.java - Created 11-jan-2004 * </p> - * + * * @author Erik Duijs * @author Kenneth Russell * @author Sven Gothel @@ -95,7 +95,7 @@ public class FloatUtil { m.put(ZERO_MATRIX); m.position(oldPos); } - + /** * @param a 4x4 matrix in column-major order * @param b 4x4 matrix in column-major order @@ -111,7 +111,7 @@ public class FloatUtil { d[d_off+i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ; } } - + /** * @param a 4x4 matrix in column-major order (also result) * @param b 4x4 matrix in column-major order @@ -127,7 +127,7 @@ public class FloatUtil { a[a_off_i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ; } } - + /** * @param a 4x4 matrix in column-major order * @param b 4x4 matrix in column-major order @@ -151,7 +151,7 @@ public class FloatUtil { * @param d result a*b in column-major order */ public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off, FloatBuffer d) { - final int aP = a.position(); + final int aP = a.position(); final int dP = d.position(); for (int i = 0; i < 4; i++) { // one row in column-major order @@ -162,13 +162,13 @@ public class FloatUtil { d.put(dP+i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ); } } - + /** * @param a 4x4 matrix in column-major order (also result) * @param b 4x4 matrix in column-major order */ public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off) { - final int aP = a.position(); + final int aP = a.position(); for (int i = 0; i < 4; i++) { // one row in column-major order final int aP_i = aP+i; @@ -186,7 +186,7 @@ public class FloatUtil { * @param d result a*b in column-major order */ public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, FloatBuffer d) { - final int aP = a.position(); + final int aP = a.position(); final int bP = b.position(); final int dP = d.position(); for (int i = 0; i < 4; i++) { @@ -198,13 +198,13 @@ public class FloatUtil { d.put(dP+i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) ); } } - + /** * @param a 4x4 matrix in column-major order (also result) * @param b 4x4 matrix in column-major order */ public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b) { - final int aP = a.position(); + final int aP = a.position(); final int bP = b.position(); for (int i = 0; i < 4; i++) { // one row in column-major order @@ -216,14 +216,14 @@ public class FloatUtil { a.put(aP_i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) ); } } - + /** * @param a 4x4 matrix in column-major order * @param b 4x4 matrix in column-major order * @param d result a*b in column-major order */ public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, float[] d, int d_off) { - final int aP = a.position(); + final int aP = a.position(); final int bP = b.position(); for (int i = 0; i < 4; i++) { // one row in column-major order @@ -234,7 +234,7 @@ public class FloatUtil { d[d_off+i+3*4] = ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) ; } } - + /** * Normalize vector * @@ -242,7 +242,7 @@ public class FloatUtil { */ public static final void normalize(float[] v) { float r = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - + if ( r == 0.0 || r == 1.0) { return; } @@ -265,7 +265,7 @@ public class FloatUtil { float r = (float) Math.sqrt(v.get(0+vPos) * v.get(0+vPos) + v.get(1+vPos) * v.get(1+vPos) + v.get(2+vPos) * v.get(2+vPos)); - + if ( r == 0.0 || r == 1.0) { return; } @@ -341,7 +341,7 @@ public class FloatUtil { v_in[3] * m_in[3*4+i]; } } - + /** * @param m_in 4x4 matrix in column-major order * @param v_in 4-component column-vector @@ -355,10 +355,10 @@ public class FloatUtil { v_in[0+v_in_off] * m_in.get(0*4+i+matrixPos) + v_in[1+v_in_off] * m_in.get(1*4+i+matrixPos) + v_in[2+v_in_off] * m_in.get(2*4+i+matrixPos) + - v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos); + v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos); } } - + /** * @param m_in 4x4 matrix in column-major order * @param v_in 4-component column-vector @@ -372,10 +372,10 @@ public class FloatUtil { v_in[0] * m_in.get(0*4+i+matrixPos) + v_in[1] * m_in.get(1*4+i+matrixPos) + v_in[2] * m_in.get(2*4+i+matrixPos) + - v_in[3] * m_in.get(3*4+i+matrixPos); + v_in[3] * m_in.get(3*4+i+matrixPos); } } - + /** * @param m_in 4x4 matrix in column-major order * @param v_in 4-component column-vector @@ -395,7 +395,7 @@ public class FloatUtil { } } - /** + /** * @param sb optional passed StringBuilder instance to be used * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a mxn matrix (rows x columns) @@ -403,7 +403,7 @@ public class FloatUtil { * @param rows * @param columns * @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL) - * @param row row number to print + * @param row row number to print * @return matrix row string representation */ public static StringBuilder matrixRowToString(StringBuilder sb, String f, FloatBuffer a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) { @@ -413,17 +413,17 @@ public class FloatUtil { final int a0 = aOffset + a.position(); if(rowMajorOrder) { for(int c=0; c<columns; c++) { - sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) ); + sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) ); } } else { for(int r=0; r<columns; r++) { - sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) ); + sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) ); } } return sb; } - /** + /** * @param sb optional passed StringBuilder instance to be used * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a mxn matrix (rows x columns) @@ -431,7 +431,7 @@ public class FloatUtil { * @param rows * @param columns * @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL) - * @param row row number to print + * @param row row number to print * @return matrix row string representation */ public static StringBuilder matrixRowToString(StringBuilder sb, String f, float[] a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) { @@ -440,19 +440,19 @@ public class FloatUtil { } if(rowMajorOrder) { for(int c=0; c<columns; c++) { - sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) ); + sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) ); } } else { for(int r=0; r<columns; r++) { - sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) ); + sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) ); } } return sb; } - - /** + + /** * @param sb optional passed StringBuilder instance to be used - * @param rowPrefix optional prefix for each row + * @param rowPrefix optional prefix for each row * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a mxn matrix (rows x columns) * @param aOffset offset to <code>a</code>'s current position @@ -469,14 +469,14 @@ public class FloatUtil { for(int i=0; i<rows; i++) { sb.append(prefix).append("[ "); matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i); - sb.append("]").append(Platform.getNewline()); + sb.append("]").append(Platform.getNewline()); } return sb; } - /** + /** * @param sb optional passed StringBuilder instance to be used - * @param rowPrefix optional prefix for each row + * @param rowPrefix optional prefix for each row * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a mxn matrix (rows x columns) * @param aOffset offset to <code>a</code>'s current position @@ -493,14 +493,14 @@ public class FloatUtil { for(int i=0; i<rows; i++) { sb.append(prefix).append("[ "); matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i); - sb.append("]").append(Platform.getNewline()); + sb.append("]").append(Platform.getNewline()); } return sb; } - - /** + + /** * @param sb optional passed StringBuilder instance to be used - * @param rowPrefix optional prefix for each row + * @param rowPrefix optional prefix for each row * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a 4x4 matrix in column major order (OpenGL) * @param aOffset offset to <code>a</code>'s current position @@ -521,14 +521,14 @@ public class FloatUtil { matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i); sb.append("=?= "); matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i); - sb.append("]").append(Platform.getNewline()); + sb.append("]").append(Platform.getNewline()); } return sb; } - /** + /** * @param sb optional passed StringBuilder instance to be used - * @param rowPrefix optional prefix for each row + * @param rowPrefix optional prefix for each row * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a 4x4 matrix in column major order (OpenGL) * @param aOffset offset to <code>a</code>'s current position @@ -549,11 +549,11 @@ public class FloatUtil { matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i); sb.append("=?= "); matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i); - sb.append("]").append(Platform.getNewline()); + sb.append("]").append(Platform.getNewline()); } return sb; } - + public static final float E = 2.7182818284590452354f; public static final float PI = 3.14159265358979323846f; @@ -569,5 +569,5 @@ public class FloatUtil { public static float acos(float a) { return (float) java.lang.Math.acos(a); } public static float sqrt(float a) { return (float) java.lang.Math.sqrt(a); } - + }
\ No newline at end of file diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java index c6bf44f6d..78cbb18cf 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java @@ -33,7 +33,7 @@ public class Quaternion { public Quaternion() { setIdentity(); } - + public Quaternion(Quaternion q) { x = q.x; y = q.y; @@ -50,7 +50,7 @@ public class Quaternion { /** * Constructor to create a rotation based quaternion from two vectors - * + * * @param vector1 * @param vector2 */ @@ -59,7 +59,7 @@ public class Quaternion { final float[] cross = VectorUtil.cross(vector1, vector2); fromAxis(cross, theta); } - + /*** * Constructor to create a rotation based quaternion from axis vector and angle * @param vector axis vector @@ -69,10 +69,10 @@ public class Quaternion { public Quaternion(float[] vector, float angle) { fromAxis(vector, angle); } - + /*** * Initialize this quaternion with given axis vector and rotation angle - * + * * @param vector axis vector * @param angle rotation angle (rads) */ @@ -88,7 +88,7 @@ public class Quaternion { /** * Transform the rotational quaternion to axis based rotation angles - * + * * @return new float[4] with ,theta,Rx,Ry,Rz */ public float[] toAxis() { @@ -135,7 +135,7 @@ public class Quaternion { /** * Add a quaternion - * + * * @param q quaternion */ public void add(Quaternion q) { @@ -146,7 +146,7 @@ public class Quaternion { /** * Subtract a quaternion - * + * * @param q quaternion */ public void subtract(Quaternion q) { @@ -157,7 +157,7 @@ public class Quaternion { /** * Divide a quaternion by a constant - * + * * @param n a float to divide by */ public void divide(float n) { @@ -168,7 +168,7 @@ public class Quaternion { /** * Multiply this quaternion by the param quaternion - * + * * @param q a quaternion to multiply with */ public void mult(Quaternion q) { @@ -186,7 +186,7 @@ public class Quaternion { /** * Multiply a quaternion by a constant - * + * * @param n a float constant */ public void mult(float n) { @@ -194,10 +194,10 @@ public class Quaternion { y *= n; z *= n; } - + /*** * Rotate given vector by this quaternion - * + * * @param vector input vector * @return rotated vector */ @@ -250,7 +250,7 @@ public class Quaternion { /** * Transform this quaternion to a 4x4 column matrix representing the * rotation - * + * * @return new float[16] column matrix 4x4 */ public float[] toMatrix() { @@ -287,7 +287,7 @@ public class Quaternion { * See http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/ * quaternions/slerp/ * </p> - * + * * @param a initial quaternion * @param b target quaternion * @param t float between 0 and 1 representing interp. @@ -332,13 +332,13 @@ public class Quaternion { /** * Check if this quaternion represents an identity matrix for rotation, * , ie (0,0,0,1). - * + * * @return true if it is an identity rep., false otherwise */ public boolean isIdentity() { return w == 1 && x == 0 && y == 0 && z == 0; } - + /*** * Set this quaternion to identity (x=0,y=0,z=0,w=1) */ @@ -349,7 +349,7 @@ public class Quaternion { /** * compute the quaternion from a 3x3 column matrix - * + * * @param m 3x3 column matrix */ public void setFromMatrix(float[] m) { @@ -386,7 +386,7 @@ public class Quaternion { /** * Check if the the 3x3 matrix (param) is in fact an affine rotational * matrix - * + * * @param m 3x3 column matrix * @return true if representing a rotational matrix, false otherwise */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java index 0033afeaa..508f1aafd 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java @@ -39,7 +39,7 @@ public class VectorUtil { Winding(int dir) { this.dir = dir; } - } + } public static final int COLLINEAR = 0; @@ -119,15 +119,15 @@ public class VectorUtil { /** Column Matrix Vector multiplication * @param colMatrix column matrix (4x4) * @param vec vector(x,y,z) - * @return result new float[3] + * @return result new float[3] */ public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec) { final float[] out = new float[3]; - out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12]; - out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13]; - out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14]; + out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12]; + out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13]; + out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14]; return out; } @@ -135,15 +135,15 @@ public class VectorUtil { /** Matrix Vector multiplication * @param rawMatrix column matrix (4x4) * @param vec vector(x,y,z) - * @return result new float[3] + * @return result new float[3] */ public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec) { final float[] out = new float[3]; - out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3]; - out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7]; - out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11]; + out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3]; + out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7]; + out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11]; return out; } @@ -157,7 +157,7 @@ public class VectorUtil { { return (p1+p2)/2.0f; } - + /** Calculate the midpoint of two points * @param p1 first point * @param p2 second point @@ -172,7 +172,7 @@ public class VectorUtil { return midPoint; } - + /** Compute the norm of a vector * @param vec vector * @return vorm @@ -181,7 +181,7 @@ public class VectorUtil { { return FloatUtil.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); } - + /** Compute distance between 2 points * @param p0 a ref point on the line * @param vec vector representing the direction of the line @@ -216,7 +216,7 @@ public class VectorUtil { */ public static boolean checkEqualityVec2(float[] v1, float[] v2) { - return Float.compare(v1[0], v2[0]) == 0 && + return Float.compare(v1[0], v2[0]) == 0 && Float.compare(v1[1], v2[1]) == 0 ; } @@ -261,7 +261,7 @@ public class VectorUtil { * @param b triangle vertex 2 * @param c triangle vertex 3 * @param d vertex in question - * @return true if the vertex d is inside the circle defined by the + * @return true if the vertex d is inside the circle defined by the * vertices a, b, c. from paper by Guibas and Stolfi (1985). */ public static boolean inCircle(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d){ @@ -282,8 +282,8 @@ public class VectorUtil { return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX()); } - /** Check if a vertex is in triangle using - * barycentric coordinates computation. + /** Check if a vertex is in triangle using + * barycentric coordinates computation. * @param a first triangle vertex * @param b second triangle vertex * @param c third triangle vertex @@ -291,7 +291,7 @@ public class VectorUtil { * @return true if p is in triangle (a, b, c), false otherwise. */ public static boolean vertexInTriangle(float[] a, float[] b, float[] c, float[] p){ - // Compute vectors + // Compute vectors final float[] ac = computeVector(a, c); //v0 final float[] ab = computeVector(a, b); //v1 final float[] ap = computeVector(a, p); //v2 @@ -362,13 +362,13 @@ public class VectorUtil { * @param b vertex 2 of first segment * @param c vertex 1 of second segment * @param d vertex 2 of second segment - * @return the intersection coordinates if the segments intersect, otherwise - * returns null + * @return the intersection coordinates if the segments intersect, otherwise + * returns null */ public static float[] seg2SegIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) { final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX()); - if (determinant == 0) + if (determinant == 0) return null; final float alpha = (a.getX()*b.getY()-a.getY()*b.getX()); @@ -389,13 +389,13 @@ public class VectorUtil { * @param b vertex 2 of first line * @param c vertex 1 of second line * @param d vertex 2 of second line - * @return the intersection coordinates if the lines intersect, otherwise - * returns null + * @return the intersection coordinates if the lines intersect, otherwise + * returns null */ public static float[] line2lineIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) { final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX()); - if (determinant == 0) + if (determinant == 0) return null; final float alpha = (a.getX()*b.getY()-a.getY()*b.getX()); diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java index 13349884c..ec90b401f 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java @@ -33,7 +33,7 @@ public interface Vert2fImmutable { float getY(); int getCoordCount(); - + float[] getCoord(); - + } diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java index b6e8ede2e..f1880a61b 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java @@ -32,23 +32,23 @@ import com.jogamp.opengl.math.VectorUtil; /** * Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high) - * The low being the the lower left corner of the box, and the high being the upper + * The low being the the lower left corner of the box, and the high being the upper * right corner of the box. - * + * */ public class AABBox implements Cloneable { private float[] low = new float[3]; private float[] high = new float[3]; private float[] center = new float[3]; - /** Create a Axis Aligned bounding box (AABBox) + /** Create a Axis Aligned bounding box (AABBox) * where the low and and high MAX float Values. */ public AABBox() { reset(); } - /** Create an AABBox specifying the coordinates + /** Create an AABBox specifying the coordinates * of the low and high * @param lx min x-coordinate * @param ly min y-coordnate @@ -61,7 +61,7 @@ public class AABBox implements Cloneable { float hx, float hy, float hz) { setSize(lx, ly, lz, hx, hy, hz); } - + /** Create a AABBox defining the low and high * @param low min xyz-coordinates * @param high max xyz-coordinates @@ -78,27 +78,27 @@ public class AABBox implements Cloneable { center[1] = 0f; center[2] = 0f; } - + /** Get the max xyz-coordinates * @return a float array containing the max xyz coordinates */ public final float[] getHigh() { return high; } - + private final void setHigh(float hx, float hy, float hz) { this.high[0] = hx; this.high[1] = hy; this.high[2] = hz; } - + /** Get the min xyz-coordinates * @return a float array containing the min xyz coordinates */ public final float[] getLow() { return low; } - + private final void setLow(float lx, float ly, float lz) { this.low[0] = lx; this.low[1] = ly; @@ -111,10 +111,10 @@ public class AABBox implements Cloneable { center[2] = (high[2] + low[2])/2; } - /** - * Set size of the AABBox specifying the coordinates + /** + * Set size of the AABBox specifying the coordinates * of the low and high. - * + * * @param lx min x-coordinate * @param ly min y-coordnate * @param lz min z-coordinate @@ -123,7 +123,7 @@ public class AABBox implements Cloneable { * @param hz max z-coordinate */ public final void setSize(float lx, float ly, float lz, - float hx, float hy, float hz) { + float hx, float hy, float hz) { this.low[0] = lx; this.low[1] = ly; this.low[2] = lz; @@ -132,7 +132,7 @@ public class AABBox implements Cloneable { this.high[2] = hz; computeCenter(); } - + /** Resize the AABBox to encapsulate another AABox * @param newBox AABBox to be encapsulated in */ @@ -160,12 +160,12 @@ public class AABBox implements Cloneable { } /** Resize the AABBox to encapsulate the passed - * xyz-coordinates. + * xyz-coordinates. * @param x x-axis coordinate value * @param y y-axis coordinate value * @param z z-axis coordinate value */ - public final void resize(float x, float y, float z) { + public final void resize(float x, float y, float z) { /** test low */ if (x < low[0]) low[0] = x; @@ -181,12 +181,12 @@ public class AABBox implements Cloneable { high[1] = y; if (z > high[2]) high[2] = z; - + computeCenter(); } /** Resize the AABBox to encapsulate the passed - * xyz-coordinates. + * xyz-coordinates. * @param xyz xyz-axis coordinate values * @param offset of the array */ @@ -210,7 +210,7 @@ public class AABBox implements Cloneable { } return true; } - + /** Check if the xyz coordinates are bounded/contained * by this AABBox. * @param x x-axis coordinate value @@ -231,7 +231,7 @@ public class AABBox implements Cloneable { } return true; } - + /** Check if there is a common region between this AABBox and the passed * 2D region irrespective of z range * @param x lower left x-coord @@ -244,13 +244,13 @@ public class AABBox implements Cloneable { if (w <= 0 || h <= 0) { return false; } - + final float _w = getWidth(); - final float _h = getHeight(); + final float _h = getHeight(); if (_w <= 0 || _h <= 0) { return false; } - + final float x0 = getMinX(); final float y0 = getMinY(); return (x + w > x0 && @@ -259,8 +259,8 @@ public class AABBox implements Cloneable { y < y0 + _h); } - - /** Get the size of the Box where the size is represented by the + + /** Get the size of the Box where the size is represented by the * length of the vector between low and high. * @return a float representing the size of the AABBox */ @@ -283,16 +283,16 @@ public class AABBox implements Cloneable { diffH[0] = high[0] - center[0]; diffH[1] = high[1] - center[1]; diffH[2] = high[2] - center[2]; - + diffH = VectorUtil.scale(diffH, size); - + float[] diffL = new float[3]; diffL[0] = low[0] - center[0]; diffL[1] = low[1] - center[1]; diffL[2] = low[2] - center[2]; - + diffL = VectorUtil.scale(diffL, size); - + high = VectorUtil.vectorAdd(center, diffH); low = VectorUtil.vectorAdd(center, diffL); } @@ -300,43 +300,43 @@ public class AABBox implements Cloneable { public final float getMinX() { return low[0]; } - + public final float getMinY() { return low[1]; } - + public final float getMinZ() { return low[2]; } - + public final float getMaxX() { return high[0]; } - + public final float getMaxY() { return high[1]; } - + public final float getMaxZ() { return high[2]; } - + public final float getWidth(){ return high[0] - low[0]; } - + public final float getHeight() { return high[1] - low[1]; } - + public final float getDepth() { return high[2] - low[2]; } - + public final AABBox clone() { return new AABBox(this.low, this.high); } - + public final boolean equals(Object obj) { if( obj == this ) { return true; @@ -344,11 +344,11 @@ public class AABBox implements Cloneable { if( null == obj || !(obj instanceof AABBox) ) { return false; } - final AABBox other = (AABBox) obj; - return VectorUtil.checkEquality(low, other.low) && + final AABBox other = (AABBox) obj; + return VectorUtil.checkEquality(low, other.low) && VectorUtil.checkEquality(high, other.high) ; } - + public final String toString() { return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+ center[0]+"/"+center[1]+"/"+center[1]+" ]"; diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java index 93e68a1d6..fb311083f 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java @@ -30,11 +30,11 @@ package com.jogamp.opengl.math.geom; import com.jogamp.common.os.Platform; /** - * Providing frustum {@link #getPlanes() planes} derived by different inputs + * Providing frustum {@link #getPlanes() planes} derived by different inputs * ({@link #updateByPMV(float[], int) P*MV}, ..) - * used to {@link #classifySphere(float[], float) classify objects} and to test + * used to {@link #classifySphere(float[], float) classify objects} and to test * whether they are {@link #isOutside(AABBox) outside}. - * + * * <p> * Extracting the world-frustum planes from the P*Mv: * <pre> @@ -54,7 +54,7 @@ import com.jogamp.common.os.Platform; * Lighthouse3d.com * http://www.lighthouse3d.com/tutorials/view-frustum-culling/ * </pre> - * + * * Fundamentals about Planes, Half-Spaces and Frustum-Culling:<br/> * <pre> * Planes and Half-Spaces, Max Wagner <[email protected]> @@ -69,7 +69,7 @@ import com.jogamp.common.os.Platform; public class Frustum { /** Normalized planes[l, r, b, t, n, f] */ protected Plane[] planes = new Plane[6]; - + /** * Creates an undefined instance w/o calculating the frustum. * <p> @@ -83,35 +83,35 @@ public class Frustum { planes[i] = new Plane(); } } - - /** + + /** * Plane equation := dot(n, x - p) = 0 -> ax + bc + cx + d == 0 * <p> * In order to work w/ {@link Frustum#isOutside(AABBox) isOutside(..)} methods, * the normals have to point to the inside of the frustum. - * </p> + * </p> */ public static class Plane { /** Normal of the plane */ public final float[] n = new float[3]; - + /** Distance to origin */ public float d; - /** + /** * Return signed distance of plane to given point. * <ul> * <li>If dist < 0 , then the point p lies in the negative halfspace.</li> * <li>If dist = 0 , then the point p lies in the plane.</li> * <li>If dist > 0 , then the point p lies in the positive halfspace.</li> - * </ul> + * </ul> * A plane cuts 3D space into 2 half spaces. * <p> * Positive halfspace is where the plane’s normals vector points into. - * </p> + * </p> * <p> * Negative halfspace is the <i>other side</i> of the plane, i.e. *-1 - * </p> + * </p> **/ public final float distanceTo(float x, float y, float z) { return n[0] * x + n[1] * y + n[2] * z + d; @@ -121,13 +121,13 @@ public class Frustum { public final float distanceTo(float[] p) { return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d; } - + @Override public String toString() { return "Plane[ [ " + n[0] + ", " + n[1] + ", " + n[2] + " ], " + d + "]"; } } - + /** Index for left plane: {@value} */ public static final int LEFT = 0; /** Index for right plane: {@value} */ @@ -140,7 +140,7 @@ public class Frustum { public static final int NEAR = 4; /** Index for far plane: {@value} */ public static final int FAR = 5; - + /** * {@link Plane}s are ordered in the returned array as follows: * <ul> @@ -154,17 +154,17 @@ public class Frustum { * <p> * {@link Plane}'s normals are pointing to the inside of the frustum * in order to work w/ {@link #isOutside(AABBox) isOutside(..)} methods. - * </p> - * - * @return array of normalized {@link Plane}s, order see above. + * </p> + * + * @return array of normalized {@link Plane}s, order see above. */ public final Plane[] getPlanes() { return planes; } - + /** * Copy the given <code>src</code> planes into this this instance's planes. * @param src the 6 source planes */ - public final void updateByPlanes(Plane[] src) { + public final void updateByPlanes(Plane[] src) { for (int i = 0; i < 6; ++i) { final Plane p0 = planes[i]; final float[] p0_n = p0.n; @@ -176,7 +176,7 @@ public class Frustum { p0.d = p1.d; } } - + /** * Calculate the frustum planes in world coordinates * using the passed float[16] as premultiplied P*MV (column major order). @@ -185,7 +185,7 @@ public class Frustum { * as required by this class. * </p> */ - public void updateByPMV(float[] pmv, int pmv_off) { + public void updateByPMV(float[] pmv, int pmv_off) { // Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] row-major // Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] row-major { @@ -264,11 +264,11 @@ public class Frustum { p.d /= invl; } } - + private static final boolean isOutsideImpl(Plane p, AABBox box) { final float[] low = box.getLow(); final float[] high = box.getHigh(); - + if ( p.distanceTo(low[0], low[1], low[2]) > 0.0f || p.distanceTo(high[0], low[1], low[2]) > 0.0f || p.distanceTo(low[0], high[1], low[2]) > 0.0f || @@ -298,19 +298,19 @@ public class Frustum { // We make no attempt to determine whether it's fully inside or not. return false; } - - + + public static enum Location { OUTSIDE, INSIDE, INTERSECT }; - + /** * Check to see if a point is outside, inside or on a plane of the frustum. - * + * * @param p the point * @return {@link Location} of point related to frustum planes */ public final Location classifyPoint(float[] p) { Location res = Location.INSIDE; - + for (int i = 0; i < 6; ++i) { final float d = planes[i].distanceTo(p); if ( d < 0.0f ) { @@ -321,43 +321,43 @@ public class Frustum { } return res; } - + /** * Check to see if a point is outside of the frustum. - * + * * @param p the point * @return true if outside of the frustum, otherwise inside or on a plane */ public final boolean isPointOutside(float[] p) { return Location.OUTSIDE == classifyPoint(p); } - + /** * Check to see if a sphere is outside, intersecting or inside of the frustum. - * + * * @param p center of the sphere * @param radius radius of the sphere * @return {@link Location} of point related to frustum planes */ public final Location classifySphere(float[] p, float radius) { Location res = Location.INSIDE; // fully inside - + for (int i = 0; i < 6; ++i) { final float d = planes[i].distanceTo(p); - if ( d < -radius ) { + if ( d < -radius ) { // fully outside return Location.OUTSIDE; } else if (d < radius ) { // intersecting res = Location.INTERSECT; } - } + } return res; } - + /** * Check to see if a sphere is outside of the frustum. - * + * * @param p center of the sphere * @param radius radius of the sphere * @return true if outside of the frustum, otherwise inside or intersecting @@ -365,7 +365,7 @@ public class Frustum { public final boolean isSphereOutside(float[] p, float radius) { return Location.OUTSIDE == classifySphere(p, radius); } - + public StringBuilder toString(StringBuilder sb) { if( null == sb ) { sb = new StringBuilder(); @@ -380,7 +380,7 @@ public class Frustum { .append("]"); return sb; } - + @Override public String toString() { return toString(null).toString(); diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index ff764d849..33941a407 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -102,11 +102,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { /* GL Stuff */ private final RecursiveLock lock = LockFactory.createRecursiveLock(); private final GLDrawableHelper helper = new GLDrawableHelper(); - + private final GLContext shareWith; private final GLCapabilitiesImmutable capsRequested; - private final GLCapabilitiesChooser capsChooser; - + private final GLCapabilitiesChooser capsChooser; + private volatile Rectangle clientArea; private volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access private volatile GLContextImpl context; @@ -156,7 +156,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public void run() { final RecursiveLock _lock = lock; _lock.lock(); - try { + try { if( !GLCanvas.this.isDisposed() ) { helper.invokeGL(drawable, context, displayAction, initAction); } @@ -215,7 +215,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { gle.printStackTrace(); } } - context = null; + context = null; } if ( null != drawable ) { drawable.setRealized(false); @@ -261,11 +261,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } } }; - - /** - * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)} + + /** + * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)} * on the SWT thread. - * + * * @param parent * Required (non-null) parent Composite. * @param style @@ -284,7 +284,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { */ public static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps, final GLCapabilitiesChooser chooser, final GLContext shareWith) { - final GLCanvas[] res = new GLCanvas[] { null }; + final GLCanvas[] res = new GLCanvas[] { null }; parent.getDisplay().syncExec(new Runnable() { public void run() { res[0] = new GLCanvas( parent, style, caps, chooser, shareWith ); @@ -319,22 +319,22 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { GLProfile.initSingleton(); // ensure JOGL is completly initialized SWTAccessor.setRealized(this, true); - + clientArea = GLCanvas.this.getClientArea(); - /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite). + /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite). * Note: SWT is owner of the native handle, hence closing operation will be a NOP. */ final AbstractGraphicsDevice swtDevice = SWTAccessor.getDevice(this); - + useX11GTK = SWTAccessor.useX11GTK(); if(useX11GTK) { - // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering + // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering final long x11DeviceHandle = X11Util.openDisplay(swtDevice.getConnection()); if( 0 == x11DeviceHandle ) { throw new RuntimeException("Error creating display(EDT): "+swtDevice.getConnection()); } final AbstractGraphicsDevice x11Device = new X11GraphicsDevice(x11DeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); - screen = SWTAccessor.getScreen(x11Device, -1 /* default */); + screen = SWTAccessor.getScreen(x11Device, -1 /* default */); } else { screen = SWTAccessor.getScreen(swtDevice, -1 /* default */); } @@ -343,7 +343,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { if(null == capsReqUser) { capsReqUser = new GLCapabilities(GLProfile.getDefault(screen.getDevice())); } - + this.capsRequested = capsReqUser; this.capsChooser = capsChooser; this.shareWith = shareWith; @@ -353,7 +353,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { x11Window = 0; drawable = null; context = null; - + final Listener listener = new Listener () { @Override public void handleEvent (Event event) { @@ -374,7 +374,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { addListener (SWT.Paint, listener); addListener (SWT.Dispose, listener); } - + private final UpstreamSurfaceHook swtCanvasUpStreamHook = new UpstreamSurfaceHook() { @Override public final void create(ProxySurface s) { /* nop */ } @@ -401,11 +401,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { protected final void updateSizeCheck() { final Rectangle oClientArea = clientArea; final Rectangle nClientArea = GLCanvas.this.getClientArea(); - if ( nClientArea != null && + if ( nClientArea != null && ( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height ) ) { clientArea = nClientArea; // write back new value - + final GLDrawableImpl _drawable = drawable; final boolean drawableOK = null != _drawable && _drawable.isRealized(); if(DEBUG) { @@ -419,14 +419,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { try { final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, nClientArea.width, nClientArea.height); if(_drawable != _drawableNew) { - // write back + // write back drawable = _drawableNew; } } finally { _lock.unlock(); } - } - } + } + } if(0 != x11Window) { SWTAccessor.resizeX11Window(screen.getDevice(), clientArea, x11Window); } else if(0 != gdkWindow) { @@ -435,36 +435,36 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock } } - + private boolean isValidAndVisibleOnEDTActionResult; private final Runnable isValidAndVisibleOnEDTAction = new Runnable() { @Override - public void run() { + public void run() { isValidAndVisibleOnEDTActionResult = !GLCanvas.this.isDisposed() && GLCanvas.this.isVisible(); } }; - + private final boolean isValidAndVisibleOnEDT() { synchronized(isValidAndVisibleOnEDTAction) { runOnEDTIfAvail(true, isValidAndVisibleOnEDTAction); return isValidAndVisibleOnEDTActionResult; } } - + /** assumes drawable == null || !drawable.isRealized() ! Checks of !isDispose() and isVisible() */ protected final boolean validateDrawableAndContextWithCheck() { if( !isValidAndVisibleOnEDT() ) { return false; } - return validateDrawableAndContextPostCheck(); + return validateDrawableAndContextPostCheck(); } - + /** assumes drawable == null || !drawable.isRealized() ! No check of !isDispose() and isVisible() */ protected final boolean validateDrawableAndContextPostCheck() { final Rectangle nClientArea = clientArea; if(0 >= nClientArea.width || 0 >= nClientArea.height) { return false; } - + final boolean res; final RecursiveLock _lock = lock; _lock.lock(); @@ -480,18 +480,18 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } } finally { _lock.unlock(); - } - + } + if(res) { sendReshape = true; if(DEBUG) { System.err.println("SWT GLCanvas realized! "+this+", "+drawable); // Thread.dumpStack(); - } + } } - return res; + return res; } - + private final void createDrawableAndContext() { final AbstractGraphicsDevice device = screen.getDevice(); device.open(); @@ -503,14 +503,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { capsRequested, capsRequested, capsChooser, screen, VisualIDHolder.VID_UNDEFINED); if(DEBUG) { System.err.println("SWT.GLCanvas.X11 factory: "+factory+", chosen config: "+cfg); - } + } if (null == cfg) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } final int visualID = cfg.getVisualID(VIDType.NATIVE); if( VisualIDHolder.VID_UNDEFINED != visualID ) { // gdkWindow = SWTAccessor.createCompatibleGDKChildWindow(this, visualID, clientArea.width, clientArea.height); - // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow); + // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow); x11Window = SWTAccessor.createCompatibleX11ChildWindow(screen, this, visualID, clientArea.width, clientArea.height); nativeWindowHandle = x11Window; } else { @@ -520,16 +520,16 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { nativeWindowHandle = SWTAccessor.getWindowHandle(this); } final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(capsRequested.getGLProfile()); - + // Create a NativeWindow proxy for the SWT canvas - ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle, + ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle, capsRequested, capsChooser, swtCanvasUpStreamHook); // Associate a GL surface with the proxy drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface); context = (GLContextImpl) drawable.createContext(shareWith); - context.setContextCreationFlags(additionalCtxCreationFlags); + context.setContextCreationFlags(additionalCtxCreationFlags); } - + @Override public void update() { // don't paint background etc .. nop avoids flickering @@ -543,13 +543,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { if(r && 0 != gdkWindow) { SWTGTKUtil.focusGDKWindow(gdkWindow); } - return r; + return r; } */ - + @Override public void dispose() { runInGLThread(disposeOnEDTGLAction); - super.dispose(); + super.dispose(); } private final void displayIfNoAnimatorNoCheck() { @@ -557,14 +557,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { final boolean drawableOK = null != drawable && drawable.isRealized(); if( drawableOK || validateDrawableAndContextPostCheck() ) { runInGLThread(makeCurrentAndDisplayOnGLAction); - } + } } } - + // // GL[Auto]Drawable // - + @Override public void display() { final boolean drawableOK = null != drawable && drawable.isRealized(); @@ -577,7 +577,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public final Object getUpstreamWidget() { return this; } - + @Override public int getWidth() { return clientArea.width; @@ -593,7 +593,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.isGLOriented() : true; } - + @Override public void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); @@ -608,29 +608,29 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public int getGLEventListenerCount() { return helper.getGLEventListenerCount(); } - + @Override public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } - + @Override public boolean getGLEventListenerInitState(GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } - + @Override public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } - + @Override public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); runInGLThread(r); return r.listener; } - + @Override public GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); @@ -673,7 +673,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public final GLDrawable getDelegatedDrawable() { return drawable; } - + @Override public GLContext getContext() { return null != drawable ? context : null; @@ -694,12 +694,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public boolean invoke(final boolean wait, final GLRunnable runnable) { return helper.invoke(this, wait, runnable); } - + @Override public boolean invoke(final boolean wait, final List<GLRunnable> runnables) { return helper.invoke(this, wait, runnables); } - + @Override public void setAnimator(final GLAnimatorControl arg0) throws GLException { helper.setAnimator(arg0); @@ -714,7 +714,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { final RecursiveLock _lock = lock; _lock.lock(); - try { + try { final GLContext oldCtx = context; GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags); context=(GLContextImpl)newCtx; @@ -761,7 +761,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { @Override public GLCapabilitiesImmutable getChosenGLCapabilities() { - final GLDrawable _drawable = drawable; + final GLDrawable _drawable = drawable; return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getChosenGLCapabilities() : null; } @@ -771,7 +771,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { * @return Non-null GLCapabilities. */ public GLCapabilitiesImmutable getRequestedGLCapabilities() { - final GLDrawable _drawable = drawable; + final GLDrawable _drawable = drawable; return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities() : null; } @@ -788,7 +788,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { @Override public long getHandle() { - final GLDrawable _drawable = drawable; + final GLDrawable _drawable = drawable; return (_drawable != null) ? _drawable.getHandle() : 0; } @@ -827,12 +827,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { * <ul> * <!--li>Use {@link Threading#invokeOnOpenGLThread(boolean, Runnable)}</li--> * <li>Current thread</li> - * </ul></li> + * </ul></li> * </ul> - * The current thread seems to be valid for all platforms, + * The current thread seems to be valid for all platforms, * since no SWT lifecycle tasks are being performed w/ this call. * Only GL task, which are independent from the SWT threading model. - * + * * @see Platform#AWT_AVAILABLE * @see Platform#getOSType() */ @@ -854,8 +854,8 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { } */ action.run(); } - - private void runOnEDTIfAvail(boolean wait, final Runnable action) { + + private void runOnEDTIfAvail(boolean wait, final Runnable action) { final Display d = isDisposed() ? null : getDisplay(); if( null == d || d.isDisposed() || d.getThread() == Thread.currentThread() ) { action.run(); @@ -879,7 +879,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { ",\n\tDrawable size "+dw+"x"+dh+ ",\n\tSWT size "+getWidth()+"x"+getHeight()+"]"; } - + public static void main(final String[] args) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java index 8de178e49..80289acf3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.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 diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 80d980492..cdfb73b21 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.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 @@ import javax.media.opengl.GLException; * Call {@link #stop() } to terminate the animation and it's execution thread. * </p> */ -public class Animator extends AnimatorBase { +public class Animator extends AnimatorBase { protected ThreadGroup threadGroup; private Runnable runnable; private boolean runAsFastAsPossible; @@ -75,7 +75,7 @@ public class Animator extends AnimatorBase { } } - /** + /** * Creates a new Animator w/ an associated ThreadGroup. */ public Animator(ThreadGroup tg) { @@ -86,7 +86,7 @@ public class Animator extends AnimatorBase { } } - /** + /** * Creates a new Animator for a particular drawable. */ public Animator(GLAutoDrawable drawable) { @@ -97,7 +97,7 @@ public class Animator extends AnimatorBase { } } - /** + /** * Creates a new Animator w/ an associated ThreadGroup for a particular drawable. */ public Animator(ThreadGroup tg, GLAutoDrawable drawable) { @@ -127,7 +127,7 @@ public class Animator extends AnimatorBase { stateSync.unlock(); } } - + private final void setIsAnimatingSynced(boolean v) { stateSync.lock(); try { @@ -185,7 +185,7 @@ public class Animator extends AnimatorBase { } if (!stopIssued && !isAnimating) { // Wakes up 'waitForStartedCondition' sync - // - and - + // - and - // Resume from pause or drawablesEmpty, // implies !pauseIssued and !drawablesEmpty setIsAnimatingSynced(true); // barrier @@ -251,7 +251,7 @@ public class Animator extends AnimatorBase { /** * Set a {@link ThreadGroup} for the {@link #getThread() animation thread}. - * + * * @param tg the {@link ThreadGroup} * @throws GLException if the animator has already been started */ @@ -261,7 +261,7 @@ public class Animator extends AnimatorBase { } threadGroup = tg; } - + public synchronized boolean start() { if ( isStartedImpl() ) { return false; @@ -277,7 +277,7 @@ public class Animator extends AnimatorBase { } else { thread = new Thread(threadGroup, runnable, threadName); } - thread.setDaemon(false); // force to be non daemon, regardless of parent thread + thread.setDaemon(false); // force to be non daemon, regardless of parent thread if(DEBUG) { final Thread ct = Thread.currentThread(); System.err.println("Animator "+ct.getName()+"[daemon "+ct.isDaemon()+"]: starting "+thread.getName()+"[daemon "+thread.isDaemon()+"]"); @@ -288,7 +288,7 @@ public class Animator extends AnimatorBase { private final Condition waitForStartedCondition = new Condition() { public boolean eval() { return !isStartedImpl() || (!drawablesEmpty && !isAnimating) ; - } }; + } }; public synchronized boolean stop() { if ( !isStartedImpl() ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index ef92100ad..b447a339b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -52,14 +52,14 @@ import javax.media.opengl.GLProfile; */ public abstract class AnimatorBase implements GLAnimatorControl { protected static final boolean DEBUG = Debug.debug("Animator"); - + /** A 1s timeout while waiting for a native action response, limiting {@link #finishLifecycleAction(Condition, long)} */ protected static final long TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 1000; - + protected static final long POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 32; // 2 frames @ 60Hz - + /** - * If present in <code>modeBits</code> field and + * If present in <code>modeBits</code> field and * {@link GLProfile#isAWTAvailable() AWT is available}, * implementation is aware of the AWT EDT, otherwise not. * <p> @@ -67,8 +67,8 @@ public abstract class AnimatorBase implements GLAnimatorControl { * </p> * @see #setModeBits(boolean, int) */ - public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0; - + public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0; + public interface AnimatorImpl { void display(ArrayList<GLAutoDrawable> drawables, boolean ignoreExceptions, boolean printExceptions); boolean blockUntilDone(Thread thread); @@ -77,7 +77,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { protected int modeBits; protected AnimatorImpl impl; protected String baseName; - + protected ArrayList<GLAutoDrawable> drawables = new ArrayList<GLAutoDrawable>(); protected boolean drawablesEmpty; protected Thread animThread; @@ -85,10 +85,10 @@ public abstract class AnimatorBase implements GLAnimatorControl { protected boolean printExceptions; protected boolean exclusiveContext; protected Thread userExclusiveContextThread; - protected FPSCounterImpl fpsCounter = new FPSCounterImpl(); + protected FPSCounterImpl fpsCounter = new FPSCounterImpl(); protected RecursiveLock stateSync = LockFactory.createRecursiveLock(); - - private final static Class<?> awtAnimatorImplClazz; + + private final static Class<?> awtAnimatorImplClazz; static { GLProfile.initSingleton(); if( GLProfile.isAWTAvailable() ) { @@ -96,7 +96,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { try { clazz = Class.forName("com.jogamp.opengl.util.AWTAnimatorImpl"); } catch (Exception e) { - clazz = null; + clazz = null; } awtAnimatorImplClazz = clazz; } else { @@ -105,29 +105,29 @@ public abstract class AnimatorBase implements GLAnimatorControl { } /** - * Creates a new, empty Animator instance + * Creates a new, empty Animator instance * while expecting an AWT rendering thread if AWT is available. - * + * * @see GLProfile#isAWTAvailable() */ public AnimatorBase() { - modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default! + modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default! drawablesEmpty = true; } - + private static final boolean useAWTAnimatorImpl(int modeBits) { return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz; } - + /** * Initializes implementation details post setup, * invoked at {@link #add(GLAutoDrawable)}, {@link #start()}, .. * <p> - * Operation is a NOP if <code>force</code> is <code>false</code> + * Operation is a NOP if <code>force</code> is <code>false</code> * and this instance is already initialized. - * </p> - * - * @throws GLException if Animator is {@link #isStarted()} + * </p> + * + * @throws GLException if Animator is {@link #isStarted()} */ protected synchronized void initImpl(boolean force) { if( force || null == impl ) { @@ -153,8 +153,8 @@ public abstract class AnimatorBase implements GLAnimatorControl { * in this Animators <code>modeBits</code>. * @param enable * @param bitValues - * - * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change + * + * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD */ public synchronized void setModeBits(boolean enable, int bitValues) throws GLException { @@ -172,8 +172,8 @@ public abstract class AnimatorBase implements GLAnimatorControl { } } public synchronized int getModeBits() { return modeBits; } - - + + @Override public synchronized void add(final GLAutoDrawable drawable) { if(DEBUG) { @@ -190,7 +190,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { drawables.add(drawable); drawablesEmpty = drawables.size() == 0; drawable.setAnimator(this); - if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true + if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true resume(); } final Condition waitForAnimatingAndECTCondition = new Condition() { @@ -213,7 +213,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { if( !drawables.contains(drawable) ) { throw new IllegalArgumentException("Drawable not added to animator: "+this+", "+drawable); } - + if( exclusiveContext && isAnimating() ) { drawable.setExclusiveContextThread( null ); final Condition waitForNullECTCondition = new Condition() { @@ -244,7 +244,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { return isStarted() && drawablesEmpty && isAnimating(); } }; - + /** * Dedicate all {@link GLAutoDrawable}'s context to the given exclusive context thread. * <p> @@ -252,14 +252,14 @@ public abstract class AnimatorBase implements GLAnimatorControl { * </p> * <p> * If already started and disabling, method waits - * until change is propagated to all {@link GLAutoDrawable} if not + * until change is propagated to all {@link GLAutoDrawable} if not * called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}. * </p> * <p> * Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation. * Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas. * </p> - * + * * @param enable * @return previous value * @see #setExclusiveContext(boolean) @@ -272,7 +272,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { final boolean enable = null != t; stateSync.lock(); try { - old = userExclusiveContextThread; + old = userExclusiveContextThread; if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae userExclusiveContextThread=t; } @@ -282,7 +282,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { setExclusiveContext(enable); return old; } - + /** * Dedicate all {@link GLAutoDrawable}'s context to this animator thread. * <p> @@ -290,14 +290,14 @@ public abstract class AnimatorBase implements GLAnimatorControl { * </p> * <p> * If already started and disabling, method waits - * until change is propagated to all {@link GLAutoDrawable} if not + * until change is propagated to all {@link GLAutoDrawable} if not * called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}. * </p> * <p> * Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation. * Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas. * </p> - * + * * @param enable * @return previous value * @see #setExclusiveContext(Thread) @@ -349,24 +349,24 @@ public abstract class AnimatorBase implements GLAnimatorControl { System.err.println("AnimatorBase.setExclusiveContextThread: all-GLAD Ok: "+validateDrawablesExclCtxState(dECT)+", "+this); } return oldExclusiveContext; - } - + } + /** * Returns <code>true</code>, if the exclusive context thread is enabled, otherwise <code>false</code>. - * + * * @see #setExclusiveContext(boolean) * @see #setExclusiveContext(Thread) */ // @Override - public final boolean isExclusiveContextEnabled() { + public final boolean isExclusiveContextEnabled() { stateSync.lock(); try { - return exclusiveContext; + return exclusiveContext; } finally { stateSync.unlock(); } } - + /** * Returns the exclusive context thread if {@link #isExclusiveContextEnabled()} and {@link #isStarted()}, otherwise <code>null</code>. * <p> @@ -381,7 +381,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @see #setExclusiveContext(Thread) */ // @Override - public final Thread getExclusiveContextThread() { + public final Thread getExclusiveContextThread() { stateSync.lock(); try { return ( isStartedImpl() && exclusiveContext ) ? ( null != userExclusiveContextThread ? userExclusiveContextThread : animThread ) : null ; @@ -389,7 +389,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { stateSync.unlock(); } } - + /** * Should be called at {@link #start()} and {@link #stop()} * from within the animator thread. @@ -407,7 +407,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { for (int i=0; i<drawables.size(); i++) { try { drawables.get(i).setExclusiveContextThread( enable ? ect : null ); - } catch (RuntimeException e) { + } catch (RuntimeException e) { e.printStackTrace(); } } @@ -420,7 +420,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } return true; } - + @Override public final Thread getThread() { stateSync.lock(); @@ -445,7 +445,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { public final void setUpdateFPSFrames(int frames, PrintStream out) { fpsCounter.setUpdateFPSFrames(frames, out); } - + @Override public final void resetFPSCounter() { fpsCounter.resetFPSCounter(); @@ -455,7 +455,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { public final int getUpdateFPSFrames() { return fpsCounter.getUpdateFPSFrames(); } - + @Override public final long getFPSStartTime() { return fpsCounter.getFPSStartTime(); @@ -470,12 +470,12 @@ public abstract class AnimatorBase implements GLAnimatorControl { public final long getLastFPSPeriod() { return fpsCounter.getLastFPSPeriod(); } - + @Override public final float getLastFPS() { return fpsCounter.getLastFPS(); } - + @Override public final int getTotalFPSFrames() { return fpsCounter.getTotalFPSFrames(); @@ -485,11 +485,11 @@ public abstract class AnimatorBase implements GLAnimatorControl { public final long getTotalFPSDuration() { return fpsCounter.getTotalFPSDuration(); } - + @Override public final float getTotalFPS() { return fpsCounter.getTotalFPS(); - } + } /** Sets a flag causing this Animator to ignore exceptions produced while redrawing the drawables. By default this flag is set to @@ -512,10 +512,10 @@ public abstract class AnimatorBase implements GLAnimatorControl { */ boolean eval(); } - + /** * @param waitCondition method will wait until TO is reached or {@link Condition#eval() waitCondition.eval()} returns <code>false</code>. - * @param pollPeriod if <code>0</code>, method will wait until TO is reached or being notified. + * @param pollPeriod if <code>0</code>, method will wait until TO is reached or being notified. * if > <code>0</code>, method will wait for the given <code>pollPeriod</code> in milliseconds. * @return <code>true</code> if {@link Condition#eval() waitCondition.eval()} returned <code>false</code>, otherwise <code>false</code>. */ @@ -545,11 +545,11 @@ public abstract class AnimatorBase implements GLAnimatorControl { if( remaining<=0 && nok ) { System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + getThreadName()); } - stateSync.lock(); // avoid too many lock/unlock ops + stateSync.lock(); // avoid too many lock/unlock ops try { System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+ "- pollPeriod "+pollPeriod+", blocking "+blocking+ - ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION + + ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION + " - " + getThreadName()); System.err.println(" - "+toString()); } finally { diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java index bbd2951b9..0477e1903 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.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 diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java index 7613efec6..b48169c27 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.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. */ @@ -45,10 +45,10 @@ import java.util.TimerTask; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLException; -/** +/** * An Animator subclass which attempts to achieve a target * frames-per-second rate to avoid using all CPU time. The target FPS - * is only an estimate and is not guaranteed. + * is only an estimate and is not guaranteed. * <p> * The Animator execution thread does not run as a daemon thread, * so it is able to keep an application from terminating.<br> @@ -105,45 +105,45 @@ public class FPSAnimator extends AnimatorBase { * @param fps * @throws GLException if the animator has already been started */ - public final synchronized void setFPS(int fps) throws GLException { + public final synchronized void setFPS(int fps) throws GLException { if ( isStartedImpl() ) { throw new GLException("Animator already started."); } - this.fps = fps; + this.fps = fps; } public final int getFPS() { return fps; } - + class MainTask extends TimerTask { private boolean justStarted; private boolean alreadyStopped; private boolean alreadyPaused; - + public MainTask() { } - + public void start(Timer timer) { fpsCounter.resetFPSCounter(); shouldRun = true; shouldStop = false; - + justStarted = true; alreadyStopped = false; alreadyPaused = false; - final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period + final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period if (scheduleAtFixedRate) { timer.scheduleAtFixedRate(this, 0, period); } else { timer.schedule(this, 0, period); } } - + public boolean isActive() { return !alreadyStopped && !alreadyPaused; } - + public String toString() { return "Task[thread "+animThread+", stopped "+alreadyStopped+", paused "+alreadyPaused+" shouldRun "+shouldRun+", shouldStop "+shouldStop+" -- started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]"; } - + public void run() { if( justStarted ) { justStarted = false; @@ -167,8 +167,8 @@ public class FPSAnimator extends AnimatorBase { display(); } else if( shouldStop ) { // STOP System.err.println("FPSAnimator P4: "+alreadyStopped+", "+ Thread.currentThread() + ": " + toString()); - this.cancel(); - + this.cancel(); + if( !alreadyStopped ) { alreadyStopped = true; if( exclusiveContext && !drawablesEmpty ) { @@ -184,23 +184,23 @@ public class FPSAnimator extends AnimatorBase { FPSAnimator.this.notifyAll(); } } - } else { + } else { System.err.println("FPSAnimator P5: "+alreadyPaused+", "+ Thread.currentThread() + ": " + toString()); this.cancel(); - + if( !alreadyPaused ) { // PAUSE alreadyPaused = true; if( exclusiveContext && !drawablesEmpty ) { setDrawablesExclCtxState(false); display(); // propagate exclusive change! } - synchronized (FPSAnimator.this) { + synchronized (FPSAnimator.this) { if(DEBUG) { System.err.println("FPSAnimator pause " + Thread.currentThread() + ": " + toString()); } isAnimating = false; FPSAnimator.this.notifyAll(); - } + } } } } @@ -230,7 +230,7 @@ public class FPSAnimator extends AnimatorBase { } static int timerNo = 0; - + public synchronized boolean start() { if ( null != timer || null != task || isStartedImpl() ) { return false; @@ -241,8 +241,8 @@ public class FPSAnimator extends AnimatorBase { System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } task.start(timer); - - final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition, + + final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); if(DEBUG) { System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString()); @@ -256,11 +256,11 @@ public class FPSAnimator extends AnimatorBase { private final Condition waitForStartedAddedCondition = new Condition() { public boolean eval() { return !isStartedImpl() || !isAnimating ; - } }; + } }; private final Condition waitForStartedEmptyCondition = new Condition() { public boolean eval() { return !isStartedImpl() || isAnimating ; - } }; + } }; /** Stops this FPSAnimator. Due to the implementation of the FPSAnimator it is not guaranteed that the FPSAnimator will be @@ -268,7 +268,7 @@ public class FPSAnimator extends AnimatorBase { public synchronized boolean stop() { if ( null == timer || !isStartedImpl() ) { return false; - } + } if(DEBUG) { System.err.println("FPSAnimator.stop() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } @@ -281,7 +281,7 @@ public class FPSAnimator extends AnimatorBase { shouldStop = true; res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } - + if(DEBUG) { System.err.println("FPSAnimator.stop() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } @@ -316,7 +316,7 @@ public class FPSAnimator extends AnimatorBase { shouldRun = false; res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } - + if(DEBUG) { System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index e0bbbc33c..2d685a1a8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -53,13 +53,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * and starting with a new created Buffer object with initialElementCount size * * On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. - * On profile ES2 the fixed function emulation will transform these calls to + * On profile ES2 the fixed function emulation will transform these calls to * EnableVertexAttribArray and VertexAttribPointer calls, * and a predefined vertex attribute variable name will be chosen. - * - * The default name mapping will be used, + * + * The default name mapping will be used, * see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}. - * + * * @param index The GL array index * @param comps The array component number * @param dataType The array index GL data type @@ -67,7 +67,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param initialElementCount * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) - */ + */ public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException { @@ -82,13 +82,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * and starting with a given Buffer object incl it's stride * * On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. - * On profile ES2 the fixed function emulation will transform these calls to + * On profile ES2 the fixed function emulation will transform these calls to * EnableVertexAttribArray and VertexAttribPointer calls, * and a predefined vertex attribute variable name will be chosen. - * - * The default name mapping will be used, + * + * The default name mapping will be used, * see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}. - * + * * @param index The GL array index * @param comps The array component number * @param dataType The array index GL data type @@ -97,8 +97,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param buffer the user define data * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) - */ - public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, + */ + public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer) throws GLException { @@ -111,13 +111,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData /** * Create a client side buffer object, using a custom GLSL array attribute name * and starting with a new created Buffer object with initialElementCount size - * @param name The custom name for the GL attribute. + * @param name The custom name for the GL attribute. * @param comps The array component number * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized * @param initialElementCount */ - public static GLArrayDataClient createGLSL(String name, int comps, + public static GLArrayDataClient createGLSL(String name, int comps, int dataType, boolean normalized, int initialElementCount) throws GLException { @@ -130,7 +130,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData /** * Create a client side buffer object, using a custom GLSL array attribute name * and starting with a given Buffer object incl it's stride - * @param name The custom name for the GL attribute. + * @param name The custom name for the GL attribute. * @param comps The array component number * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized @@ -157,8 +157,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } } } - - // + + // // Data read access // @@ -167,7 +167,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData @Override public final boolean sealed() { return sealed; } - + @Override public final boolean enabled() { return bufferEnabled; } @@ -195,10 +195,10 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData seal(seal); enableBuffer(gl, seal); } - + @Override public void enableBuffer(GL gl, boolean enable) { - if( enableBufferAlways || bufferEnabled != enable ) { + if( enableBufferAlways || bufferEnabled != enable ) { if(enable) { checkSeal(true); // init/generate VBO name if not done yet @@ -208,7 +208,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData bufferEnabled = enable; } } - + @Override public boolean bindBuffer(GL gl, boolean bind) { if(bind) { @@ -218,7 +218,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } return glArrayHandler.bindBuffer(gl, bind); } - + @Override public void setEnableAlways(boolean always) { enableBufferAlways = always; @@ -328,15 +328,15 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData ", isVertexAttribute "+isVertexAttribute+ ", usesGLSL "+usesGLSL+ ", usesShaderState "+(null!=shaderState)+ - ", dataType 0x"+Integer.toHexString(componentType)+ - ", bufferClazz "+componentClazz+ + ", dataType 0x"+Integer.toHexString(componentType)+ + ", bufferClazz "+componentClazz+ ", elements "+getElementCount()+ - ", components "+components+ + ", components "+components+ ", stride "+strideB+"b "+strideL+"c"+ - ", initialElementCount "+initialElementCount+ - ", sealed "+sealed+ - ", bufferEnabled "+bufferEnabled+ - ", bufferWritten "+bufferWritten+ + ", initialElementCount "+initialElementCount+ + ", sealed "+sealed+ + ", bufferEnabled "+bufferEnabled+ + ", bufferWritten "+bufferWritten+ ", buffer "+buffer+ ", alive "+alive+ "]"; @@ -345,16 +345,16 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData // non public matters protected final boolean growBufferIfNecessary(int spare) { - if(buffer==null || buffer.remaining()<spare) { + if(buffer==null || buffer.remaining()<spare) { growBuffer(Math.max(initialElementCount, spare)); return true; } return false; } - protected final void growBuffer(int additionalElements) { + protected final void growBuffer(int additionalElements) { if(!alive || sealed) { - throw new GLException("Invalid state: "+this); + throw new GLException("Invalid state: "+this); } // add the stride delta @@ -362,7 +362,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData final int osize = (buffer!=null) ? buffer.capacity() : 0; final int nsize = osize + ( additionalElements * components ); - + if(componentClazz==ByteBuffer.class) { ByteBuffer newBBuffer = Buffers.newDirectByteBuffer( nsize ); if(buffer!=null) { @@ -401,18 +401,18 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData protected final void checkSeal(boolean test) throws GLException { if(!alive) { - throw new GLException("Invalid state: "+this); - } + throw new GLException("Invalid state: "+this); + } if(sealed!=test) { if(test) { - throw new GLException("Not Sealed yet, seal first:\n\t"+this); + throw new GLException("Not Sealed yet, seal first:\n\t"+this); } else { - throw new GLException("Already Sealed, can't modify VBO:\n\t"+this); + throw new GLException("Already Sealed, can't modify VBO:\n\t"+this); } } } - protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, + protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, int initialElementCount, boolean isVertexAttribute, GLArrayHandler handler, int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL) throws GLException @@ -433,12 +433,12 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } private boolean isValidated = false; - + protected void init_vbo(GL gl) { if(!isValidated ) { isValidated = true; validate(gl.getGLProfile(), true); - } + } } protected GLArrayDataClient() { } @@ -453,6 +453,6 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData protected GLArrayHandler glArrayHandler; protected boolean usesGLSL; protected ShaderState shaderState; - + } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java index 9b04a48aa..701f88e59 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java @@ -40,24 +40,24 @@ public interface GLArrayDataEditable extends GLArrayData { * * @see #seal(boolean) * @see #enableBuffer(GL, boolean) - * + * */ public void seal(GL gl, boolean seal); /** - * Enables the buffer if <code>enable</code> is <code>true</code>, + * Enables the buffer if <code>enable</code> is <code>true</code>, * and transfers the data if required. * In case {@link #isVBO() VBO is used}, it is bound accordingly for the data transfer and association, * i.e. it issued {@link #bindBuffer(GL, boolean)}. - * The VBO buffer is unbound when the method returns. + * The VBO buffer is unbound when the method returns. * <p> - * Disables the buffer if <code>enable</code> is <code>false</code>. + * Disables the buffer if <code>enable</code> is <code>false</code>. * </p> - * + * * <p>The action will only be executed, - * if the internal enable state differs, + * if the internal enable state differs, * or 'setEnableAlways' was called with 'true'.</b> - * + * * <p>It is up to the user to enable/disable the array properly, * ie in case of multiple data sets for the same vertex attribute (VA). * Meaning in such case usage of one set while expecting another one @@ -68,7 +68,7 @@ public interface GLArrayDataEditable extends GLArrayData { public void enableBuffer(GL gl, boolean enable); /** - * if <code>bind</code> is true and the data uses {@link #isVBO() VBO}, + * if <code>bind</code> is true and the data uses {@link #isVBO() 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 {@link #isVBO() VBO}, @@ -79,11 +79,11 @@ public interface GLArrayDataEditable extends GLArrayData { * to be bounded and written while keeping the VBO bound. The latter is in contrast to {@link #enableBuffer(GL, boolean)}, * which leaves the VBO unbound, since it's not required for vertex attributes or pointers. * </p> - * + * * @param gl current GL object - * @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 + * @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 */ public boolean bindBuffer(GL gl, boolean bind); @@ -92,7 +92,7 @@ public interface GLArrayDataEditable extends GLArrayData { * * The default is 'false' * - * This is useful when you mix up + * This is useful when you mix up * GLArrayData usage with conventional GL array calls * or in case of a buggy GL VBO implementation. * @@ -117,7 +117,7 @@ public interface GLArrayDataEditable extends GLArrayData { * ie position:=limit and limit:=capacity.</p> * * @see #seal(boolean) - */ + */ public void seal(boolean seal); public void rewind(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index 7e7d27b36..80639c5c7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -57,13 +57,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * and starting with a given Buffer object incl it's stride * * On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. - * On profile ES2 the fixed function emulation will transform these calls to + * On profile ES2 the fixed function emulation will transform these calls to * EnableVertexAttribArray and VertexAttribPointer calls, * and a predefined vertex attribute variable name will be chosen. - * - * The default name mapping will be used, + * + * The default name mapping will be used, * see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}. - * + * * @param index The GL array index * @param comps The array component number * @param dataType The array index GL data type @@ -90,13 +90,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * and starting with a new created Buffer object with initialElementCount size * * On profiles GL2 and ES1 the fixed function pipeline behavior is as expected. - * On profile ES2 the fixed function emulation will transform these calls to + * On profile ES2 the fixed function emulation will transform these calls to * EnableVertexAttribArray and VertexAttribPointer calls, * and a predefined vertex attribute variable name will be chosen. - * - * The default name mapping will be used, + * + * The default name mapping will be used, * see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}. - * + * * @param index The GL array index * @param comps The array component number * @param dataType The array index GL data type @@ -106,7 +106,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount, + public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException { @@ -120,7 +120,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE /** * Create a VBO, using a custom GLSL array attribute name * and starting with a new created Buffer object with initialElementCount size - * @param name The custom name for the GL attribute + * @param name The custom name for the GL attribute * @param comps The array component number * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized @@ -128,20 +128,20 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ public static GLArrayDataServer createGLSL(String name, int comps, - int dataType, boolean normalized, int initialElementCount, int vboUsage) - throws GLException + int dataType, boolean normalized, int initialElementCount, int vboUsage) + throws GLException { GLArrayDataServer ads = new GLArrayDataServer(); GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, comps, dataType, normalized, 0, null, initialElementCount, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; - } - + } + /** * Create a VBO, using a custom GLSL array attribute name * and starting with a given Buffer object incl it's stride - * @param name The custom name for the GL attribute + * @param name The custom name for the GL attribute * @param comps The array component number * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized @@ -151,7 +151,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE */ public static GLArrayDataServer createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + int vboUsage) throws GLException { GLArrayDataServer ads = new GLArrayDataServer(); @@ -160,12 +160,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; } - + /** * Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}. - * + * * Hence no index, name for a fixed function pipeline nor vertex attribute is given. - * + * * @param comps The array component number * @param dataType The array index GL data type * @param stride @@ -187,16 +187,16 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE /** * Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}. - * + * * Hence no index, name for a fixed function pipeline nor vertex attribute is given. - * + * * @param comps The array component number * @param dataType The array index GL data type * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. */ - public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount, + public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount, int vboUsage, int vboTarget) throws GLException { @@ -207,19 +207,19 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ads; } - + /** * Create a VBO for fixed function interleaved array data * starting with a new created Buffer object with initialElementCount size. * <p>User needs to <i>configure</i> the interleaved segments via {@link #addFixedSubArray(int, int, int)}.</p> - * + * * @param comps The total number of all interleaved components. * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized - * @param initialElementCount + * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount, + public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException { @@ -239,7 +239,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * The memory of the the interleaved array is being used.</p> * <p> * Must be called before using the array, eg: {@link #seal(boolean)}, {@link #putf(float)}, .. </p> - * + * * @param index The GL array index, maybe -1 if vboTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER} * @param comps This interleaved array segment's component number * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} @@ -250,32 +250,32 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); } if(usesGLSL) { - throw new GLException("buffer uses GLSL"); + throw new GLException("buffer uses GLSL"); } final GLArrayDataWrapper ad = GLArrayDataWrapper.createFixed( - index, comps, getComponentType(), - getNormalized(), getStride(), getBuffer(), + index, comps, getComponentType(), + getNormalized(), getStride(), getBuffer(), getVBOName(), interleavedOffset, getVBOUsage(), vboTarget); ad.setVBOEnabled(isVBO()); interleavedOffset += comps * getComponentSizeInBytes(); - if(GL.GL_ARRAY_BUFFER == vboTarget) { + if(GL.GL_ARRAY_BUFFER == vboTarget) { glArrayHandler.addSubHandler(new GLFixedArrayHandlerFlat(ad)); } return ad; } - + /** * Create a VBO for GLSL interleaved array data * starting with a new created Buffer object with initialElementCount size. * <p>User needs to <i>configure</i> the interleaved segments via {@link #addGLSLSubArray(int, int, int)}.</p> - * + * * @param comps The total number of all interleaved components. * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized - * @param initialElementCount + * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount, + public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount, int vboUsage) throws GLException { @@ -285,7 +285,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; } - + /** * Configure a segment of this GLSL interleaved array (see {@link #createGLSLInterleaved(int, int, boolean, int, int)}). * <p> @@ -305,20 +305,20 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); } if(!usesGLSL) { - throw new GLException("buffer uses fixed function"); + throw new GLException("buffer uses fixed function"); } final GLArrayDataWrapper ad = GLArrayDataWrapper.createGLSL( - name, comps, getComponentType(), - getNormalized(), getStride(), getBuffer(), - getVBOName(), interleavedOffset, getVBOUsage(), vboTarget); + name, comps, getComponentType(), + getNormalized(), getStride(), getBuffer(), + getVBOName(), interleavedOffset, getVBOUsage(), vboTarget); ad.setVBOEnabled(isVBO()); interleavedOffset += comps * getComponentSizeInBytes(); - if(GL.GL_ARRAY_BUFFER == vboTarget) { + if(GL.GL_ARRAY_BUFFER == vboTarget) { glArrayHandler.addSubHandler(new GLSLArrayHandlerFlat(ad)); } return ad; } - + // // Data matters GLArrayData // @@ -341,15 +341,15 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } // - // data matters + // data matters // /** - * Convenient way do disable the VBO behavior and + * Convenient way do disable the VBO behavior and * switch to client side data one * Only possible if buffer is defined. */ - public void setVBOEnabled(boolean vboUsage) { + public void setVBOEnabled(boolean vboUsage) { checkSeal(false); super.setVBOEnabled(vboUsage); } @@ -361,22 +361,22 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE ", isVertexAttribute "+isVertexAttribute+ ", usesGLSL "+usesGLSL+ ", usesShaderState "+(null!=shaderState)+ - ", dataType 0x"+Integer.toHexString(componentType)+ - ", bufferClazz "+componentClazz+ + ", dataType 0x"+Integer.toHexString(componentType)+ + ", bufferClazz "+componentClazz+ ", elements "+getElementCount()+ - ", components "+components+ + ", components "+components+ ", stride "+strideB+"b "+strideL+"c"+ ", initialElementCount "+initialElementCount+ - ", vboEnabled "+vboEnabled+ - ", vboName "+vboName+ - ", vboUsage 0x"+Integer.toHexString(vboUsage)+ - ", vboTarget 0x"+Integer.toHexString(vboTarget)+ - ", vboOffset "+vboOffset+ - ", sealed "+sealed+ - ", bufferEnabled "+bufferEnabled+ - ", bufferWritten "+bufferWritten+ - ", buffer "+buffer+ - ", alive "+alive+ + ", vboEnabled "+vboEnabled+ + ", vboName "+vboName+ + ", vboUsage 0x"+Integer.toHexString(vboUsage)+ + ", vboTarget 0x"+Integer.toHexString(vboTarget)+ + ", vboOffset "+vboOffset+ + ", sealed "+sealed+ + ", bufferEnabled "+bufferEnabled+ + ", bufferWritten "+bufferWritten+ + ", buffer "+buffer+ + ", alive "+alive+ "]"; } @@ -384,7 +384,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE // non public matters .. // - protected void init(String name, int index, int comps, int dataType, boolean normalized, + protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data, int initialElementCount, boolean isVertexAttribute, GLArrayHandler glArrayHandler, int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL) @@ -407,7 +407,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } } } - - private int interleavedOffset = 0; + + private int interleavedOffset = 0; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index f8b17501e..290f47a6d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -49,7 +49,7 @@ public class GLArrayDataWrapper implements GLArrayData { /** * Create a VBO, using a predefined fixed function array index, wrapping the given data. - * + * * @param index The GL array index * @param comps The array component number * @param dataType The array index GL data type @@ -61,23 +61,23 @@ public class GLArrayDataWrapper implements GLArrayData { * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} * @return the new create instance - * + * * @throws GLException */ - public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, + public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) throws GLException { GLArrayDataWrapper adc = new GLArrayDataWrapper(); - adc.init(null, index, comps, dataType, normalized, stride, buffer, false, + adc.init(null, index, comps, dataType, normalized, stride, buffer, false, vboName, vboOffset, vboUsage, vboTarget); return adc; } /** * Create a VBO, using a custom GLSL array attribute name, wrapping the given data. - * - * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER} + * + * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER} * @param comps The array component number * @param dataType The array index GL data type * @param normalized Whether the data shall be normalized @@ -90,7 +90,7 @@ public class GLArrayDataWrapper implements GLArrayData { * @return the new create instance * @throws GLException */ - public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, + public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) throws GLException { @@ -102,8 +102,8 @@ public class GLArrayDataWrapper implements GLArrayData { /** * Validates this instance's parameter. Called automatically by {@link GLArrayDataClient} and {@link GLArrayDataServer}. - * {@link GLArrayDataWrapper} does not validate it's instance by itself. - * + * {@link GLArrayDataWrapper} does not validate it's instance by itself. + * * @param glp the GLProfile to use * @param throwException whether to throw an exception if this instance has invalid parameter or not * @return true if this instance has invalid parameter, otherwise false @@ -113,7 +113,7 @@ public class GLArrayDataWrapper implements GLArrayData { if(throwException) { throw new GLException("Instance !alive "+this); } - return false; + return false; } if(this.isVertexAttribute() && !glp.hasGLSL()) { if(throwException) { @@ -123,13 +123,13 @@ public class GLArrayDataWrapper implements GLArrayData { } return glp.isValidArrayDataType(getIndex(), getComponentCount(), getComponentType(), isVertexAttribute(), throwException); } - + @Override public void associate(Object obj, boolean enable) { // nop } - - // + + // // Data read access // @@ -150,14 +150,14 @@ public class GLArrayDataWrapper implements GLArrayData { location = gl.glGetAttribLocation(program, name); return location; } - + @Override public final int setLocation(GL2ES2 gl, int program, int location) { this.location = location; gl.glBindAttribLocation(program, location, name); return location; } - + @Override public final String getName() { return name; } @@ -172,10 +172,10 @@ public class GLArrayDataWrapper implements GLArrayData { @Override public final int getVBOUsage() { return vboEnabled?vboUsage:0; } - + @Override public final int getVBOTarget() { return vboEnabled?vboTarget:0; } - + @Override public final Buffer getBuffer() { return buffer; } @@ -187,19 +187,19 @@ public class GLArrayDataWrapper implements GLArrayData { @Override public final int getComponentSizeInBytes() { return componentByteSize; } - + @Override public final int getElementCount() { if(null==buffer) return 0; return ( buffer.position()==0 ) ? ( buffer.limit() / components ) : ( buffer.position() / components ) ; } - + @Override public final int getSizeInBytes() { if(null==buffer) return 0; - return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ; + return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ; } - + @Override public final boolean getNormalized() { return normalized; } @@ -223,18 +223,18 @@ public class GLArrayDataWrapper implements GLArrayData { ", index "+index+ ", location "+location+ ", isVertexAttribute "+isVertexAttribute+ - ", dataType 0x"+Integer.toHexString(componentType)+ - ", bufferClazz "+componentClazz+ + ", dataType 0x"+Integer.toHexString(componentType)+ + ", bufferClazz "+componentClazz+ ", elements "+getElementCount()+ - ", components "+components+ + ", components "+components+ ", stride "+strideB+"b "+strideL+"c"+ - ", buffer "+buffer+ - ", vboEnabled "+vboEnabled+ - ", vboName "+vboName+ - ", vboUsage 0x"+Integer.toHexString(vboUsage)+ - ", vboTarget 0x"+Integer.toHexString(vboTarget)+ - ", vboOffset "+vboOffset+ - ", alive "+alive+ + ", buffer "+buffer+ + ", vboEnabled "+vboEnabled+ + ", vboName "+vboName+ + ", vboUsage 0x"+Integer.toHexString(vboUsage)+ + ", vboTarget 0x"+Integer.toHexString(vboTarget)+ + ", vboOffset "+vboOffset+ + ", alive "+alive+ "]"; } @@ -252,12 +252,12 @@ public class GLArrayDataWrapper implements GLArrayData { return IntBuffer.class; case GL.GL_FLOAT: return FloatBuffer.class; - default: + default: throw new GLException("Given OpenGL data type not supported: "+dataType); } } - @Override + @Override public void setName(String newName) { location = -1; name = newName; @@ -267,7 +267,7 @@ public class GLArrayDataWrapper implements GLArrayData { * Enable or disable use of VBO. * Only possible if a VBO buffer name is defined. * @see #setVBOName(int) - */ + */ public void setVBOEnabled(boolean vboEnabled) { this.vboEnabled=vboEnabled; } @@ -275,31 +275,31 @@ public class GLArrayDataWrapper implements GLArrayData { /** * Set the VBO buffer name, if valid (!= 0) enable use of VBO, * otherwise (==0) disable VBO usage. - * + * * @see #setVBOEnabled(boolean) - */ + */ public void setVBOName(int vboName) { this.vboName=vboName; setVBOEnabled(0!=vboName); } - /** + /** * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} - */ - public void setVBOUsage(int vboUsage) { - this.vboUsage = vboUsage; + */ + public void setVBOUsage(int vboUsage) { + this.vboUsage = vboUsage; } - - /** + + /** * @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} - */ + */ public void setVBOTarget(int vboTarget) { this.vboTarget = vboTarget; - } + } - protected void init(String name, int index, int components, int componentType, - boolean normalized, int stride, Buffer data, - boolean isVertexAttribute, + protected void init(String name, int index, int components, int componentType, + boolean normalized, int stride, Buffer data, + boolean isVertexAttribute, int vboName, long vboOffset, int vboUsage, int vboTarget) throws GLException { @@ -307,19 +307,19 @@ public class GLArrayDataWrapper implements GLArrayData { this.index = index; this.location = -1; // We can't have any dependence on the FixedFuncUtil class here for build bootstrapping reasons - + if( GL.GL_ELEMENT_ARRAY_BUFFER == vboTarget ) { // OK .. } else if( ( 0 == vboUsage && 0 == vboTarget ) || GL.GL_ARRAY_BUFFER == vboTarget ) { - // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP. + // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP. this.name = ( null == name ) ? GLPointerFuncUtil.getPredefinedArrayIndexName(index) : name ; if(null == this.name ) { throw new GLException("Not a valid array buffer index: "+index); - } + } } else if( 0 < vboTarget ) { throw new GLException("Invalid GPUBuffer target: 0x"+Integer.toHexString(vboTarget)); } - + this.componentType = componentType; componentClazz = getBufferClass(componentType); if( GLBuffers.isGLTypeFixedPoint(componentType) ) { @@ -329,7 +329,7 @@ public class GLArrayDataWrapper implements GLArrayData { } componentByteSize = GLBuffers.sizeOfGLType(componentType); if(0 > componentByteSize) { - throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this); + throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this); } if(0 >= components) { throw new GLException("Invalid number of components: " + components); @@ -348,7 +348,7 @@ public class GLArrayDataWrapper implements GLArrayData { this.vboName= vboName; this.vboEnabled= 0 != vboName ; this.vboOffset=vboOffset; - + switch(vboUsage) { case 0: // nop case GL.GL_STATIC_DRAW: @@ -356,7 +356,7 @@ public class GLArrayDataWrapper implements GLArrayData { case GL2ES2.GL_STREAM_DRAW: break; default: - throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this); + throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this); } switch(vboTarget) { case 0: // nop @@ -367,7 +367,7 @@ public class GLArrayDataWrapper implements GLArrayData { throw new GLException("invalid gpuBufferTarget: "+vboTarget+":\n\t"+this); } this.vboUsage=vboUsage; - this.vboTarget=vboTarget; + this.vboTarget=vboTarget; this.alive=true; } @@ -390,6 +390,6 @@ public class GLArrayDataWrapper implements GLArrayData { protected int vboName; protected boolean vboEnabled; protected int vboUsage; - protected int vboTarget; + protected int vboTarget; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index 6bdea4518..418d7fa81 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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. */ @@ -52,7 +52,7 @@ import com.jogamp.common.nio.Buffers; /** * Utility routines for dealing with direct buffers. - * + * * @author Kenneth Russel, et.al. */ public class GLBuffers extends Buffers { @@ -72,11 +72,11 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_INT: case GL2.GL_HILO16_NV: return false; - + } return true; } - + /** * @param glType GL primitive type * @return false if one of GL primitive floating point types, otherwise true @@ -92,19 +92,19 @@ public class GLBuffers extends Buffers { case GLES2.GL_HALF_FLOAT_OES: case GL2GL3.GL_DOUBLE: return false; - + default: return true; - } + } } - + /** * @param glType shall be one of (31) <br/> * GL_BYTE, GL_UNSIGNED_BYTE, <br/> * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/> * <br/> * GL_SHORT, GL_UNSIGNED_SHORT, <br/> - * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> + * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/> * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/> * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/> @@ -112,16 +112,16 @@ public class GLBuffers extends Buffers { * <br/> * GL_FIXED, GL_INT <br/> * GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/> - * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> + * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> * GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/> - * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> + * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> * GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/> * <br/> * GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/> * <br/> - * GL_FLOAT, GL_DOUBLE <br/> - * - * @return -1 if glType is unhandled, otherwise the actual value > 0 + * GL_FLOAT, GL_DOUBLE <br/> + * + * @return -1 if glType is unhandled, otherwise the actual value > 0 */ public static final int sizeOfGLType(int glType) { switch (glType) { // 29 @@ -131,7 +131,7 @@ public class GLBuffers extends Buffers { case GL2GL3.GL_UNSIGNED_BYTE_3_3_2: case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV: return SIZEOF_BYTE; - + case GL.GL_SHORT: case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: @@ -145,40 +145,40 @@ public class GLBuffers extends Buffers { case GL.GL_HALF_FLOAT: case GLES2.GL_HALF_FLOAT_OES: return SIZEOF_SHORT; - + case GL.GL_FIXED: case GL2ES2.GL_INT: case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: case GL2GL3.GL_UNSIGNED_INT_24_8: case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return SIZEOF_INT; - + case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return SIZEOF_LONG; - + case GL.GL_FLOAT: return SIZEOF_FLOAT; - + case GL2GL3.GL_DOUBLE: return SIZEOF_DOUBLE; } return -1; } - + /** * @param glType shall be one of (31) <br/> * GL_BYTE, GL_UNSIGNED_BYTE, <br/> * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/> * <br/> * GL_SHORT, GL_UNSIGNED_SHORT, <br/> - * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> + * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/> * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/> * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/> @@ -186,16 +186,16 @@ public class GLBuffers extends Buffers { * <br/> * GL_FIXED, GL_INT <br/> * GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/> - * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> + * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> * GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/> - * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> + * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> * GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/> * <br/> * GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/> * <br/> - * GL_FLOAT, GL_DOUBLE <br/> - * - * @return null if glType is unhandled, otherwise the new Buffer object + * GL_FLOAT, GL_DOUBLE <br/> + * + * @return null if glType is unhandled, otherwise the new Buffer object */ public static final Buffer newDirectGLBuffer(int glType, int numElements) { switch (glType) { // 29 @@ -204,7 +204,7 @@ public class GLBuffers extends Buffers { case GL2GL3.GL_UNSIGNED_BYTE_3_3_2: case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV: return newDirectByteBuffer(numElements); - + case GL.GL_SHORT: case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: @@ -218,7 +218,7 @@ public class GLBuffers extends Buffers { case GL.GL_HALF_FLOAT: case GLES2.GL_HALF_FLOAT_OES: return newDirectShortBuffer(numElements); - + case GL.GL_FIXED: case GL2ES2.GL_INT: case GL.GL_UNSIGNED_INT: @@ -232,13 +232,13 @@ public class GLBuffers extends Buffers { case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return newDirectIntBuffer(numElements); - + case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return newDirectLongBuffer(numElements); - + case GL.GL_FLOAT: return newDirectFloatBuffer(numElements); - + case GL2.GL_DOUBLE: return newDirectDoubleBuffer(numElements); } @@ -251,7 +251,7 @@ public class GLBuffers extends Buffers { * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/> * <br/> * GL_SHORT, GL_UNSIGNED_SHORT, <br/> - * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> + * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/> * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/> * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/> @@ -259,15 +259,15 @@ public class GLBuffers extends Buffers { * <br/> * GL_FIXED, GL_INT <br/> * GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/> - * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> + * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> * GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/> - * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> + * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> * GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/> * <br/> * GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/> * <br/> - * GL_FLOAT, GL_DOUBLE <br/> - * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object + * GL_FLOAT, GL_DOUBLE <br/> + * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object */ public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) { if (parent == null || byteLen == 0) { @@ -275,11 +275,11 @@ public class GLBuffers extends Buffers { } final int parentPos = parent.position(); final int parentLimit = parent.limit(); - + parent.position(bytePos); parent.limit(bytePos + byteLen); Buffer res = null; - + switch (glType) { // 29 case GL.GL_BYTE: case GL.GL_UNSIGNED_BYTE: @@ -287,7 +287,7 @@ public class GLBuffers extends Buffers { case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV: res = parent.slice().order(parent.order()); // slice and duplicate may change byte order break; - + case GL.GL_SHORT: case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: @@ -302,7 +302,7 @@ public class GLBuffers extends Buffers { case GLES2.GL_HALF_FLOAT_OES: res = parent.slice().order(parent.order()).asShortBuffer(); // slice and duplicate may change byte order break; - + case GL.GL_FIXED: case GL2GL3.GL_INT: case GL2ES2.GL_UNSIGNED_INT: @@ -317,15 +317,15 @@ public class GLBuffers extends Buffers { case GL2.GL_SIGNED_HILO16_NV: res = parent.slice().order(parent.order()).asIntBuffer(); // slice and duplicate may change byte order break; - + case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: res = parent.slice().order(parent.order()).asLongBuffer(); // slice and duplicate may change byte order break; - + case GL.GL_FLOAT: res = parent.slice().order(parent.order()).asFloatBuffer(); // slice and duplicate may change byte order break; - + case GL2.GL_DOUBLE: res = parent.slice().order(parent.order()).asDoubleBuffer(); // slice and duplicate may change byte order break; @@ -338,29 +338,29 @@ public class GLBuffers extends Buffers { gl.glGetIntegerv(pname, tmp, 0); return tmp[0]; } - - /** + + /** * Returns the number of bytes required to read/write a memory buffer via OpenGL * using the current GL pixel storage state and the given parameters. - * + * * <p>This method is security critical, hence it throws an exception (fail-fast) - * in case of an invalid alignment. In case we forgot to handle - * proper values, please contact the maintainer.</p> - * + * in case of an invalid alignment. In case we forgot to handle + * proper values, please contact the maintainer.</p> + * * @param gl the current GL object - * + * * @param tmp a pass through integer array of size >= 1 used to store temp data (performance) - * + * * @param bytesPerPixel bytes per pixel, i.e. via {@link #bytesPerPixel(int, int)}. * @param width in pixels * @param height in pixels * @param depth in pixels - * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack) + * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack) * @return required minimum size of the buffer in bytes * @throws GLException if alignment is invalid. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], - int bytesPerPixel, int width, int height, int depth, + public static final int sizeof(GL gl, int tmp[], + int bytesPerPixel, int width, int height, int depth, boolean pack) { int rowLength = 0; int skipRows = 0; @@ -368,31 +368,31 @@ public class GLBuffers extends Buffers { int alignment = 1; int imageHeight = 0; int skipImages = 0; - - if (pack) { + + if (pack) { alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); if(gl.isGL2GL3()) { rowLength = glGetInteger(gl, GL2GL3.GL_PACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp); + skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp); skipPixels = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_PIXELS, tmp); - if (depth > 1) { - imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); + if (depth > 1) { + imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); } } - } else { + } else { alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); - if(gl.isGL2GL3 ()) { - rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp); + if(gl.isGL2GL3 ()) { + rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp); + skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp); skipPixels = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_PIXELS, tmp); - if (depth > 1) { - imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp); + if (depth > 1) { + imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp); skipImages = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_IMAGES, tmp); } } } - + // Try to deal somewhat correctly with potentially invalid values width = Math.max(0, width ); height = Math.max(1, height); // min 1D @@ -401,13 +401,13 @@ public class GLBuffers extends Buffers { skipPixels = Math.max(0, skipPixels); alignment = Math.max(1, alignment); skipImages = Math.max(0, skipImages); - + imageHeight = ( imageHeight > 0 ) ? imageHeight : height; rowLength = ( rowLength > 0 ) ? rowLength : width; - + int rowLengthInBytes = rowLength * bytesPerPixel; int skipBytes = skipPixels * bytesPerPixel; - + switch(alignment) { case 1: break; @@ -423,71 +423,71 @@ public class GLBuffers extends Buffers { if (remainder > 0) { skipBytes += alignment - remainder; } - } + } break; default: - throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug."); + throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug."); } - + /** * skipImages, depth, skipPixels and skipRows are static offsets. * * skipImages and depth are in multiples of image size. * * skipBytes and rowLengthInBytes are aligned - * - * rowLengthInBytes is the aligned byte offset + * + * rowLengthInBytes is the aligned byte offset * from line n to line n+1 at the same x-axis position. */ return skipBytes + // aligned skipPixels * bpp - ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images + ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images ( skipRows + height - 1 ) * rowLengthInBytes + // aligned lines - width * bytesPerPixel; // last line + width * bytesPerPixel; // last line } - - /** + + /** * Returns the number of bytes required to read/write a memory buffer via OpenGL * using the current GL pixel storage state and the given parameters. - * + * * <p>This method is security critical, hence it throws an exception (fail-fast) - * in case either the format, type or alignment is unhandled. In case we forgot to handle - * proper values, please contact the maintainer.</p> - * + * in case either the format, type or alignment is unhandled. In case we forgot to handle + * proper values, please contact the maintainer.</p> + * * <p> See {@link #bytesPerPixel(int, int)}. </p> - * + * * @param gl the current GL object - * + * * @param tmp a pass through integer array of size >= 1 used to store temp data (performance) - * - * @param format must be one of (27) <br/> - * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> - * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> - * GL_RED GL_RED_INTEGER <br/> - * GL_GREEN GL_GREEN_INTEGER <br/> - * GL_BLUE GL_BLUE_INTEGER <br/> - * GL_ALPHA GL_LUMINANCE (12) <br/> - * <br/> + * + * @param format must be one of (27) <br/> + * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> + * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> + * GL_RED GL_RED_INTEGER <br/> + * GL_GREEN GL_GREEN_INTEGER <br/> + * GL_BLUE GL_BLUE_INTEGER <br/> + * GL_ALPHA GL_LUMINANCE (12) <br/> + * <br/> * GL_LUMINANCE_ALPHA GL_RG <br/> - * GL_RG_INTEGER GL_HILO_NV <br/> - * GL_SIGNED_HILO_NV (5) <br/> - * <br/> - * GL_YCBCR_422_APPLE <br/> - * <br/> - * GL_RGB GL_RGB_INTEGER <br/> - * GL_BGR GL_BGR_INTEGER (4)<br/> - * <br/> - * GL_RGBA GL_RGBA_INTEGER <br/> + * GL_RG_INTEGER GL_HILO_NV <br/> + * GL_SIGNED_HILO_NV (5) <br/> + * <br/> + * GL_YCBCR_422_APPLE <br/> + * <br/> + * GL_RGB GL_RGB_INTEGER <br/> + * GL_BGR GL_BGR_INTEGER (4)<br/> + * <br/> + * GL_RGBA GL_RGBA_INTEGER <br/> * GL_BGRA GL_BGRA_INTEGER <br/> - * GL_ABGR_EXT (5)<br/> - * - * @param type must be one of (32) <br/> - * GL_BITMAP, <br/> + * GL_ABGR_EXT (5)<br/> + * + * @param type must be one of (32) <br/> + * GL_BITMAP, <br/> * GL_BYTE, GL_UNSIGNED_BYTE, <br/> * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/> * <br/> * GL_SHORT, GL_UNSIGNED_SHORT, <br/> - * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> + * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/> * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/> * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/> @@ -495,70 +495,70 @@ public class GLBuffers extends Buffers { * <br/> * GL_FIXED, GL_INT <br/> * GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/> - * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> + * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> * GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/> - * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> + * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> * GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/> * <br/> * GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/> * <br/> - * GL_FLOAT, GL_DOUBLE <br/> - * + * GL_FLOAT, GL_DOUBLE <br/> + * * @param width in pixels * @param height in pixels * @param depth in pixels - * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU + * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU * @return required minimum size of the buffer in bytes * @throws GLException if format, type or alignment is not handled. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], + public static final int sizeof(GL gl, int tmp[], int format, int type, int width, int height, int depth, boolean pack) throws GLException { if (width < 0) return 0; if (height < 0) return 0; if (depth < 0) return 0; - + final int bytesPerPixel = bytesPerPixel(format, type); return sizeof(gl, tmp, bytesPerPixel, width, height, depth, pack); } - - /** + + /** * Returns the number of bytes required for one pixel with the the given OpenGL format and type. - * + * * <p>This method is security critical, hence it throws an exception (fail-fast) - * in case either the format, type or alignment is unhandled. In case we forgot to handle - * proper values, please contact the maintainer.</p> - * + * in case either the format, type or alignment is unhandled. In case we forgot to handle + * proper values, please contact the maintainer.</p> + * * <p> See {@link #componentCount(int)}. </p> - * - * @param format must be one of (27) <br/> - * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> - * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> - * GL_RED GL_RED_INTEGER <br/> - * GL_GREEN GL_GREEN_INTEGER <br/> - * GL_BLUE GL_BLUE_INTEGER <br/> - * GL_ALPHA GL_LUMINANCE (12) <br/> - * <br/> + * + * @param format must be one of (27) <br/> + * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> + * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> + * GL_RED GL_RED_INTEGER <br/> + * GL_GREEN GL_GREEN_INTEGER <br/> + * GL_BLUE GL_BLUE_INTEGER <br/> + * GL_ALPHA GL_LUMINANCE (12) <br/> + * <br/> * GL_LUMINANCE_ALPHA GL_RG <br/> - * GL_RG_INTEGER GL_HILO_NV <br/> - * GL_SIGNED_HILO_NV (5) <br/> - * <br/> - * GL_YCBCR_422_APPLE <br/> - * <br/> - * GL_RGB GL_RGB_INTEGER <br/> - * GL_BGR GL_BGR_INTEGER (4)<br/> - * <br/> - * GL_RGBA GL_RGBA_INTEGER <br/> + * GL_RG_INTEGER GL_HILO_NV <br/> + * GL_SIGNED_HILO_NV (5) <br/> + * <br/> + * GL_YCBCR_422_APPLE <br/> + * <br/> + * GL_RGB GL_RGB_INTEGER <br/> + * GL_BGR GL_BGR_INTEGER (4)<br/> + * <br/> + * GL_RGBA GL_RGBA_INTEGER <br/> * GL_BGRA GL_BGRA_INTEGER <br/> - * GL_ABGR_EXT (5)<br/> - * - * @param type must be one of (32) <br/> - * GL_BITMAP, <br/> + * GL_ABGR_EXT (5)<br/> + * + * @param type must be one of (32) <br/> + * GL_BITMAP, <br/> * GL_BYTE, GL_UNSIGNED_BYTE, <br/> * GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/> * <br/> * GL_SHORT, GL_UNSIGNED_SHORT, <br/> - * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> + * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/> * GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/> * GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/> * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/> @@ -566,15 +566,15 @@ public class GLBuffers extends Buffers { * <br/> * GL_FIXED, GL_INT <br/> * GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/> - * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> + * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/> * GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/> - * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> + * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/> * GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/> * <br/> * GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/> * <br/> - * GL_FLOAT, GL_DOUBLE <br/> - * + * GL_FLOAT, GL_DOUBLE <br/> + * * @return required size of one pixel in bytes * @throws GLException if format or type alignment is not handled. Please contact the maintainer if this is our bug. */ @@ -582,14 +582,14 @@ public class GLBuffers extends Buffers { int compSize = 0; int compCount = componentCount(format); - + switch (type) /* 30 */ { case GL2.GL_BITMAP: if (GL2.GL_COLOR_INDEX == format || GL2GL3.GL_STENCIL_INDEX == format) { compSize = 1; } case GL.GL_BYTE: - case GL.GL_UNSIGNED_BYTE: + case GL.GL_UNSIGNED_BYTE: compSize = 1; break; case GL.GL_SHORT: @@ -607,7 +607,7 @@ public class GLBuffers extends Buffers { case GL2GL3.GL_DOUBLE: compSize = 8; break; - + case GL2GL3.GL_UNSIGNED_BYTE_3_3_2: case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV: compSize = 1; @@ -630,7 +630,7 @@ public class GLBuffers extends Buffers { case GL2.GL_SIGNED_HILO16_NV: compSize = 2; compCount = 2; - break; + break; case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: @@ -640,52 +640,52 @@ public class GLBuffers extends Buffers { case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: compSize = 4; compCount = 1; - break; + break; case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: compSize = 8; compCount = 1; - break; - + break; + default: throw new GLException("type 0x"+Integer.toHexString(type)+"/"+"format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug."); - } + } return compCount * compSize; } - - /** + + /** * Returns the number of components required for the given OpenGL format. - * + * * <p>This method is security critical, hence it throws an exception (fail-fast) - * in case either the format, type or alignment is unhandled. In case we forgot to handle - * proper values, please contact the maintainer.</p> - * - * @param format must be one of (27) <br/> - * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> - * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> - * GL_RED GL_RED_INTEGER <br/> - * GL_GREEN GL_GREEN_INTEGER <br/> - * GL_BLUE GL_BLUE_INTEGER <br/> - * GL_ALPHA GL_LUMINANCE (12) <br/> - * <br/> + * in case either the format, type or alignment is unhandled. In case we forgot to handle + * proper values, please contact the maintainer.</p> + * + * @param format must be one of (27) <br/> + * GL_COLOR_INDEX GL_STENCIL_INDEX <br/> + * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/> + * GL_RED GL_RED_INTEGER <br/> + * GL_GREEN GL_GREEN_INTEGER <br/> + * GL_BLUE GL_BLUE_INTEGER <br/> + * GL_ALPHA GL_LUMINANCE (12) <br/> + * <br/> * GL_LUMINANCE_ALPHA GL_RG <br/> - * GL_RG_INTEGER GL_HILO_NV <br/> - * GL_SIGNED_HILO_NV (5) <br/> - * <br/> - * GL_YCBCR_422_APPLE <br/> - * <br/> - * GL_RGB GL_RGB_INTEGER <br/> - * GL_BGR GL_BGR_INTEGER (4)<br/> - * <br/> - * GL_RGBA GL_RGBA_INTEGER <br/> + * GL_RG_INTEGER GL_HILO_NV <br/> + * GL_SIGNED_HILO_NV (5) <br/> + * <br/> + * GL_YCBCR_422_APPLE <br/> + * <br/> + * GL_RGB GL_RGB_INTEGER <br/> + * GL_BGR GL_BGR_INTEGER (4)<br/> + * <br/> + * GL_RGBA GL_RGBA_INTEGER <br/> * GL_BGRA GL_BGRA_INTEGER <br/> - * GL_ABGR_EXT (5)<br/> - * + * GL_ABGR_EXT (5)<br/> + * * @return number of components required for the given OpenGL format * @throws GLException if format is not handled. Please contact the maintainer if this is our bug. */ public static final int componentCount(int format) throws GLException { final int compCount; - + switch (format) /* 26 */ { case GL2.GL_COLOR_INDEX: case GL2GL3.GL_STENCIL_INDEX: @@ -711,10 +711,10 @@ public class GLBuffers extends Buffers { case GL.GL_RGB: case GL2GL3.GL_RGB_INTEGER: case GL2GL3.GL_BGR: - case GL2GL3.GL_BGR_INTEGER: + case GL2GL3.GL_BGR_INTEGER: compCount = 3; break; - case GL2.GL_YCBCR_422_APPLE: + case GL2.GL_YCBCR_422_APPLE: compCount = 3; break; case GL.GL_RGBA: @@ -724,16 +724,16 @@ public class GLBuffers extends Buffers { case GL2.GL_ABGR_EXT: compCount = 4; break; - /* FIXME ?? + /* FIXME ?? case GL.GL_HILO_NV: elements = 2; - break; */ + break; */ default: throw new GLException("format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug."); } return compCount; } - + public static final int getNextPowerOf2(int number) { if (((number-1) & number) == 0) { //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 @@ -745,8 +745,8 @@ public class GLBuffers extends Buffers { power++; } return (1<<power); - } - + } + //---------------------------------------------------------------------- // Conversion routines // diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java index 655f6d688..ec6d54d66 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.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,7 +44,7 @@ import jogamp.opengl.Debug; */ public class GLDrawableUtil { protected static final boolean DEBUG = Debug.debug("GLDrawable"); - + public static final boolean isAnimatorStartedOnOtherThread(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ; } @@ -56,11 +56,11 @@ public class GLDrawableUtil { public static final boolean isAnimatorAnimatingOnOtherThread(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - + public static final boolean isAnimatorAnimating(GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() : false ; } - + /** * Moves the designated {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>. * If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved @@ -86,7 +86,7 @@ public class GLDrawableUtil { dest.invoke(false, new GLEventListenerState.ReshapeGLEventListener(listener)); } // else .. !init state is default } - + /** * Moves all {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>. * If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved @@ -113,12 +113,12 @@ public class GLDrawableUtil { /** * Swaps the {@link GLContext} and all {@link GLEventListener} between {@link GLAutoDrawable} <code>a</code> and <code>b</code>, * while preserving it's initialized state, resets the GL-Viewport and issuing {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)}. - * <p> - * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association - * is also swapped. + * <p> + * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association + * is also swapped. * </p> * <p> - * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code> + * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code> * and the current thread is different than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> * @param a @@ -128,31 +128,31 @@ public class GLDrawableUtil { public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) { final GLEventListenerState gllsA = GLEventListenerState.moveFrom(a); final GLEventListenerState gllsB = GLEventListenerState.moveFrom(b); - + gllsA.moveTo(b); gllsB.moveTo(a); } - - /** - * Swaps the {@link GLContext} of given {@link GLAutoDrawable} - * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes} + + /** + * Swaps the {@link GLContext} of given {@link GLAutoDrawable} + * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes} * each {@link GLEventListener} w/o removing it. * <p> * The GL-Viewport is reset and {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)} issued implicit. - * </p> + * </p> * <p> - * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different + * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different * than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. * </p> * @param src * @param dest */ - public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) { + public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) { final GLAnimatorControl aAnim = src.getAnimator(); - final GLAnimatorControl bAnim = dest.getAnimator(); + final GLAnimatorControl bAnim = dest.getAnimator(); final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause(); final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause(); - + for(int i = src.getGLEventListenerCount() - 1; 0 <= i; i--) { src.disposeGLEventListener(src.getGLEventListener(i), false); } @@ -160,12 +160,12 @@ public class GLDrawableUtil { dest.disposeGLEventListener(dest.getGLEventListener(i), false); } dest.setContext( src.setContext( dest.getContext(), false ), false ); - + src.invoke(true, GLEventListenerState.setViewport); dest.invoke(true, GLEventListenerState.setViewport); - + if(aIsPaused) { aAnim.resume(); } if(bIsPaused) { bAnim.resume(); } } - + } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java index 71e284101..f0c6be44f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.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. @@ -39,78 +39,78 @@ import javax.media.opengl.GLException; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.texture.TextureData; -/** +/** * OpenGL pixel data buffer, allowing user to provide buffers via their {@link GLPixelBufferProvider} implementation. * <p> * {@link GLPixelBufferProvider} produces a {@link GLPixelBuffer}. - * </p> + * </p> * <p> * You may use {@link #defaultProviderNoRowStride}. * </p> */ public class GLPixelBuffer { - - /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */ + + /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */ public static interface GLPixelBufferProvider { /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */ boolean getAllowRowStride(); - + /** Called first to determine {@link GLPixelAttributes}. */ GLPixelAttributes getAttributes(GL gl, int componentCount); - - /** + + /** * Allocates a new {@link GLPixelBuffer} object. * <p> * Being called to gather the initial {@link GLPixelBuffer}, * or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. * </p> * <p> - * The minimum required {@link Buffer#remaining() remaining} byte size equals to <code>minByteSize</code>, if > 0, + * The minimum required {@link Buffer#remaining() remaining} byte size equals to <code>minByteSize</code>, if > 0, * otherwise utilize {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean)} * to calculate it. * </p> - * + * * @param gl the corresponding current GL context object * @param pixelAttributes the desired {@link GLPixelAttributes} * @param width in pixels * @param height in pixels * @param depth in pixels * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU - * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. + * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. */ GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize); } - /** Single {@link GLPixelBuffer} provider. */ + /** Single {@link GLPixelBuffer} provider. */ public static interface SingletonGLPixelBufferProvider extends GLPixelBufferProvider { - /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ + /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ GLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes); - /** + /** * Initializes the single {@link GLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. * @return the newly initialized single {@link GLPixelBuffer}, or null if already allocated. */ - GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack); + GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack); } public static class DefaultGLPixelBufferProvider implements GLPixelBufferProvider { private final boolean allowRowStride; - + /** - * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. + * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. * See {@link #getAllowRowStride()} and {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ public DefaultGLPixelBufferProvider(boolean allowRowStride) { - this.allowRowStride = allowRowStride; + this.allowRowStride = allowRowStride; } - + @Override public boolean getAllowRowStride() { return allowRowStride; } - + @Override public GLPixelAttributes getAttributes(GL gl, int componentCount) { final GLContext ctx = gl.getContext(); final int dFormat, dType; - + if( 1 == componentCount ) { if( gl.isGL3ES3() ) { // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core @@ -122,7 +122,7 @@ public class GLPixelBuffer { dType = GL.GL_UNSIGNED_BYTE; } else if( 3 == componentCount ) { dFormat = GL.GL_RGB; - dType = GL.GL_UNSIGNED_BYTE; + dType = GL.GL_UNSIGNED_BYTE; } else if( 4 == componentCount ) { int _dFormat = ctx.getDefaultPixelDataFormat(); final int dComps = GLBuffers.componentCount(_dFormat); @@ -131,14 +131,14 @@ public class GLPixelBuffer { dType = ctx.getDefaultPixelDataType(); } else { dFormat = GL.GL_RGBA; - dType = GL.GL_UNSIGNED_BYTE; + dType = GL.GL_UNSIGNED_BYTE; } } else { throw new GLException("Unsupported componentCount "+componentCount+", contact maintainer to enhance"); } return new GLPixelAttributes(componentCount, dFormat, dType); } - + /** * {@inheritDoc} * <p> @@ -148,7 +148,7 @@ public class GLPixelBuffer { @Override public GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { if( minByteSize > 0 ) { - return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); + return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); } else { int[] tmp = { 0 }; final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack); @@ -156,26 +156,26 @@ public class GLPixelBuffer { } } } - - /** + + /** * Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>false</code>, * utilizing best match for {@link GLPixelAttributes} * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. */ public static GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false); - - /** + + /** * Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>true</code>, * utilizing best match for {@link GLPixelAttributes} * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}. */ public static GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true); - - /** Pixel attributes. */ + + /** Pixel attributes. */ public static class GLPixelAttributes { - /** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */ + /** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */ public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0, 0, false); - + /** Pixel <i>source</i> component count, i.e. number of meaningful components. */ public final int componentCount; /** The OpenGL pixel data format */ @@ -184,7 +184,7 @@ public class GLPixelBuffer { public final int type; /** The OpenGL pixel size in bytes */ public final int bytesPerPixel; - + /** * Deriving {@link #componentCount} via GL <code>dataFormat</code>, i.e. {@link GLBuffers#componentCount(int)} if > 0. * @param dataFormat GL data format @@ -194,7 +194,7 @@ public class GLPixelBuffer { this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType); } /** - * Using user specified source {@link #componentCount}. + * Using user specified source {@link #componentCount}. * @param componentCount source component count * @param dataFormat GL data format * @param dataType GL data type @@ -220,7 +220,7 @@ public class GLPixelBuffer { return "PixelAttributes[comp "+componentCount+", fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", bytesPerPixel "+bytesPerPixel+"]"; } } - + /** The {@link GLPixelAttributes}. */ public final GLPixelAttributes pixelAttributes; /** Width in pixels. */ @@ -233,22 +233,22 @@ public class GLPixelBuffer { public final boolean pack; /** Byte size of the buffer. Actually the number of {@link Buffer#remaining()} bytes when passed in ctor. */ public final int byteSize; - /** - * Buffer holding the pixel data. If {@link #rewind()}, it holds <code>byteSize</code> {@link Buffer#remaining()} bytes. + /** + * Buffer holding the pixel data. If {@link #rewind()}, it holds <code>byteSize</code> {@link Buffer#remaining()} bytes. * <p> * By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)}. * However, other {@link GLPixelBufferProvider} may utilize different {@link Buffer} types. * </p> - */ + */ public final Buffer buffer; /** Buffer element size in bytes. */ public final int bufferElemSize; - + /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. See {@link #requiresNewBuffer(GL, int, int, int)}. */ public final boolean allowRowStride; - + private boolean disposed = false; - + public StringBuilder toString(StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); @@ -272,7 +272,7 @@ public class GLPixelBuffer { * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. */ public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer, boolean allowRowStride) { - this.pixelAttributes = pixelAttributes; + this.pixelAttributes = pixelAttributes; this.width = width; this.height = height; this.depth = depth; @@ -282,15 +282,15 @@ public class GLPixelBuffer { this.bufferElemSize = Buffers.sizeOfBufferElem(buffer); this.allowRowStride = allowRowStride; } - + /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */ public final boolean getAllowRowStride() { return allowRowStride; } - + /** Is not {@link #dispose() disposed} and has {@link #byteSize} > 0. */ public boolean isValid() { return !disposed && 0 < byteSize; } - + /** See {@link Buffer#rewind()}. */ public Buffer rewind() { return buffer.rewind(); @@ -300,40 +300,40 @@ public class GLPixelBuffer { public int position() { return buffer.position() * bufferElemSize; } - + /** Sets the byte position of the {@link #buffer}. */ public Buffer position(int bytePos) { return buffer.position( bytePos / bufferElemSize ); } - + /** Returns the byte capacity of the {@link #buffer}. */ public int capacity() { return buffer.capacity() * bufferElemSize; } - + /** Returns the byte limit of the {@link #buffer}. */ public int limit() { return buffer.limit() * bufferElemSize; } - + /** See {@link Buffer#flip()}. */ public Buffer flip() { - return buffer.flip(); + return buffer.flip(); } - + /** See {@link Buffer#clear()}. */ public Buffer clear() { - return buffer.clear(); + return buffer.clear(); } - - /** + + /** * Returns true, if {@link #isValid() invalid} or implementation requires a new buffer based on the new size * due to pixel alignment or byte size, otherwise false. * <p> * It is assumed that <code>pixelAttributes</code>, <code>depth</code> and <code>pack</code> stays the same! * </p> * <p> - * The minimum required byte size equals to <code>minByteSize</code>, if > 0, + * The minimum required byte size equals to <code>minByteSize</code>, if > 0, * otherwise {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean) GLBuffers.sizeof(..)} * is being used to calculate it. This value is referred to <i>newByteSize</i>. * </p> @@ -341,16 +341,16 @@ public class GLPixelBuffer { * If <code>{@link #allowRowStride} = false</code>, * method returns <code>true</code> if the <i>newByteSize</i> > <i>currentByteSize</i> * or the <code>newWidth</code> != <code>currentWidth</code>. - * </p> + * </p> * <p> * If <code>{@link #allowRowStride} = true</code>, see {@link GLPixelBufferProvider#getAllowRowStride()}, - * method returns <code>true</code> only if the <i>newByteSize</i> > <i>currentByteSize</i>. + * method returns <code>true</code> only if the <i>newByteSize</i> > <i>currentByteSize</i>. * Assuming user utilizes the row-stride when dealing w/ the data, i.e. {@link GL2ES3#GL_PACK_ROW_LENGTH}. * </p> * @param gl the corresponding current GL context object * @param newWidth new width in pixels * @param newHeight new height in pixels - * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. + * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. * @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) */ public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int newByteSize) { @@ -366,7 +366,7 @@ public class GLPixelBuffer { } return byteSize < newByteSize || width != newWidth; } - + /** Dispose resources. See {@link #isValid()}. */ public void dispose() { disposed = true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java index f512a3aae..1c6e97450 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java @@ -46,35 +46,35 @@ public class GLPixelStorageModes { /** Create instance w/o {@link #save(GL)} */ public GLPixelStorageModes() {} - + /** Create instance w/ {@link #save(GL)} */ public GLPixelStorageModes(GL gl) { save(gl); } - + /** * Sets the {@link GL#GL_PACK_ALIGNMENT}. - * <p> + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ public final void setPackAlignment(GL gl, int packAlignment) { save(gl); - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment); + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment); } /** * Sets the {@link GL#GL_UNPACK_ALIGNMENT}. - * <p> + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ public final void setUnpackAlignment(GL gl, int unpackAlignment) { save(gl); - gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment); } - + /** - * Sets the {@link GL#GL_PACK_ALIGNMENT} and {@link GL#GL_UNPACK_ALIGNMENT}. - * <p> + * Sets the {@link GL#GL_PACK_ALIGNMENT} and {@link GL#GL_UNPACK_ALIGNMENT}. + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ @@ -82,32 +82,32 @@ public class GLPixelStorageModes { setPackAlignment(gl, packAlignment); setUnpackAlignment(gl, unpackAlignment); } - + /** * Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH}. - * <p> + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ public final void setPackRowLength(GL2ES3 gl, int packRowLength) { save(gl); - gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength); + gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength); } /** * Sets the {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. - * <p> + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ public final void setUnpackRowLength(GL2ES2 gl, int unpackRowLength) { save(gl); - gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, unpackRowLength); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, unpackRowLength); } - + /** * Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH} and {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. - * <p> + * <p> * Saves the pixel storage modes if not saved yet. * </p> */ @@ -115,7 +115,7 @@ public class GLPixelStorageModes { setPackRowLength(gl, packRowLength); setUnpackRowLength(gl, unpackRowLength); } - + /** * Save the pixel storage mode, if not saved yet. * <p> @@ -126,8 +126,8 @@ public class GLPixelStorageModes { if(saved) { return; } - - if(gl.isGL2GL3()) { + + if(gl.isGL2GL3()) { if(gl.isGL2()) { gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT); } else { @@ -154,7 +154,7 @@ public class GLPixelStorageModes { // embedded deals with pack/unpack alignment only gl.glGetIntegerv(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment, 0); gl.glGetIntegerv(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment, 1); - } + } saved = true; } @@ -166,8 +166,8 @@ public class GLPixelStorageModes { if(!saved) { throw new GLException("pixel storage modes not saved"); } - - if(gl.isGL2GL3()) { + + if(gl.isGL2GL3()) { if(gl.isGL2()) { gl.getGL2().glPopClientAttrib(); } else { @@ -186,9 +186,9 @@ public class GLPixelStorageModes { // embedded deals with pack/unpack alignment only gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment[0]); gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment[1]); - } + } saved = false; - } + } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index 65d1b6906..b942c9ab2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.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 com.jogamp.opengl.util; import java.io.File; @@ -51,45 +51,45 @@ import com.jogamp.opengl.util.texture.TextureIO; */ public class GLReadBufferUtil { protected final GLPixelBufferProvider pixelBufferProvider; - protected final int componentCount, alignment; + protected final int componentCount, alignment; protected final Texture readTexture; - protected final GLPixelStorageModes psm; - + protected final GLPixelStorageModes psm; + protected GLPixelBuffer readPixelBuffer = null; protected TextureData readTextureData = null; /** - * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms! + * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms! * @param write2Texture true if readPixel's TextureData shall be written to a 2d Texture */ public GLReadBufferUtil(boolean alpha, boolean write2Texture) { this(GLPixelBuffer.defaultProviderNoRowStride, alpha, write2Texture); } - + public GLReadBufferUtil(GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) { this.pixelBufferProvider = pixelBufferProvider; this.componentCount = alpha ? 4 : 3 ; - this.alignment = alpha ? 4 : 1 ; + this.alignment = alpha ? 4 : 1 ; this.readTexture = write2Texture ? new Texture(GL.GL_TEXTURE_2D) : null ; this.psm = new GLPixelStorageModes(); } - + /** Returns the {@link GLPixelBufferProvider} used by this instance. */ public GLPixelBufferProvider getPixelBufferProvider() { return pixelBufferProvider; } - + public boolean isValid() { return null!=readTextureData && null!=readPixelBuffer && readPixelBuffer.isValid(); } - + public boolean hasAlpha() { return 4 == componentCount ? true : false ; } - + public GLPixelStorageModes getGLPixelStorageModes() { return psm; } - + /** * Returns the {@link GLPixelBuffer}, created and filled by {@link #readPixels(GLAutoDrawable, boolean)}. */ public GLPixelBuffer getPixelBuffer() { return readPixelBuffer; } - + /** * rewind the raw pixel ByteBuffer */ @@ -99,7 +99,7 @@ public class GLReadBufferUtil { * @return the resulting TextureData, filled by {@link #readPixels(GLAutoDrawable, boolean)} */ public TextureData getTextureData() { return readTextureData; } - + /** * @return the Texture object filled by {@link #readPixels(GLAutoDrawable, boolean)}, * if this instance writes to a 2d Texture, otherwise null. @@ -121,27 +121,27 @@ public class GLReadBufferUtil { /** * Read the drawable's pixels to TextureData and Texture, if requested at construction. - * + * * @param gl the current GL context object. It's read drawable is being used as the pixel source. * @param mustFlipVertically indicates whether to flip the data vertically or not. * The context's drawable {@link GLDrawable#isGLOriented()} state * is taken into account. * Vertical flipping is propagated to TextureData * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). - * + * * @see #GLReadBufferUtil(boolean, boolean) */ public boolean readPixels(GL gl, boolean mustFlipVertically) { return readPixels(gl, 0, 0, 0, 0, mustFlipVertically); } - + /** * Read the drawable's pixels to TextureData and Texture, if requested at construction. - * + * * @param gl the current GL context object. It's read drawable is being used as the pixel source. * @param inX readPixel x offset * @param inY readPixel y offset - * @param inWidth optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width + * @param inWidth optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width * @param inHeight optional readPixel height, used if [1 .. drawable.height], otherwise using drawable.height * @param mustFlipVertically indicates whether to flip the data vertically or not. * The context's drawable {@link GLDrawable#isGLOriented()} state @@ -174,17 +174,17 @@ public class GLReadBufferUtil { } else { height= inHeight; } - + final boolean flipVertically; if( drawable.isGLOriented() ) { flipVertically = mustFlipVertically; } else { flipVertically = !mustFlipVertically; } - + final int tmp[] = new int[1]; final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, width, height, 1, true); - + boolean newData = false; if( null == readPixelBuffer || readPixelBuffer.requiresNewBuffer(gl, width, height, readPixelSize) ) { readPixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, width, height, 1, true, readPixelSize); @@ -194,9 +194,9 @@ public class GLReadBufferUtil { gl.getGLProfile(), internalFormat, width, height, - 0, + 0, pixelAttribs, - false, false, + false, false, flipVertically, readPixelBuffer.buffer, null /* Flusher */); @@ -230,13 +230,13 @@ public class GLReadBufferUtil { " "+width+"x"+height+ ", "+pixelAttribs+ ", "+readPixelBuffer+", sz "+readPixelSize); - res = false; + res = false; } if(res && null != readTexture) { if(newData) { readTexture.updateImage(gl, readTextureData); } else { - readTexture.updateSubImage(gl, readTextureData, 0, + readTexture.updateSubImage(gl, readTextureData, 0, 0, 0, // src offset 0, 0, // dst offset width, height); @@ -248,7 +248,7 @@ public class GLReadBufferUtil { return res; } - public void dispose(GL gl) { + public void dispose(GL gl) { if(null != readTexture) { readTexture.destroy(gl); readTextureData = null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java index c649d1c6a..966781906 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 111e2509e..697b7cca0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -34,28 +34,28 @@ import com.jogamp.opengl.util.glsl.ShaderState; * to be either rendered directly via {@link #glEnd(GL)} or to be added to an internal display list * via {@link #glEnd(GL, boolean) glEnd(gl, false)} for deferred rendering via {@link #draw(GL, boolean)}. * </p> - * <a name="storageDetails"><h5>Buffer storage and it's creation via {@link #createFixed(int, int, int, int, int, int, int, int, int, int) createFixed(..)} - * and {@link #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) createGLSL(..)}</h5></a> + * <a name="storageDetails"><h5>Buffer storage and it's creation via {@link #createFixed(int, int, int, int, int, int, int, int, int, int) createFixed(..)} + * and {@link #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) createGLSL(..)}</h5></a> * <p> - * If unsure whether <i>colors</i>, <i>normals</i> and <i>textures</i> will be used, + * If unsure whether <i>colors</i>, <i>normals</i> and <i>textures</i> will be used, * simply add them with an expected component count. * This implementation will only render buffers which are being filled.<br/> * The buffer growing implementation will only grow the exceeded buffers, unused buffers are not resized. * </p> * <p> - * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc. + * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc. * This is a semantic constraint, same as in the original OpenGL spec. * </p> */ public class ImmModeSink { protected static final boolean DEBUG_BEGIN_END; - protected static final boolean DEBUG_DRAW; + protected static final boolean DEBUG_DRAW; protected static final boolean DEBUG_BUFFER; - + static { Debug.initSingleton(); DEBUG_BEGIN_END = Debug.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true); - DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); + DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); DEBUG_BUFFER = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true); } @@ -68,7 +68,7 @@ public class ImmModeSink { * <p> * See <a href="#storageDetails"> buffer storage details</a>. * </p> - * + * * @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size. * @param vComps mandatory vertex component count, should be 2, 3 or 4. * @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT} @@ -78,17 +78,17 @@ public class ImmModeSink { * @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT} * @param tComps optional texture-coordinate component count, may be 0, 2 or 3 * @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT} - * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, + * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, * set to <code>0</code> for no VBO usage */ - public static ImmModeSink createFixed(int initialElementCount, + public static ImmModeSink createFixed(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, + int nComps, int nDataType, + int tComps, int tDataType, int glBufferUsage) { - return new ImmModeSink(initialElementCount, - vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, + return new ImmModeSink(initialElementCount, + vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, false, glBufferUsage, null, 0); } @@ -97,7 +97,7 @@ public class ImmModeSink { * <p> * See <a href="#storageDetails"> buffer storage details</a>. * </p> - * + * * @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size. * @param vComps mandatory vertex component count, should be 2, 3 or 4. * @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT} @@ -107,21 +107,21 @@ public class ImmModeSink { * @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT} * @param tComps optional texture-coordinate component count, may be 0, 2 or 3 * @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT} - * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, + * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, * set to <code>0</code> for no VBO usage * @param st ShaderState to locate the vertex attributes * @see #draw(GL, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, + public static ImmModeSink createGLSL(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, + int nComps, int nDataType, + int tComps, int tDataType, int glBufferUsage, ShaderState st) { - return new ImmModeSink(initialElementCount, - vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, + return new ImmModeSink(initialElementCount, + vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, st, 0); } @@ -130,7 +130,7 @@ public class ImmModeSink { * <p> * See <a href="#storageDetails"> buffer storage details</a>. * </p> - * + * * @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size. * @param vComps mandatory vertex component count, should be 2, 3 or 4. * @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT} @@ -140,24 +140,24 @@ public class ImmModeSink { * @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT} * @param tComps optional texture-coordinate component count, may be 0, 2 or 3 * @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT} - * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, + * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, * set to <code>0</code> for no VBO usage * @param shaderProgram shader-program name to locate the vertex attributes * @see #draw(GL, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, + public static ImmModeSink createGLSL(int initialElementCount, int vComps, int vDataType, int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, + int nComps, int nDataType, + int tComps, int tDataType, int glBufferUsage, int shaderProgram) { - return new ImmModeSink(initialElementCount, - vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, + return new ImmModeSink(initialElementCount, + vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, null, shaderProgram); } - + public void destroy(GL gl) { destroyList(gl); @@ -346,7 +346,7 @@ public class ImmModeSink { public final void glColor3ub(byte x, byte y, byte z) { vboSet.glColor3ub(x,y,z); } - + public final void glColor4b(byte x, byte y, byte z, byte a) { vboSet.glColor4b(x,y,z,a); } @@ -354,7 +354,7 @@ public class ImmModeSink { public final void glColor4ub(byte x, byte y, byte z, byte a) { vboSet.glColor4ub(x,y,z,a); } - + public final void glTexCoord2b(byte x, byte y) { vboSet.glTexCoord2b(x,y); } @@ -363,26 +363,26 @@ public class ImmModeSink { vboSet.glTexCoord3b(x,y,z); } - protected ImmModeSink(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, + protected ImmModeSink(int initialElementCount, + int vComps, int vDataType, + int cComps, int cDataType, + int nComps, int nDataType, + int tComps, int tDataType, boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { - vboSet = new VBOSet(initialElementCount, - vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, + vboSet = new VBOSet(initialElementCount, + vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, st, shaderProgram); this.vboSetList = new ArrayList<VBOSet>(); } - + public boolean getUseVBO() { return vboSet.getUseVBO(); } - + /** * Returns the additional element count if buffer resize is required. * @see #setResizeElementCount(int) */ public int getResizeElementCount() { return vboSet.getResizeElementCount(); } - + /** * Sets the additional element count if buffer resize is required, * defaults to <code>initialElementCount</code> of factory method. @@ -390,7 +390,7 @@ public class ImmModeSink { * @see #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) */ public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); } - + private void destroyList(GL gl) { for(int i=0; i<vboSetList.size(); i++) { vboSetList.get(i).destroy(gl); @@ -402,11 +402,11 @@ public class ImmModeSink { private final ArrayList<VBOSet> vboSetList; protected static class VBOSet { - protected VBOSet (int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, + protected VBOSet (int initialElementCount, + int vComps, int vDataType, + int cComps, int cDataType, + int nComps, int nDataType, + int tComps, int tDataType, boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { // final .. this.glBufferUsage=glBufferUsage; @@ -415,7 +415,7 @@ public class ImmModeSink { this.useGLSL=useGLSL; this.shaderState = st; this.shaderProgram = shaderProgram; - + if(useGLSL && null == shaderState && 0 == shaderProgram) { throw new IllegalArgumentException("Using GLSL but neither a valid shader-program nor ShaderState has been passed!"); } @@ -436,9 +436,9 @@ public class ImmModeSink { this.tDataType=tDataType; this.tDataTypeSigned=GLBuffers.isSignedGLType(tDataType); this.tComps=tComps; - this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType); + this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType); this.vboName = 0; - + this.vCount=0; this.cCount=0; this.nCount=0; @@ -447,9 +447,9 @@ public class ImmModeSink { this.cElems=0; this.nElems=0; this.tElems=0; - + this.pageSize = Platform.getMachineDescription().pageSizeInBytes(); - + reallocateBuffer(initialElementCount); rewind(); @@ -465,30 +465,30 @@ public class ImmModeSink { protected int getResizeElementCount() { return resizeElementCount; } protected void setResizeElementCount(int v) { resizeElementCount=v; } - + protected boolean getUseVBO() { return useVBO; } - + protected final VBOSet regenerate(GL gl) { - return new VBOSet(initialElementCount, vComps, - vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, + return new VBOSet(initialElementCount, vComps, + vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, shaderState, shaderProgram); } protected void checkSeal(boolean test) throws GLException { if(0==mode) { - throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this); + throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this); } if(sealed!=test) { if(test) { - throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this); + throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this); } else { - throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this); + throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this); } } } private boolean usingShaderProgram = false; - + protected void useShaderProgram(GL2ES2 gl, boolean force) { if( force || !usingShaderProgram ) { if(null != shaderState) { @@ -499,19 +499,19 @@ public class ImmModeSink { usingShaderProgram = true; } } - + protected void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw, int i) { enableBuffer(gl, true); - + if(null != shaderState || 0 != shaderProgram) { useShaderProgram(gl.getGL2ES2(), false); } - + if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw["+i+"].0 (disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this); } - + if (buffer!=null) { if(null==indices) { if ( GL_QUADS == mode && !gl.isGL2() ) { @@ -523,7 +523,7 @@ public class ImmModeSink { } } else { // FIXME: Impl. VBO usage .. or unroll. - if( !gl.getContext().isCPUDataSourcingAvail() ) { + if( !gl.getContext().isCPUDataSourcingAvail() ) { throw new GLException("CPU data sourcing n/a w/ "+gl.getContext()); } final int type; @@ -538,23 +538,23 @@ public class ImmModeSink { } final int idxLen = indices.remaining(); final int idx0 = indices.position(); - + if ( GL_QUADS == mode && !gl.isGL2() ) { if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; for (int j = 0; j < idxLen; 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 < idxLen; 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 < idxLen; j++) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); - } + } } } else { ((GL2ES1)gl).glDrawElements(mode, idxLen, type, indices); @@ -566,7 +566,7 @@ public class ImmModeSink { if(disableBufferAfterDraw) { enableBuffer(gl, false); } - + if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw["+i+"].X (disableBufferAfterDraw: "+disableBufferAfterDraw+")"); } @@ -592,7 +592,7 @@ public class ImmModeSink { public void glVertex2b(byte x, byte y) { checkSeal(false); growBuffer(VERTEX); - if(vComps>0) + if(vComps>0) Buffers.putNb(vertexArray, vDataTypeSigned, x, true); if(vComps>1) Buffers.putNb(vertexArray, vDataTypeSigned, y, true); @@ -614,7 +614,7 @@ public class ImmModeSink { growBuffer(VERTEX); if(vComps>0) Buffers.putNs(vertexArray, vDataTypeSigned, x, true); - if(vComps>1) + if(vComps>1) Buffers.putNs(vertexArray, vDataTypeSigned, y, true); countAndPadding(VERTEX, vComps-2); } @@ -623,16 +623,16 @@ public class ImmModeSink { growBuffer(VERTEX); if(vComps>0) Buffers.putNs(vertexArray, vDataTypeSigned, x, true); - if(vComps>1) + if(vComps>1) Buffers.putNs(vertexArray, vDataTypeSigned, y, true); - if(vComps>2) + if(vComps>2) Buffers.putNs(vertexArray, vDataTypeSigned, z, true); countAndPadding(VERTEX, vComps-3); } public void glVertex2f(float x, float y) { checkSeal(false); growBuffer(VERTEX); - if(vComps>0) + if(vComps>0) Buffers.putNf(vertexArray, vDataTypeSigned, x); if(vComps>1) Buffers.putNf(vertexArray, vDataTypeSigned, y); @@ -641,11 +641,11 @@ public class ImmModeSink { public void glVertex3f(float x, float y, float z) { checkSeal(false); growBuffer(VERTEX); - if(vComps>0) + if(vComps>0) Buffers.putNf(vertexArray, vDataTypeSigned, x); if(vComps>1) Buffers.putNf(vertexArray, vDataTypeSigned, y); - if(vComps>2) + if(vComps>2) Buffers.putNf(vertexArray, vDataTypeSigned, z); countAndPadding(VERTEX, vComps-3); } @@ -653,33 +653,33 @@ public class ImmModeSink { public void glNormal3b(byte x, byte y, byte z) { checkSeal(false); growBuffer(NORMAL); - if(nComps>0) + if(nComps>0) Buffers.putNb(normalArray, nDataTypeSigned, x, true); - if(nComps>1) + if(nComps>1) Buffers.putNb(normalArray, nDataTypeSigned, y, true); - if(nComps>2) + if(nComps>2) Buffers.putNb(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } public void glNormal3s(short x, short y, short z) { checkSeal(false); growBuffer(NORMAL); - if(nComps>0) + if(nComps>0) Buffers.putNs(normalArray, nDataTypeSigned, x, true); - if(nComps>1) + if(nComps>1) Buffers.putNs(normalArray, nDataTypeSigned, y, true); - if(nComps>2) + if(nComps>2) Buffers.putNs(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } public void glNormal3f(float x, float y, float z) { checkSeal(false); growBuffer(NORMAL); - if(nComps>0) + if(nComps>0) Buffers.putNf(normalArray, nDataTypeSigned, x); if(nComps>1) Buffers.putNf(normalArray, nDataTypeSigned, y); - if(nComps>2) + if(nComps>2) Buffers.putNf(normalArray, nDataTypeSigned, z); countAndPadding(NORMAL, nComps-3); } @@ -687,96 +687,96 @@ public class ImmModeSink { public void glColor3b(byte r, byte g, byte b) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNb(colorArray, cDataTypeSigned, r, true); - if(cComps>1) + if(cComps>1) Buffers.putNb(colorArray, cDataTypeSigned, g, true); - if(cComps>2) + if(cComps>2) Buffers.putNb(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } public void glColor3ub(byte r, byte g, byte b) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNb(colorArray, cDataTypeSigned, r, false); - if(cComps>1) + if(cComps>1) Buffers.putNb(colorArray, cDataTypeSigned, g, false); - if(cComps>2) + if(cComps>2) Buffers.putNb(colorArray, cDataTypeSigned, b, false); countAndPadding(COLOR, cComps-3); } public void glColor4b(byte r, byte g, byte b, byte a) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNb(colorArray, cDataTypeSigned, r, true); - if(cComps>1) + if(cComps>1) Buffers.putNb(colorArray, cDataTypeSigned, g, true); - if(cComps>2) + if(cComps>2) Buffers.putNb(colorArray, cDataTypeSigned, b, true); - if(cComps>3) + if(cComps>3) Buffers.putNb(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } public void glColor4ub(byte r, byte g, byte b, byte a) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNb(colorArray, cDataTypeSigned, r, false); - if(cComps>1) + if(cComps>1) Buffers.putNb(colorArray, cDataTypeSigned, g, false); - if(cComps>2) + if(cComps>2) Buffers.putNb(colorArray, cDataTypeSigned, b, false); - if(cComps>3) + if(cComps>3) Buffers.putNb(colorArray, cDataTypeSigned, a, false); countAndPadding(COLOR, cComps-4); } public void glColor3s(short r, short g, short b) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNs(colorArray, cDataTypeSigned, r, true); - if(cComps>1) + if(cComps>1) Buffers.putNs(colorArray, cDataTypeSigned, g, true); - if(cComps>2) + if(cComps>2) Buffers.putNs(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } public void glColor4s(short r, short g, short b, short a) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNs(colorArray, cDataTypeSigned, r, true); - if(cComps>1) + if(cComps>1) Buffers.putNs(colorArray, cDataTypeSigned, g, true); - if(cComps>2) + if(cComps>2) Buffers.putNs(colorArray, cDataTypeSigned, b, true); - if(cComps>3) + if(cComps>3) Buffers.putNs(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } public void glColor3f(float r, float g, float b) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNf(colorArray, cDataTypeSigned, r); - if(cComps>1) + if(cComps>1) Buffers.putNf(colorArray, cDataTypeSigned, g); - if(cComps>2) + if(cComps>2) Buffers.putNf(colorArray, cDataTypeSigned, b); countAndPadding(COLOR, cComps-3); } public void glColor4f(float r, float g, float b, float a) { checkSeal(false); growBuffer(COLOR); - if(cComps>0) + if(cComps>0) Buffers.putNf(colorArray, cDataTypeSigned, r); - if(cComps>1) + if(cComps>1) Buffers.putNf(colorArray, cDataTypeSigned, g); - if(cComps>2) + if(cComps>2) Buffers.putNf(colorArray, cDataTypeSigned, b); - if(cComps>3) + if(cComps>3) Buffers.putNf(colorArray, cDataTypeSigned, a); countAndPadding(COLOR, cComps-4); } @@ -784,60 +784,60 @@ public class ImmModeSink { public void glTexCoord2b(byte x, byte y) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNb(textCoordArray, tDataTypeSigned, x, true); - if(tComps>1) + if(tComps>1) Buffers.putNb(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } public void glTexCoord3b(byte x, byte y, byte z) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNb(textCoordArray, tDataTypeSigned, x, true); - if(tComps>1) + if(tComps>1) Buffers.putNb(textCoordArray, tDataTypeSigned, y, true); - if(tComps>2) + if(tComps>2) Buffers.putNb(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } public void glTexCoord2s(short x, short y) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNs(textCoordArray, tDataTypeSigned, x, true); - if(tComps>1) + if(tComps>1) Buffers.putNs(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } public void glTexCoord3s(short x, short y, short z) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNs(textCoordArray, tDataTypeSigned, x, true); - if(tComps>1) + if(tComps>1) Buffers.putNs(textCoordArray, tDataTypeSigned, y, true); - if(tComps>2) + if(tComps>2) Buffers.putNs(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } public void glTexCoord2f(float x, float y) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNf(textCoordArray, tDataTypeSigned, x); - if(tComps>1) + if(tComps>1) Buffers.putNf(textCoordArray, tDataTypeSigned, y); countAndPadding(TEXTCOORD, tComps-2); } public void glTexCoord3f(float x, float y, float z) { checkSeal(false); growBuffer(TEXTCOORD); - if(tComps>0) + if(tComps>0) Buffers.putNf(textCoordArray, tDataTypeSigned, x); - if(tComps>1) + if(tComps>1) Buffers.putNf(textCoordArray, tDataTypeSigned, y); - if(tComps>2) + if(tComps>2) Buffers.putNf(textCoordArray, tDataTypeSigned, z); countAndPadding(TEXTCOORD, tComps-3); } @@ -864,20 +864,20 @@ public class ImmModeSink { shaderProgram = program; glslLocationSet = false; // enforce location reset! } - + /** * @param gl * @return true if all locations for all used arrays are found (min 1 array), otherwise false. - * Also sets 'glslLocationSet' to the return value! + * Also sets 'glslLocationSet' to the return value! */ private boolean resetGLSLArrayLocation(GL2ES2 gl) { int iA = 0; int iL = 0; - + if(null != vArrayData) { iA++; if( vArrayData.setLocation(gl, shaderProgram) >= 0 ) { - iL++; + iL++; } } if(null != cArrayData) { @@ -901,7 +901,7 @@ public class ImmModeSink { glslLocationSet = iA == iL; return glslLocationSet; } - + public void destroy(GL gl) { reset(gl); @@ -931,7 +931,7 @@ public class ImmModeSink { this.vElems=0; this.cElems=0; this.nElems=0; - this.tElems=0; + this.tElems=0; } public void seal(GL glObj, boolean seal) @@ -1016,20 +1016,20 @@ public class ImmModeSink { } } else { gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, glBufferUsage); - bufferWrittenOnce = true; - } + bufferWrittenOnce = true; + } } - + private void enableBufferFixed(GL gl, boolean enable) { GL2ES1 glf = gl.getGL2ES1(); - + final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; final boolean useN = nComps>0 && nElems>0 ; final boolean useT = tComps>0 && tElems>0 ; - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); + System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); } if(enable) { @@ -1038,7 +1038,7 @@ public class ImmModeSink { throw new InternalError("Using VBO but no vboName"); } glf.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName); - + if(!bufferWritten) { writeBuffer(gl); } @@ -1051,7 +1051,7 @@ public class ImmModeSink { glf.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); glf.glVertexPointer(vArrayData); } else { - glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } } if(useC) { @@ -1082,24 +1082,24 @@ public class ImmModeSink { if(enable && useVBO) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableFixed.X "); + System.err.println("ImmModeSink.enableFixed.X "); } } private void enableBufferGLSLShaderState(GL gl, boolean enable) { GL2ES2 glsl = gl.getGL2ES2(); - + final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; final boolean useN = nComps>0 && nElems>0 ; final boolean useT = tComps>0 && tElems>0 ; - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); + System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); } - + if(enable) { if(useVBO) { if(0 == vboName) { @@ -1110,9 +1110,9 @@ public class ImmModeSink { writeBuffer(gl); } } - bufferWritten=true; + bufferWritten=true; } - + if(useV) { if(enable) { shaderState.enableVertexAttribArray(glsl, vArrayData); @@ -1144,30 +1144,30 @@ public class ImmModeSink { } else { shaderState.disableVertexAttribArray(glsl, tArrayData); } - } + } glslLocationSet = true; // ShaderState does set the location implicit - + if(enable && useVBO) { glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableGLSL.A.X "); + System.err.println("ImmModeSink.enableGLSL.A.X "); } } private void enableBufferGLSLSimple(GL gl, boolean enable) { GL2ES2 glsl = gl.getGL2ES2(); - + final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; final boolean useN = nComps>0 && nElems>0 ; final boolean useT = tComps>0 && tElems>0 ; - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); + System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer); } - + if(!glslLocationSet) { if( !resetGLSLArrayLocation(glsl) ) { if(DEBUG_DRAW) { @@ -1180,7 +1180,7 @@ public class ImmModeSink { return; } } - + if(enable) { if(useVBO) { if(0 == vboName) { @@ -1226,28 +1226,28 @@ public class ImmModeSink { glsl.glDisableVertexAttribArray(tArrayData.getLocation()); } } - + if(enable && useVBO) { glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } - + if(DEBUG_DRAW) { - System.err.println("ImmModeSink.enableGLSL.B.X "); + System.err.println("ImmModeSink.enableGLSL.B.X "); } } - + public String toString() { - final String glslS = useGLSL ? + final String glslS = useGLSL ? ", useShaderState "+(null!=shaderState)+ ", shaderProgram "+shaderProgram+ ", glslLocationSet "+glslLocationSet : ""; - - return "VBOSet[mode "+mode+ - ", modeOrig "+modeOrig+ + + return "VBOSet[mode "+mode+ + ", modeOrig "+modeOrig+ ", use/count "+getElemUseCountStr()+ - ", sealed "+sealed+ + ", sealed "+sealed+ ", sealedGL "+sealedGL+ - ", bufferEnabled "+bufferEnabled+ + ", bufferEnabled "+bufferEnabled+ ", bufferWritten "+bufferWritten+" (once "+bufferWrittenOnce+")"+ ", useVBO "+useVBO+", vboName "+vboName+ ", useGLSL "+useGLSL+ @@ -1264,7 +1264,7 @@ public class ImmModeSink { protected String getElemUseCountStr() { return "[v "+vElems+"/"+vCount+", c "+cElems+"/"+cCount+", n "+nElems+"/"+nCount+", t "+tElems+"/"+tCount+"]"; } - + protected boolean fitElementInBuffer(int type) { final int addElems = 1; switch (type) { @@ -1280,20 +1280,20 @@ public class ImmModeSink { throw new InternalError("XXX"); } } - + protected boolean reallocateBuffer(int addElems) { final int vAdd = addElems - ( vCount - vElems ); final int cAdd = addElems - ( cCount - cElems ); final int nAdd = addElems - ( nCount - nElems ); final int tAdd = addElems - ( tCount - tElems ); - + if( 0>=vAdd && 0>=cAdd && 0>=nAdd && 0>=tAdd) { if(DEBUG_BUFFER) { System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems+" -> NOP"); } return false; } - + if(DEBUG_BUFFER) { System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems); } @@ -1301,20 +1301,20 @@ public class ImmModeSink { cCount += cAdd; nCount += nAdd; tCount += tAdd; - + final int vBytes = vCount * vCompsBytes; final int cBytes = cCount * cCompsBytes; final int nBytes = nCount * nCompsBytes; final int tBytes = tCount * tCompsBytes; - + buffer = Buffers.newDirectByteBuffer( vBytes + cBytes + nBytes + tBytes ); vOffset = 0; - + if(vBytes>0) { vertexArray = GLBuffers.sliceGLBuffer(buffer, vOffset, vBytes, vDataType); } else { vertexArray = null; - } + } cOffset=vOffset+vBytes; if(cBytes>0) { @@ -1341,36 +1341,36 @@ public class ImmModeSink { buffer.flip(); if(vComps>0) { - vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps, + vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps, vDataType, GLBuffers.isGLTypeFixedPoint(vDataType), 0, vertexArray, 0, vOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } else { vArrayData = null; } if(cComps>0) { - cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps, + cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps, cDataType, GLBuffers.isGLTypeFixedPoint(cDataType), 0, colorArray, 0, cOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } else { cArrayData = null; } if(nComps>0) { - nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps, + nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps, nDataType, GLBuffers.isGLTypeFixedPoint(nDataType), 0, normalArray, 0, nOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } else { nArrayData = null; } if(tComps>0) { - tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps, + tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps, tDataType, GLBuffers.isGLTypeFixedPoint(tDataType), 0, textCoordArray, 0, tOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } else { tArrayData = null; } - + bufferWrittenOnce = false; // new buffer data storage size! - + if(DEBUG_BUFFER) { System.err.println("ImmModeSink.realloc.X: "+this.toString()); Thread.dumpStack(); @@ -1384,7 +1384,7 @@ public class ImmModeSink { if( !fitElementInBuffer(type) ) { // save olde values .. final Buffer _vertexArray=vertexArray, _colorArray=colorArray, _normalArray=normalArray, _textCoordArray=textCoordArray; - + if ( reallocateBuffer(resizeElementCount) ) { if(null!=_vertexArray) { _vertexArray.flip(); @@ -1416,7 +1416,7 @@ public class ImmModeSink { * vec4 v = vec4(0, 0, 0, 1); * vec4 c = vec4(0, 0, 0, 1); * </p> - * + * * @param type * @param fill */ @@ -1426,7 +1426,7 @@ public class ImmModeSink { final Buffer dest; final boolean dSigned; final int e; // either 0 or 1 - + switch (type) { case VERTEX: dest = vertexArray; @@ -1459,7 +1459,7 @@ public class ImmModeSink { while( fill > e ) { fill--; - Buffers.putNf(dest, dSigned, 0f); + Buffers.putNf(dest, dSigned, 0f); } if( fill > 0 ) { // e == 1, add missing '1f end component' Buffers.putNf(dest, dSigned, 1f); @@ -1480,18 +1480,18 @@ public class ImmModeSink { private static final int NORMAL = 2; private static final int TEXTCOORD = 3; - private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer + private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer private int vOffset, cOffset, nOffset, tOffset; // offset of specific array in common buffer private int vElems, cElems, nElems, tElems; // number of used elements in each buffer - private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4] - private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components + private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4] + private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components private final int vDataType, cDataType, nDataType, tDataType; private final boolean vDataTypeSigned, cDataTypeSigned, nDataTypeSigned, tDataTypeSigned; private final int pageSize; private Buffer vertexArray, colorArray, normalArray, textCoordArray; private GLArrayDataWrapper vArrayData, cArrayData, nArrayData, tArrayData; - private boolean sealed, sealedGL; + private boolean sealed, sealedGL; private boolean bufferEnabled, bufferWritten, bufferWrittenOnce; private boolean glslLocationSet; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 58151856f..b4a0156e9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2009 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,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 com.jogamp.opengl.util; @@ -55,22 +55,22 @@ import com.jogamp.opengl.math.geom.Frustum; * regarding the projection (P), modelview (Mv) matrix operation * which is specified in {@link GLMatrixFunc}. * <p> - * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and + * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and * {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}. * {@link Frustum} is also provided by {@link #glGetFrustum()}. * To keep these derived values synchronized after mutable Mv operations like {@link #glRotatef(float, float, float, float) glRotatef(..)} - * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}), - * users have to call {@link #update()} before using Mvi and Mvit. + * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}), + * users have to call {@link #update()} before using Mvi and Mvit. * </p> * <p> - * All matrices are provided in column-major order, - * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile. + * All matrices are provided in column-major order, + * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile. * </p> * <p> - * PMVMatrix can supplement {@link GL2ES2} applications w/ the + * PMVMatrix can supplement {@link GL2ES2} applications w/ the * lack of the described matrix functionality. * </p> - * <a name="storageDetails"><h5>Matrix storage details</h5></a> + * <a name="storageDetails"><h5>Matrix storage details</h5></a> * <p> * All matrices use a common FloatBuffer storage * and are a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced} representation of it. @@ -78,11 +78,11 @@ import com.jogamp.opengl.math.geom.Frustum; * depending how the instance if {@link #PMVMatrix(boolean) being constructed}. * </p> * <p> - * <b>Note:</b> - * <ul> + * <b>Note:</b> + * <ul> * <li>The matrix is a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced part } of a host matrix and it's start position has been {@link FloatBuffer#mark() marked}.</li> * <li>Use {@link FloatBuffer#reset() reset()} to rewind it to it's start position after relative operations, like {@link FloatBuffer#get() get()}.</li> - * <li>If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.</li> + * <li>If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.</li> * </ul> * </p> */ @@ -96,20 +96,20 @@ public class PMVMatrix implements GLMatrixFunc { public static final int MODIFIED_TEXTURE = 1 << 2; /** Bit value stating all is modified */ public static final int MODIFIED_ALL = MODIFIED_PROJECTION | MODIFIED_MODELVIEW | MODIFIED_TEXTURE ; - + /** Bit value stating a dirty {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)}. */ public static final int DIRTY_INVERSE_MODELVIEW = 1 << 0; /** Bit value stating a dirty {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}. */ - public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1; + public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1; /** Bit value stating a dirty {@link #glGetFrustum() frustum}. */ - public static final int DIRTY_FRUSTUM = 1 << 2; + public static final int DIRTY_FRUSTUM = 1 << 2; /** Bit value stating all is dirty */ public static final int DIRTY_ALL = DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM; - + /** - * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} + * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} * @return true if the given matrix-mode name is valid, otherwise false. - */ + */ public static final boolean isMatrixModeName(final int matrixModeName) { switch(matrixModeName) { case GL_MODELVIEW_MATRIX: @@ -121,9 +121,9 @@ public class PMVMatrix implements GLMatrixFunc { } /** - * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} + * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} * @return The corresponding matrix-get name, one of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX} - */ + */ public static final int matrixModeName2MatrixGetName(final int matrixModeName) { switch(matrixModeName) { case GL_MODELVIEW: @@ -138,9 +138,9 @@ public class PMVMatrix implements GLMatrixFunc { } /** - * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX} + * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX} * @return true if the given matrix-get name is valid, otherwise false. - */ + */ public static final boolean isMatrixGetName(final int matrixGetName) { switch(matrixGetName) { case GL_MATRIX_MODE: @@ -155,7 +155,7 @@ public class PMVMatrix implements GLMatrixFunc { /** * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX} * @return The corresponding matrix-mode name, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} - */ + */ public static final int matrixGetName2MatrixModeName(final int matrixGetName) { switch(matrixGetName) { case GL_MODELVIEW_MATRIX: @@ -168,18 +168,18 @@ public class PMVMatrix implements GLMatrixFunc { throw new GLException("unsupported matrixGetName: "+matrixGetName); } } - - /** + + /** * @param sb optional passed StringBuilder instance to be used * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a 4x4 matrix in column major order (OpenGL) * @return matrix string representation */ public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a) { - return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false); + return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false); } - - /** + + /** * @param sb optional passed StringBuilder instance to be used * @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter} * @param a 4x4 matrix in column major order (OpenGL) @@ -187,33 +187,33 @@ public class PMVMatrix implements GLMatrixFunc { * @return side by side representation */ public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a, FloatBuffer b) { - return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false); + return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false); } - + /** * Creates an instance of PMVMatrix {@link #PMVMatrix(boolean) PMVMatrix(boolean useBackingArray)}, - * with <code>useBackingArray = true</code>. + * with <code>useBackingArray = true</code>. */ public PMVMatrix() { this(true); } - + /** * Creates an instance of PMVMatrix. - * + * * @param useBackingArray <code>true</code> for non direct NIO Buffers with guaranteed backing array, * which allows faster access in Java computation. * <p><code>false</code> for direct NIO buffers w/o a guaranteed backing array. * In most Java implementations, direct NIO buffers have no backing array - * and hence the Java computation will be throttled down by direct IO get/put - * operations.</p> + * and hence the Java computation will be throttled down by direct IO get/put + * operations.</p> * <p>Depending on the application, ie. whether the Java computation or - * JNI invocation and hence native data transfer part is heavier, + * JNI invocation and hence native data transfer part is heavier, * this flag shall be set to <code>true</code> or <code>false</code></p>. */ public PMVMatrix(boolean useBackingArray) { this.usesBackingArray = useBackingArray; - + // I Identity // T Texture // P Projection @@ -228,24 +228,24 @@ public class PMVMatrix implements GLMatrixFunc { matrixBuffer = Buffers.newDirectByteBuffer( ( 6*16 + ProjectFloat.getRequiredFloatBufferSize() ) * Buffers.SIZEOF_FLOAT ); matrixBuffer.mark(); } - + matrixIdent = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I matrixTex = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T - matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit + matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit matrixPMvMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi matrixPMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv matrixP = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P matrixMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv matrixMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi matrixMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit - + projectFloat = new ProjectFloat(matrixBuffer, matrixBufferArray, 6*16); - + if(null != matrixBuffer) { matrixBuffer.reset(); - } + } FloatUtil.makeIdentityf(matrixIdent); - + vec3f = new float[3]; matrixMult = new float[16]; matrixTrans = new float[16]; @@ -263,7 +263,7 @@ public class PMVMatrix implements GLMatrixFunc { matrixTStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2) matrixPStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2) matrixMvStack= new FloatStack( 0, 16*16); // growSize: half GL-min size (32) - + // default values and mode glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -275,22 +275,22 @@ public class PMVMatrix implements GLMatrixFunc { dirtyBits = DIRTY_ALL; requestMask = 0; matrixMode = GL_MODELVIEW; - + mulPMV = null; frustum = null; } /** @see #PMVMatrix(boolean) */ - public final boolean usesBackingArray() { return usesBackingArray; } - + public final boolean usesBackingArray() { return usesBackingArray; } + public final void destroy() { if(null!=projectFloat) { projectFloat.destroy(); projectFloat=null; } matrixBuffer=null; - matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null; - matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null; + matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null; + matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null; vec3f = null; matrixMult = null; @@ -299,7 +299,7 @@ public class PMVMatrix implements GLMatrixFunc { matrixScale = null; matrixOrtho = null; matrixFrustum = null; - + if(null!=matrixPStack) { matrixPStack=null; } @@ -314,13 +314,13 @@ public class PMVMatrix implements GLMatrixFunc { } } - + /** Returns the current matrix-mode, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}. */ public final int glGetMatrixMode() { return matrixMode; } - /** + /** * Returns the {@link GLMatrixFunc#GL_TEXTURE_MATRIX texture matrix} (T). * <p> * See <a href="#storageDetails"> matrix storage details</a>. @@ -330,7 +330,7 @@ public class PMVMatrix implements GLMatrixFunc { return matrixTex; } - /** + /** * Returns the {@link GLMatrixFunc#GL_PROJECTION_MATRIX projection matrix} (P). * <p> * See <a href="#storageDetails"> matrix storage details</a>. @@ -340,7 +340,7 @@ public class PMVMatrix implements GLMatrixFunc { return matrixP; } - /** + /** * Returns the {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mv). * <p> * See <a href="#storageDetails"> matrix storage details</a>. @@ -350,7 +350,7 @@ public class PMVMatrix implements GLMatrixFunc { return matrixMv; } - /** + /** * Returns the inverse {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvi). * <p> * Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits. @@ -367,7 +367,7 @@ public class PMVMatrix implements GLMatrixFunc { return matrixMvi; } - /** + /** * Returns the inverse transposed {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvit). * <p> * Method enables the Mvit matrix update, and performs it's update w/o clearing the modified bits. @@ -383,9 +383,9 @@ public class PMVMatrix implements GLMatrixFunc { updateImpl(false); return matrixMvit; } - - /** - * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}. + + /** + * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}. * <p> * See <a href="#storageDetails"> matrix storage details</a>. * </p> @@ -393,9 +393,9 @@ public class PMVMatrix implements GLMatrixFunc { public final FloatBuffer glGetPMvMatrixf() { return matrixPMv; } - - /** - * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}. + + /** + * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}. * <p> * Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits. * </p> @@ -410,9 +410,9 @@ public class PMVMatrix implements GLMatrixFunc { updateImpl(false); return matrixPMvMvi; } - - /** - * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}. + + /** + * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}. * <p> * Method enables the Mvi and Mvit matrix update, and performs it's update w/o clearing the modified bits. * </p> @@ -427,14 +427,14 @@ public class PMVMatrix implements GLMatrixFunc { updateImpl(false); return matrixPMvMvit; } - + /** Returns the frustum, derived from projection * modelview */ public Frustum glGetFrustum() { requestMask |= DIRTY_FRUSTUM; updateImpl(false); return frustum; } - + /* * @return the matrix of the current matrix-mode */ @@ -443,7 +443,7 @@ public class PMVMatrix implements GLMatrixFunc { } /** - * @param matrixName Either a matrix-get-name, i.e. + * @param matrixName Either a matrix-get-name, i.e. * {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}, * or a matrix-mode-name, i.e. * {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE} @@ -462,10 +462,10 @@ public class PMVMatrix implements GLMatrixFunc { return matrixTex; default: throw new GLException("unsupported matrixName: "+matrixName); - } + } } - // + // // GLMatrixFunc implementation // @@ -494,7 +494,7 @@ public class PMVMatrix implements GLMatrixFunc { } params.position(pos); } - + @Override public final void glGetFloatv(int matrixGetName, float[] params, int params_offset) { if(matrixGetName==GL_MATRIX_MODE) { @@ -505,7 +505,7 @@ public class PMVMatrix implements GLMatrixFunc { matrix.reset(); } } - + @Override public final void glGetIntegerv(int pname, IntBuffer params) { int pos = params.position(); @@ -516,7 +516,7 @@ public class PMVMatrix implements GLMatrixFunc { } params.position(pos); } - + @Override public final void glGetIntegerv(int pname, int[] params, int params_offset) { if(pname==GL_MATRIX_MODE) { @@ -537,12 +537,12 @@ public class PMVMatrix implements GLMatrixFunc { matrixP.put(values, offset, 16); matrixP.reset(); dirtyBits |= DIRTY_FRUSTUM ; - modifiedBits |= MODIFIED_PROJECTION; + modifiedBits |= MODIFIED_PROJECTION; } else if(matrixMode==GL.GL_TEXTURE) { matrixTex.put(values, offset, 16); matrixTex.reset(); modifiedBits |= MODIFIED_TEXTURE; - } + } } @Override @@ -557,12 +557,12 @@ public class PMVMatrix implements GLMatrixFunc { matrixP.put(m); matrixP.reset(); dirtyBits |= DIRTY_FRUSTUM ; - modifiedBits |= MODIFIED_PROJECTION; + modifiedBits |= MODIFIED_PROJECTION; } else if(matrixMode==GL.GL_TEXTURE) { matrixTex.put(m); matrixTex.reset(); modifiedBits |= MODIFIED_TEXTURE; - } + } m.position(spos); } @@ -584,9 +584,9 @@ public class PMVMatrix implements GLMatrixFunc { @Override public final void glPushMatrix() { - if(matrixMode==GL_MODELVIEW) { + if(matrixMode==GL_MODELVIEW) { matrixMvStack.putOnTop(matrixMv, 16); - matrixMv.reset(); + matrixMv.reset(); } else if(matrixMode==GL_PROJECTION) { matrixPStack.putOnTop(matrixP, 16); matrixP.reset(); @@ -612,8 +612,8 @@ public class PMVMatrix implements GLMatrixFunc { matrixTex.put(matrixIdent); matrixTex.reset(); modifiedBits |= MODIFIED_TEXTURE; - } - matrixIdent.reset(); + } + matrixIdent.reset(); } @Override @@ -629,7 +629,7 @@ public class PMVMatrix implements GLMatrixFunc { } else if(matrixMode==GL.GL_TEXTURE) { FloatUtil.multMatrixf(matrixTex, m); modifiedBits |= MODIFIED_TEXTURE; - } + } } @Override @@ -645,12 +645,12 @@ public class PMVMatrix implements GLMatrixFunc { } else if(matrixMode==GL.GL_TEXTURE) { FloatUtil.multMatrixf(matrixTex, m, m_offset); modifiedBits |= MODIFIED_TEXTURE; - } + } } @Override public final void glTranslatef(final float x, final float y, final float z) { - // Translation matrix: + // Translation matrix: // 1 0 0 x // 0 1 0 y // 0 0 1 z @@ -665,7 +665,7 @@ public class PMVMatrix implements GLMatrixFunc { public final void glRotatef(final float angdeg, float x, float y, float z) { final float angrad = angdeg * (float) Math.PI / 180.0f; final float c = (float)Math.cos(angrad); - final float ic= 1.0f - c; + final float ic= 1.0f - c; final float s = (float)Math.sin(angrad); vec3f[0]=x; vec3f[1]=y; vec3f[2]=z; @@ -700,7 +700,7 @@ public class PMVMatrix implements GLMatrixFunc { @Override public final void glScalef(final float x, final float y, final float z) { - // Scale matrix: + // Scale matrix: // x 0 0 0 // 0 y 0 0 // 0 0 z 0 @@ -714,7 +714,7 @@ public class PMVMatrix implements GLMatrixFunc { @Override public final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) { - // Ortho matrix: + // Ortho matrix: // 2/dx 0 0 tx // 0 2/dy 0 ty // 0 0 2/dz tz @@ -744,7 +744,7 @@ public class PMVMatrix implements GLMatrixFunc { if(left==right || top==bottom) { throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal"); } - // Frustum matrix: + // Frustum matrix: // 2*zNear/dx 0 A 0 // 0 2*zNear/dy B 0 // 0 0 C D @@ -774,7 +774,7 @@ public class PMVMatrix implements GLMatrixFunc { // // Extra functionality // - + /** * {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix} with the perspective/frustum matrix. */ @@ -787,7 +787,7 @@ public class PMVMatrix implements GLMatrixFunc { } /** - * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix} + * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix} * with the eye, object and orientation. */ public final void gluLookAt(float eyex, float eyey, float eyez, @@ -798,7 +798,7 @@ public class PMVMatrix implements GLMatrixFunc { /** * Map object coordinates to window coordinates. - * + * * @param objx * @param objy * @param objz @@ -815,20 +815,20 @@ public class PMVMatrix implements GLMatrixFunc { return projectFloat.gluProject(objx, objy, objz, matrixMv.array(), matrixMv.position(), matrixP.array(), matrixP.position(), - viewport, viewport_offset, + viewport, viewport_offset, win_pos, win_pos_offset); } else { return projectFloat.gluProject(objx, objy, objz, matrixMv, matrixP, - viewport, viewport_offset, + viewport, viewport_offset, win_pos, win_pos_offset); } } /** * Map window coordinates to object coordinates. - * + * * @param winx * @param winy * @param winz @@ -845,23 +845,23 @@ public class PMVMatrix implements GLMatrixFunc { return projectFloat.gluUnProject(winx, winy, winz, matrixMv.array(), matrixMv.position(), matrixP.array(), matrixP.position(), - viewport, viewport_offset, + viewport, viewport_offset, obj_pos, obj_pos_offset); } else { return projectFloat.gluUnProject(winx, winy, winz, matrixMv, matrixP, - viewport, viewport_offset, + viewport, viewport_offset, obj_pos, obj_pos_offset); - } + } } - + public final void gluPickMatrix(float x, float y, float deltaX, float deltaY, int[] viewport, int viewport_offset) { projectFloat.gluPickMatrix(this, x, y, deltaX, deltaY, viewport, viewport_offset); } - + public StringBuilder toString(StringBuilder sb, String f) { if(null == sb) { sb = new StringBuilder(); @@ -874,8 +874,8 @@ public class PMVMatrix implements GLMatrixFunc { final boolean frustumReq = 0 != (DIRTY_FRUSTUM & requestMask); final boolean modP = 0 != ( MODIFIED_PROJECTION & modifiedBits ); final boolean modMv = 0 != ( MODIFIED_MODELVIEW & modifiedBits ); - final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits ); - + final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits ); + sb.append("PMVMatrix[backingArray ").append(this.usesBackingArray()); sb.append(", modified[P ").append(modP).append(", Mv ").append(modMv).append(", T ").append(modT); sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq); @@ -887,28 +887,28 @@ public class PMVMatrix implements GLMatrixFunc { matrixToString(sb, f, matrixTex); if( 0 != ( requestMask & DIRTY_INVERSE_MODELVIEW ) ) { sb.append(", Inverse Modelview").append(Platform.NEWLINE); - matrixToString(sb, f, matrixMvi); + matrixToString(sb, f, matrixMvi); } if( 0 != ( requestMask & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) { sb.append(", Inverse Transposed Modelview").append(Platform.NEWLINE); - matrixToString(sb, f, matrixMvit); + matrixToString(sb, f, matrixMvit); } sb.append("]"); return sb; } - + public String toString() { return toString(null, "%10.5f").toString(); } - /** + /** * Returns the modified bits due to mutable operations.. * <p> * A modified bit is set, if the corresponding matrix had been modified by a mutable operation * since last {@link #update()} or {@link #getModifiedBits(boolean) getModifiedBits(true)} call. * </p> * @param clear if true, clears the modified bits, otherwise leaves them untouched. - * + * * @see #MODIFIED_PROJECTION * @see #MODIFIED_MODELVIEW * @see #MODIFIED_TEXTURE @@ -920,16 +920,16 @@ public class PMVMatrix implements GLMatrixFunc { } return r; } - - /** + + /** * Returns the dirty bits due to mutable operations. * <p> * A dirty bit is set , if the corresponding matrix had been modified by a mutable operation * since last {@link #update()} call. The latter clears the dirty state only if the dirty matrix (Mvi or Mvit) or {@link Frustum} - * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} + * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} * or {@link #glGetFrustum() Frustum get} methods. * </p> - * + * * @deprecated Function is exposed for debugging purposes only. * @see #DIRTY_INVERSE_MODELVIEW * @see #DIRTY_INVERSE_TRANSPOSED_MODELVIEW @@ -944,12 +944,12 @@ public class PMVMatrix implements GLMatrixFunc { return dirtyBits; } - /** + /** * Returns the request bit mask, which uses bit values equal to the dirty mask. * <p> - * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} + * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} * or {@link #glGetFrustum() Frustum get} methods. - * </p> + * </p> * * @deprecated Function is exposed for debugging purposes only. * @see #clearAllUpdateRequests() @@ -965,16 +965,16 @@ public class PMVMatrix implements GLMatrixFunc { public final int getRequestMask() { return requestMask; } - - + + /** * Clears all {@link #update()} requests of the Mvi and Mvit matrix and Frustum - * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} + * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} * or {@link #glGetFrustum() Frustum get} methods. * <p> * Allows user to disable subsequent Mvi, Mvit and {@link Frustum} updates if no more required. - * </p> - * + * </p> + * * @see #glGetMviMatrixf() * @see #glGetMvitMatrixf() * @see #glGetPMvMviMatrixf() @@ -983,14 +983,14 @@ public class PMVMatrix implements GLMatrixFunc { * @see #getRequestMask() */ public final void clearAllUpdateRequests() { - requestMask &= ~DIRTY_ALL; + requestMask &= ~DIRTY_ALL; } - + /** * Update the derived {@link #glGetMviMatrixf() inverse modelview (Mvi)}, - * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum} - * <b>if</b> they are dirty <b>and</b> they were requested - * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} + * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum} + * <b>if</b> they are dirty <b>and</b> they were requested + * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} * or {@link #glGetFrustum() Frustum get} methods. * <p> * The Mvi and Mvit matrices and {@link Frustum} are considered dirty, if their corresponding @@ -999,7 +999,7 @@ public class PMVMatrix implements GLMatrixFunc { * <p> * Method should be called manually in case mutable operations has been called * and caller operates on already fetched references, i.e. not calling - * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} + * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get} * or {@link #glGetFrustum() Frustum get} etc anymore. * </p> * <p> @@ -1007,12 +1007,12 @@ public class PMVMatrix implements GLMatrixFunc { * which are set by any mutable operation. The modified bits have no impact * on this method, but the return value. * </p> - * - * @return true if any matrix has been modified since last update call or + * + * @return true if any matrix has been modified since last update call or * if the derived matrices Mvi and Mvit or {@link Frustum} were updated, otherwise false. * In other words, method returns true if any matrix used by the caller must be updated, * e.g. uniforms in a shader program. - * + * * @see #getModifiedBits(boolean) * @see #MODIFIED_PROJECTION * @see #MODIFIED_MODELVIEW @@ -1035,7 +1035,7 @@ public class PMVMatrix implements GLMatrixFunc { if(clearModBits) { modifiedBits = 0; } - + if( 0 != ( dirtyBits & ( DIRTY_FRUSTUM & requestMask ) ) ) { if( null == frustum ) { frustum = new Frustum(); @@ -1046,7 +1046,7 @@ public class PMVMatrix implements GLMatrixFunc { dirtyBits &= ~DIRTY_FRUSTUM; mod = true; } - + if( 0 == ( dirtyBits & requestMask ) ) { return mod; // nothing more requested which may have been dirty } @@ -1061,9 +1061,9 @@ public class PMVMatrix implements GLMatrixFunc { } return setMviMvitNIODirectAccess() || mod; } - + // - // private + // private // private int nioBackupArraySupported = 0; // -1 not supported, 0 - TBD, 1 - supported private final String msgCantComputeInverse = "Invalid source Mv matrix, can't compute inverse"; @@ -1080,7 +1080,7 @@ public class PMVMatrix implements GLMatrixFunc { res = true; } if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty - // transpose matrix + // transpose matrix final float[] _matrixMvit = matrixMvit.array(); final int _matrixMvitOffset = matrixMvit.position(); for (int i = 0; i < 4; i++) { @@ -1093,7 +1093,7 @@ public class PMVMatrix implements GLMatrixFunc { } return res; } - + private final boolean setMviMvitNIODirectAccess() { boolean res = false; if( 0 != ( dirtyBits & DIRTY_INVERSE_MODELVIEW ) ) { // only if dirt; always requested at this point, see update() @@ -1104,7 +1104,7 @@ public class PMVMatrix implements GLMatrixFunc { res = true; } if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty - // transpose matrix + // transpose matrix for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { matrixMvit.put(j+i*4, matrixMvi.get(i+j*4)); diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index a2b7ba343..b00866dd9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.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. @@ -35,14 +35,14 @@ import javax.media.opengl.GLException; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; /** - * Variation of {@link TileRenderer} w/o using fixed tiles but arbitrary rectangular regions. + * Variation of {@link TileRenderer} w/o using fixed tiles but arbitrary rectangular regions. * <p> * See {@link TileRendererBase} for details. * </p> */ public class RandomTileRenderer extends TileRendererBase { private boolean tileRectSet = false; - + /** * Creates a new TileRenderer object */ @@ -72,15 +72,15 @@ public class RandomTileRenderer extends TileRendererBase { /** * Set the tile rectangle for the subsequent rendering calls. - * - * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0 + * + * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0 */ public void setTileRect(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException, IllegalArgumentException { if( 0 > tX || 0 > tX ) { - throw new IllegalArgumentException("Tile pos must be >= 0/0"); + throw new IllegalArgumentException("Tile pos must be >= 0/0"); } if( 0 >= tWidth || 0 >= tHeight ) { - throw new IllegalArgumentException("Tile size must be > 0x0"); + throw new IllegalArgumentException("Tile size must be > 0x0"); } this.currentTileXPos = tX; this.currentTileYPos = tY; @@ -88,57 +88,57 @@ public class RandomTileRenderer extends TileRendererBase { this.currentTileHeight = tHeight; tileRectSet = true; } - + @Override public final boolean isSetup() { return 0 < imageSize.getWidth() && 0 < imageSize.getHeight() && tileRectSet; } - + /** * {@inheritDoc} - * - * <p> + * + * <p> * <i>end of tiling</i> is never reached w/ {@link RandomRileRenderer}, * i.e. method always returns false. * </p> */ @Override public final boolean eot() { return false; } - + /** * {@inheritDoc} - * + * * Reset internal states of {@link RandomTileRenderer} are: <i>none</i>. */ @Override public final void reset() { } - + /** * {@inheritDoc} - * - * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or + * + * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or * {@link #setTileRect(int, int, int, int) tile-rect} has not been set. */ @Override public final void beginTile(GL gl) throws IllegalStateException, GLException { if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) { - throw new IllegalStateException("Image size has not been set"); + throw new IllegalStateException("Image size has not been set"); } if( !tileRectSet ) { throw new IllegalStateException("tileRect has not been set"); } validateGL(gl); - + gl.glViewport( 0, 0, currentTileWidth, currentTileHeight ); - + if( DEBUG ) { System.err.println("TileRenderer.begin.X: "+this.toString()); } - + // Do not forget to issue: // reshape( 0, 0, tW, tH ); // which shall reflect tile renderer fileds: currentTileXPos, currentTileYPos and imageSize - + beginCalled = true; } @@ -148,7 +148,7 @@ public class RandomTileRenderer extends TileRendererBase { throw new IllegalStateException("beginTile(..) has not been called"); } validateGL(gl); - + // be sure OpenGL rendering is finished gl.glFlush(); @@ -220,13 +220,13 @@ public class RandomTileRenderer extends TileRendererBase { /* restore previous glPixelStore values */ psm.restore(gl); - + beginCalled = false; } - + /** * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}. - * + * * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java index b949f0e39..47d56bcb1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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,7 +28,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. @@ -46,7 +46,7 @@ import java.nio.channels.*; * class; can also be used in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer} class. */ public class TGAWriter { - + private static final int TARGA_HEADER_SIZE = 18; private FileChannel ch; @@ -91,7 +91,7 @@ public class TGAWriter { image.put(14, (byte) (height & 0xFF)); // height image.put(15, (byte) (height >> 8)); // height image.put(16, (byte) pixelSize); // pixel size - + // go to image data position image.position(TARGA_HEADER_SIZE); // jogl needs a sliced buffer diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 999db77a9..7f86b14c6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.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,18 +20,18 @@ * 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. - * + * * --------------------- - * + * * Based on Brian Paul's tile rendering library, found * at <a href = "http://www.mesa3d.org/brianp/TR.html">http://www.mesa3d.org/brianp/TR.html</a>. - * - * Copyright (C) 1997-2005 Brian Paul. - * Licensed under BSD-compatible terms with permission of the author. + * + * Copyright (C) 1997-2005 Brian Paul. + * Licensed under BSD-compatible terms with permission of the author. * See LICENSE.txt for license information. */ package com.jogamp.opengl.util; @@ -60,7 +60,7 @@ import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; * <p> * See {@link TileRendererBase} for details. * </p> - * + * * @author ryanm, sgothel */ public class TileRenderer extends TileRendererBase { @@ -150,7 +150,7 @@ public class TileRenderer extends TileRendererBase { .append("rowOrder "+rowOrder+", offset/size "+offsetX+"/"+offsetY+" "+tileSize.getWidth()+"x"+tileSize.getHeight()+" brd "+tileBorder+", "); return super.tileDetails(sb); } - + /** * Creates a new TileRenderer object */ @@ -169,7 +169,7 @@ public class TileRenderer extends TileRendererBase { super.setImageSize(width, height); reset(); } - + /** * Clips the image-size this tile-renderer iterates through, * which can be retrieved via {@link #getClippedImageSize()}. @@ -179,7 +179,7 @@ public class TileRenderer extends TileRendererBase { * <p> * Implementation {@link #reset()} internal states. * </p> - * + * * @param width The image-clipping.width * @param height The image-clipping.height * @see #getClippedImageSize() @@ -208,7 +208,7 @@ public class TileRenderer extends TileRendererBase { * {@link #TR_IMAGE_CLIPPING_HEIGHT}. * </p> */ - public final DimensionImmutable getClippedImageSize() { + public final DimensionImmutable getClippedImageSize() { if( null != imageClippingDim ) { return new Dimension(Math.min(imageClippingDim.getWidth(), imageSize.getWidth()), Math.min(imageClippingDim.getHeight(), imageSize.getHeight()) ); @@ -224,7 +224,7 @@ public class TileRenderer extends TileRendererBase { * <p> * Implementation {@link #reset()} internal states. * </p> - * + * * @param width * The width of the tiles. Must not be larger than the GL * context @@ -238,10 +238,10 @@ public class TileRenderer extends TileRendererBase { */ public final void setTileSize(int width, int height, int border) { if( 0 > border ) { - throw new IllegalArgumentException("Tile border must be >= 0"); + throw new IllegalArgumentException("Tile border must be >= 0"); } if( 2 * border >= width || 2 * border >= height ) { - throw new IllegalArgumentException("Tile size must be > 0x0 minus 2*border"); + throw new IllegalArgumentException("Tile size must be > 0x0 minus 2*border"); } tileBorder = border; tileSize.set( width, height ); @@ -249,7 +249,7 @@ public class TileRenderer extends TileRendererBase { reset(); } - /** + /** * Sets an xy offset for the resulting tiles * {@link TileRendererBase#TR_CURRENT_TILE_X_POS x-pos} and {@link TileRendererBase#TR_CURRENT_TILE_Y_POS y-pos}. * @see #TR_TILE_X_OFFSET @@ -259,12 +259,12 @@ public class TileRenderer extends TileRendererBase { offsetX = xoff; offsetY = yoff; } - + /** * {@inheritDoc} - * + * * Reset internal states of {@link TileRenderer} are: - * <ul> + * <ul> * <li>{@link #TR_ROWS}</li> * <li>{@link #TR_COLUMNS}</li> * <li>{@link #TR_CURRENT_COLUMN}</li> @@ -291,13 +291,13 @@ public class TileRenderer extends TileRendererBase { assert columns >= 0; assert rows >= 0; - + beginCalled = false; isInit = true; } /* pp */ final int getCurrentTile() { return currentTile; } - + @Override public final int getParam(int pname) { switch (pname) { @@ -346,7 +346,7 @@ public class TileRenderer extends TileRendererBase { /** * Sets the order of row traversal, default is {@link #TR_BOTTOM_TO_TOP}. - * + * * @param order The row traversal order, must be either {@link #TR_TOP_TO_BOTTOM} or {@link #TR_BOTTOM_TO_TOP}. */ public final void setRowOrder(int order) { @@ -361,11 +361,11 @@ public class TileRenderer extends TileRendererBase { public final boolean isSetup() { return 0 < imageSize.getWidth() && 0 < imageSize.getHeight(); } - + /** * {@inheritDoc} - * - * <p> + * + * <p> * <i>end of tiling</i> is reached w/ {@link TileRenderer}, if at least one of the following is true: * <ul> * <li>all tiles have been rendered, i.e. {@link #TR_CURRENT_TILE_NUM} is -1</li> @@ -378,13 +378,13 @@ public class TileRenderer extends TileRendererBase { if ( !isInit ) { // ensure at least one reset-call reset(); } - return 0 > currentTile || 0 >= columns*rows; + return 0 > currentTile || 0 >= columns*rows; } - + /** * {@inheritDoc} - * - * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or + * + * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or * {@link #eot() end-of-tiling} has been reached. */ @Override @@ -396,7 +396,7 @@ public class TileRenderer extends TileRendererBase { throw new IllegalStateException("EOT reached: "+this); } validateGL(gl); - + /* which tile (by row and column) we're about to render */ if (rowOrder == TR_BOTTOM_TO_TOP) { currentRow = currentTile / columns; @@ -434,11 +434,11 @@ public class TileRenderer extends TileRendererBase { currentTileHeight = tH; gl.glViewport( 0, 0, tW, tH ); - + if( DEBUG ) { System.err.println("TileRenderer.begin: "+this.toString()); } - + // Do not forget to issue: // reshape( 0, 0, tW, tH ); // which shall reflect tile renderer tiles: currentTileXPos, currentTileYPos and imageSize @@ -454,7 +454,7 @@ public class TileRenderer extends TileRendererBase { // be sure OpenGL rendering is finished gl.glFlush(); - + // save current glPixelStore values psm.save(gl); psm.setPackAlignment(gl, 1); @@ -467,13 +467,13 @@ public class TileRenderer extends TileRendererBase { } else { gl2es3 = null; readBuffer = 0; // undef. probably default: GL_FRONT (single buffering) GL_BACK (double buffering) - } + } if( DEBUG ) { System.err.println("TileRenderer.end.0: readBuffer 0x"+Integer.toHexString(readBuffer)+", "+this.toString()); } - + final int tmp[] = new int[1]; - + if( tileBuffer != null ) { final GLPixelAttributes pixelAttribs = tileBuffer.pixelAttributes; final int srcX = tileBorder; @@ -527,7 +527,7 @@ public class TileRenderer extends TileRendererBase { psm.restore(gl); beginCalled = false; - + /* increment tile counter, return 1 if more tiles left to render */ currentTile++; if( currentTile >= rows * columns ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java index 0553d5673..ff7cc5516 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.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,18 +20,18 @@ * 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. - * + * * --------------------- - * + * * Based on Brian Paul's tile rendering library, found * at <a href = "http://www.mesa3d.org/brianp/TR.html">http://www.mesa3d.org/brianp/TR.html</a>. - * - * Copyright (C) 1997-2005 Brian Paul. - * Licensed under BSD-compatible terms with permission of the author. + * + * Copyright (C) 1997-2005 Brian Paul. + * Licensed under BSD-compatible terms with permission of the author. * See LICENSE.txt for license information. */ package com.jogamp.opengl.util; @@ -66,17 +66,17 @@ import jogamp.opengl.Debug; * The PMV matrix needs to be reshaped in user code * after calling {@link #beginTile(GL)}, See {@link #beginTile(GL)}. * </p> - * <p> + * <p> * If {@link #attachAutoDrawable(GLAutoDrawable) attaching to} an {@link GLAutoDrawable}, * the {@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int)} method * is being called after {@link #beginTile(GL)} for each rendered tile. - * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}. + * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}. * </p> * <a name="glprequirement"><h5>GL Profile Requirement</h5></a> * <p> - * Note that {@link #setImageBuffer(GLPixelBuffer) image buffer} can only be used + * Note that {@link #setImageBuffer(GLPixelBuffer) image buffer} can only be used * in conjunction w/ a {@link GL} instance ≥ {@link GL2ES3} passed to {@link #beginTile(GL)} and {@link #endTile(GL)}.<br> - * This is due to setting up the {@link GL2ES3#GL_PACK_ROW_LENGTH pack row length} + * This is due to setting up the {@link GL2ES3#GL_PACK_ROW_LENGTH pack row length} * for an {@link #setImageSize(int, int) image width} != tile-width, which usually is the case.<br> * Hence a {@link GLException} is thrown in both methods, * if using an {@link #setImageBuffer(GLPixelBuffer) image buffer} @@ -86,7 +86,7 @@ import jogamp.opengl.Debug; * Further more, reading back of MSAA buffers is only supported since {@link GL2ES3} * since it requires to set the {@link GL2ES3#glReadBuffer(int) read-buffer}. * </p> - * + * * @author ryanm, sgothel */ public abstract class TileRendererBase { @@ -114,16 +114,16 @@ public abstract class TileRendererBase { * The height of the current tile. See {@link #getParam(int)}. */ public static final int TR_CURRENT_TILE_HEIGHT = 6; - + /* pp */ static final boolean DEBUG = Debug.debug("TileRenderer"); - - /** + + /** * Listener for tile renderer events, intended to extend {@link GLEventListener} implementations, * enabling tile rendering via {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable)}. */ public static interface TileRendererListener { - /** - * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached} + /** + * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached} * to the given {@link TileRendererBase} instance. * <p> * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable} @@ -133,9 +133,9 @@ public abstract class TileRendererBase { * @see TileRendererBase#getAttachedDrawable() */ public void addTileRendererNotify(TileRendererBase tr); - - /** - * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached} + + /** + * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached} * from the given {@link TileRendererBase} instance. * <p> * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable} @@ -145,10 +145,10 @@ public abstract class TileRendererBase { * @see TileRendererBase#getAttachedDrawable() */ public void removeTileRendererNotify(TileRendererBase tr); - - /** + + /** * Called by the {@link TileRendererBase} during tile-rendering via an - * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s + * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s * {@link GLAutoDrawable#display()} call for each tile before {@link #display(GLAutoDrawable)}. * <p> * The <a href="#pmvmatrix">PMV Matrix</a> shall be reshaped @@ -175,14 +175,14 @@ public abstract class TileRendererBase { * @see TileRendererBase#getAttachedDrawable() */ public void reshapeTile(TileRendererBase tr, - int tileX, int tileY, int tileWidth, int tileHeight, + int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight); /** - * Called by the {@link TileRendererBase} during tile-rendering + * Called by the {@link TileRendererBase} during tile-rendering * after {@link TileRendererBase#beginTile(GL)} and before {@link #reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(..)}. * <p> - * If {@link TileRendererBase} is of type {@link TileRenderer}, + * If {@link TileRendererBase} is of type {@link TileRenderer}, * method is called for the first tile of all tiles.<br> * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile. * </p> @@ -193,12 +193,12 @@ public abstract class TileRendererBase { * @param tr the issuing {@link TileRendererBase} */ public void startTileRendering(TileRendererBase tr); - + /** * Called by the {@link TileRenderer} during tile-rendering * after {@link TileRendererBase#endTile(GL)} and {@link GLAutoDrawable#swapBuffers()}. * <p> - * If {@link TileRendererBase} is of type {@link TileRenderer}, + * If {@link TileRendererBase} is of type {@link TileRenderer}, * method is called for the last tile of all tiles.<br> * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile. * </p> @@ -210,7 +210,7 @@ public abstract class TileRendererBase { */ public void endTileRendering(TileRendererBase tr); } - + protected final Dimension imageSize = new Dimension(0, 0); protected final GLPixelStorageModes psm = new GLPixelStorageModes(); protected GLPixelBuffer imageBuffer; @@ -249,24 +249,24 @@ public abstract class TileRendererBase { return getClass().getSimpleName()+ "["+toString(sb).toString()+"]"; } - + protected TileRendererBase() { } /** * Gets the parameters of this TileRenderer object - * + * * @param pname The parameter name that is to be retrieved * @return the value of the parameter * @throws IllegalArgumentException if <code>pname</code> is not handled */ public abstract int getParam(int pname) throws IllegalArgumentException; - + /** * Specify a buffer the tiles to be copied to. This is not * necessary for the creation of the final image, but useful if you * want to inspect each tile in turn. - * + * * @param buffer The buffer itself. Must be large enough to contain a random tile */ public final void setTileBuffer(GLPixelBuffer buffer) { @@ -281,7 +281,7 @@ public abstract class TileRendererBase { /** * Sets the desired size of the final image - * + * * @param width The width of the final image * @param height The height of the final image */ @@ -294,7 +294,7 @@ public abstract class TileRendererBase { /** * Sets the buffer in which to store the final image - * + * * @param buffer the buffer itself, must be large enough to hold the final image */ public final void setImageBuffer(GLPixelBuffer buffer) { @@ -310,16 +310,16 @@ public abstract class TileRendererBase { /* pp */ final void validateGL(GL gl) throws GLException { if( imageBuffer != null && !gl.isGL2ES3()) { throw new GLException("Using image-buffer w/ inssufficient GL context: "+gl.getContext().getGLVersion()+", "+gl.getGLProfile()); - } + } } - - /** + + /** * Returns true if this instance is setup properly, i.e. {@link #setImageSize(int, int)} .., * and ready for {@link #beginTile(GL)}. * Otherwise returns false. */ public abstract boolean isSetup(); - + /** * Returns true if <i>end of tiling</i> has been reached, otherwise false. * <p> @@ -331,7 +331,7 @@ public abstract class TileRendererBase { * </p> */ public abstract boolean eot(); - + /** * Method resets implementation's internal state to <i>start of tiling</i> * as required for {@link #beginTile(GL)} if {@link #eot() end of tiling} has been reached. @@ -340,7 +340,7 @@ public abstract class TileRendererBase { * </p> */ public abstract void reset(); - + /** * Begins rendering a tile. * <p> @@ -367,7 +367,7 @@ public abstract class TileRendererBase { * </p> * <p> * Use shall render the scene afterwards, concluded with a call to - * this renderer {@link #endTile(GL)}. + * this renderer {@link #endTile(GL)}. * </p> * <p> * User has to comply with the <a href="#glprequirement">GL profile requirement</a>. @@ -376,10 +376,10 @@ public abstract class TileRendererBase { * If {@link #eot() end of tiling} has been reached, * user needs to {@link #reset()} tiling before calling this method. * </p> - * + * * @param gl The gl context * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} is undefined, - * an {@link #isSetup() implementation related setup} has not be performed + * an {@link #isSetup() implementation related setup} has not be performed * or {@ link #eot()} has been reached. See implementing classes. * @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but <code>gl</code> instance is < {@link GL2ES3} * @see #isSetup() @@ -387,7 +387,7 @@ public abstract class TileRendererBase { * @see #reset() */ public abstract void beginTile(GL gl) throws IllegalStateException, GLException; - + /** * Must be called after rendering the scene, * see {@link #beginTile(GL)}. @@ -399,13 +399,13 @@ public abstract class TileRendererBase { * <p> * User has to comply with the <a href="#glprequirement">GL profile requirement</a>. * </p> - * + * * @param gl the gl context * @throws IllegalStateException if beginTile(gl) has not been called * @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but <code>gl</code> instance is < {@link GL2ES3} */ public abstract void endTile( GL gl ) throws IllegalStateException, GLException; - + /** * Determines whether the chosen {@link GLCapabilitiesImmutable} * requires a <i>pre-{@link GLDrawable#swapBuffers() swap-buffers}</i> @@ -417,18 +417,18 @@ public abstract class TileRendererBase { * Here {@link GLDrawable#swapBuffers() swap-buffers} shall happen <b>after</b> calling {@link #endTile(GL)}, the default. * </p> * <p> - * However, <i>multisampling</i> offscreen {@link GLFBODrawable}s + * However, <i>multisampling</i> offscreen {@link GLFBODrawable}s * utilize {@link GLDrawable#swapBuffers() swap-buffers} to <i>downsample</i> * the multisamples into the readable sampling sink. - * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> calling {@link #endTile(GL)}. - * </p> - * @param chosenCaps the chosen {@link GLCapabilitiesImmutable} + * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> calling {@link #endTile(GL)}. + * </p> + * @param chosenCaps the chosen {@link GLCapabilitiesImmutable} * @return chosenCaps.isFBO() && chosenCaps.getSampleBuffers() */ public final boolean reqPreSwapBuffers(GLCapabilitiesImmutable chosenCaps) { return chosenCaps.isFBO() && chosenCaps.getSampleBuffers(); } - + /** * Attaches the given {@link GLAutoDrawable} to this tile renderer. * <p> @@ -440,17 +440,17 @@ public abstract class TileRendererBase { * <p> * The {@link GLAutoDrawable}'s {@link GLAutoDrawable#getAutoSwapBufferMode() auto-swap mode} is cached * and set to <code>false</code>, since {@link GLAutoDrawable#swapBuffers() swapBuffers()} maybe issued before {@link #endTile(GL)}, - * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}. + * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}. * </p> * <p> - * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable} + * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable} * to handle the tile rendering, replacing the original {@link GLEventListener}.<br> * It's {@link GLEventListener#display(GLAutoDrawable) display} implementations issues: * <ul> * <li>Optional {@link #setGLEventListener(GLEventListener, GLEventListener) pre-glel}.{@link GLEventListener#display(GLAutoDrawable) display(..)}</li> * <li>{@link #beginTile(GL)}</li> * <li>for all original {@link TileRendererListener}: - * <ul> + * <ul> * <li>{@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight)}</li> * <li>{@link GLEventListener#display(GLAutoDrawable) display(autoDrawable)}</li> * </ul></li> @@ -468,7 +468,7 @@ public abstract class TileRendererBase { * since it's called after {@link #endTile(GL)}. * </p> * <p> - * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer + * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer * and to restore it's original {@link GLEventListener}. * </p> * @param glad the {@link GLAutoDrawable} to attach. @@ -481,7 +481,7 @@ public abstract class TileRendererBase { throw new IllegalStateException("GLAutoDrawable already attached"); } this.glad = glad; - + final int aSz = glad.getGLEventListenerCount(); listeners = new GLEventListener[aSz]; listenersInit = new boolean[aSz]; @@ -510,11 +510,11 @@ public abstract class TileRendererBase { } } - /** - * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable}, + /** + * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable}, * <code>null</code> if none is attached. * <p> - * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)} + * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)} * or {@link TileRendererListener#removeTileRendererNotify(TileRendererBase)}, method returns the * just attached or soon to be detached {@link GLAutoDrawable}. * </p> @@ -522,9 +522,9 @@ public abstract class TileRendererBase { * @see #detachAutoDrawable() */ public final GLAutoDrawable getAttachedDrawable() { - return glad; + return glad; } - + /** * Detaches the given {@link GLAutoDrawable} from this tile renderer. * @see #attachAutoDrawable(GLAutoDrawable) @@ -547,16 +547,16 @@ public abstract class TileRendererBase { System.err.println("TileRenderer: detached: "+glad); System.err.println("TileRenderer: "+glad.getChosenGLCapabilities()); } - + listeners = null; listenersInit = null; glad = null; } } - + /** * Set {@link GLEventListener} for pre- and post operations when used w/ - * {@link #attachAutoDrawable(GLAutoDrawable)} + * {@link #attachAutoDrawable(GLAutoDrawable)} * for each {@link GLEventListener} callback. * @param preTile the pre operations * @param postTile the post operations @@ -565,10 +565,10 @@ public abstract class TileRendererBase { glEventListenerPre = preTile; glEventListenerPost = postTile; } - + /** * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}. - * + * * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ @@ -578,10 +578,10 @@ public abstract class TileRendererBase { } glad.display(); } - + private final GLEventListener tiledGLEL = new GLEventListener() { final TileRenderer tileRenderer = TileRendererBase.this instanceof TileRenderer ? (TileRenderer) TileRendererBase.this : null; - + @Override public void init(GLAutoDrawable drawable) { if( null != glEventListenerPre ) { @@ -642,13 +642,13 @@ public abstract class TileRendererBase { if( null == tileRenderer || 0 == tileRenderer.getCurrentTile() ) { tl.startTileRendering(TileRendererBase.this); } - tl.reshapeTile(TileRendererBase.this, + tl.reshapeTile(TileRendererBase.this, currentTileXPos, currentTileYPos, currentTileWidth, currentTileHeight, imageSize.getWidth(), imageSize.getHeight()); l.display(drawable); } } - + if( gladRequiresPreSwap ) { glad.swapBuffers(); endTile(gl); @@ -662,7 +662,7 @@ public abstract class TileRendererBase { if( l instanceof TileRendererListener ) { ((TileRendererListener)l).endTileRendering(TileRendererBase.this); } - } + } } if( null != glEventListenerPost ) { glEventListenerPost.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight); diff --git a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java index e2bca010c..45f5d2694 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.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,51 +20,51 @@ * 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 com.jogamp.opengl.util; -/** +/** * Integer time frame in milliseconds, maybe specialized for texture/video, audio, .. animated content. * <p> * Type and value range has been chosen to suit embedded CPUs * and characteristics of audio / video streaming and animations. - * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE} + * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE} * will allow tracking time up 2,147,483.647 seconds or * 24 days 20 hours 31 minutes and 23 seconds. * </p> * <p> * Milliseconds granularity is also more than enough to deal with A-V synchronization, * where the threshold usually lies within 22ms. - * </p> + * </p> * <p> * Milliseconds granularity for displaying video frames might seem inaccurate * for each single frame, i.e. 60Hz != 16ms, however, accumulated values diminish - * this error and vertical sync is achieved by build-in V-Sync of the video drivers. + * this error and vertical sync is achieved by build-in V-Sync of the video drivers. * </p> */ public class TimeFrameI { /** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE == 0x80000000 == {@value}. Sync w/ native code. */ public static final int INVALID_PTS = 0x80000000; - + /** Constant marking the end of the stream PTS, i.e. Integer.MIN_VALUE - 1 == 0x7FFFFFFF == {@value}. Sync w/ native code. */ - public static final int END_OF_STREAM_PTS = 0x7FFFFFFF; + public static final int END_OF_STREAM_PTS = 0x7FFFFFFF; protected int pts; protected int duration; - + public TimeFrameI() { pts = INVALID_PTS; - duration = 0; + duration = 0; } public TimeFrameI(int pts, int duration) { this.pts = pts; - this.duration = duration; + this.duration = duration; } - + /** Get this frame's presentation timestamp (PTS) in milliseconds. */ public final int getPTS() { return pts; } /** Set this frame's presentation timestamp (PTS) in milliseconds. */ @@ -73,7 +73,7 @@ public class TimeFrameI { public final int getDuration() { return duration; } /** Set this frame's duration in milliseconds. */ public final void setDuration(int duration) { this.duration = duration; } - + public String toString() { return "TimeFrame[pts " + pts + " ms, l " + duration + " ms]"; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java index 8751fc816..dffdfae8e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.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. @@ -35,10 +35,10 @@ import jogamp.opengl.Debug; public interface AudioSink { public static final boolean DEBUG = Debug.debug("AudioSink"); - + /** Default frame duration in millisecond, i.e. 1 frame per {@value} ms. */ public static final int DefaultFrameDuration = 32; - + /** Initial audio queue size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/ public static final int DefaultInitialQueueSize = 16 * 32; // 512 ms /** Audio queue grow size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/ @@ -47,7 +47,7 @@ public interface AudioSink { public static final int DefaultQueueLimitWithVideo = 96 * 32; // 3072 ms /** Audio queue limit w/o video in milliseconds. {@value} ms, i.e. 32 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/ public static final int DefaultQueueLimitAudioOnly = 32 * 32; // 1024 ms - + /** * Specifies the linear audio PCM format. */ @@ -78,7 +78,7 @@ public interface AudioSink { } } } - + /** Sample rate in Hz (1/s). */ public final int sampleRate; /** Sample size in bits. */ @@ -91,36 +91,36 @@ public interface AudioSink { /** Planar or packed samples. If planar, each channel has their own data buffer. If packed, channel data is interleaved in one buffer. */ public final boolean planar; public final boolean littleEndian; - - + + // // Time <-> Bytes // - - /** - * Returns the byte size of the given milliseconds + + /** + * Returns the byte size of the given milliseconds * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}. * <p> * Time -> Byte Count - * </p> + * </p> */ public final int getDurationsByteSize(int millisecs) { final int bytesPerSample = sampleSize >>> 3; // /8 return millisecs * ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } - - /** - * Returns the duration in milliseconds of the given byte count - * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}. + + /** + * Returns the duration in milliseconds of the given byte count + * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}. * <p> * Byte Count -> Time - * </p> + * </p> */ public final int getBytesDuration(int byteCount) { final int bytesPerSample = sampleSize >>> 3; // /8 - return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); + return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } - + /** * Returns the duration in milliseconds of the given sample count per frame and channel * according to the {@link #sampleRate}, i.e. @@ -129,13 +129,13 @@ public interface AudioSink { * </pre> * <p> * Sample Count -> Time - * </p> + * </p> * @param sampleCount sample count per frame and channel */ public final float getSamplesDuration(int sampleCount) { return ( 1000f * (float) sampleCount ) / (float)sampleRate; } - + /** * Returns the rounded frame count of the given milliseconds and frame duration. * <pre> @@ -147,36 +147,36 @@ public interface AudioSink { * </p> * <p> * Frame Time -> Frame Count - * </p> + * </p> * @param millisecs time in milliseconds * @param frameDuration duration per frame in milliseconds. */ public final int getFrameCount(int millisecs, float frameDuration) { return Math.max(1, (int) ( (float)millisecs / frameDuration + 0.5f )); } - + /** * Returns the byte size of given sample count - * according to the {@link #sampleSize}, i.e.: + * according to the {@link #sampleSize}, i.e.: * <pre> * sampleCount * ( sampleSize / 8 ) * </pre> * <p> - * Note: To retrieve the byte size for all channels, + * Note: To retrieve the byte size for all channels, * you need to pre-multiply <code>sampleCount</code> with {@link #channelCount}. * </p> * <p> * Sample Count -> Byte Count - * </p> + * </p> * @param sampleCount sample count */ public final int getSamplesByteCount(int sampleCount) { return sampleCount * ( sampleSize >>> 3 ); } - + /** * Returns the sample count of given byte count - * according to the {@link #sampleSize}, i.e.: + * according to the {@link #sampleSize}, i.e.: * <pre> * ( byteCount * 8 ) / sampleSize * </pre> @@ -186,24 +186,24 @@ public interface AudioSink { * </p> * <p> * Byte Count -> Sample Count - * </p> + * </p> * @param sampleCount sample count */ public final int getBytesSampleCount(int byteCount) { return ( byteCount << 3 ) / sampleSize; } - - public String toString() { + + public String toString() { return "AudioDataFormat[sampleRate "+sampleRate+", sampleSize "+sampleSize+", channelCount "+channelCount+ ", signed "+signed+", fixedP "+fixedP+", "+(planar?"planar":"packed")+", "+(littleEndian?"little":"big")+"-endian]"; } } - /** Default {@link AudioFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, fixedP, !planar, littleEndian]. */ - public static final AudioFormat DefaultFormat = new AudioFormat(44100, 16, 2, true /* signed */, + /** Default {@link AudioFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, fixedP, !planar, littleEndian]. */ + public static final AudioFormat DefaultFormat = new AudioFormat(44100, 16, 2, true /* signed */, true /* fixed point */, false /* planar */, true /* littleEndian */); - + public static abstract class AudioFrame extends TimeFrameI { protected int byteSize; - + public AudioFrame() { this.byteSize = 0; } @@ -211,19 +211,19 @@ public interface AudioSink { super(pts, duration); this.byteSize=byteCount; } - + /** Get this frame's size in bytes. */ public final int getByteSize() { return byteSize; } /** Set this frame's size in bytes. */ public final void setByteSize(int size) { this.byteSize=size; } - - public String toString() { + + public String toString() { return "AudioFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes]"; } } public static class AudioDataFrame extends AudioFrame { protected final ByteBuffer data; - + public AudioDataFrame(int pts, int duration, ByteBuffer bytes, int byteCount) { super(pts, duration, byteCount); if( byteCount > bytes.remaining() ) { @@ -231,62 +231,62 @@ public interface AudioSink { } this.data=bytes; } - + /** Get this frame's data. */ public final ByteBuffer getData() { return data; } - - public String toString() { + + public String toString() { return "AudioDataFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes, " + data + "]"; } } - - /** + + /** * Returns the <code>initialized state</code> of this instance. * <p> * The <code>initialized state</code> is affected by this instance * overall availability, i.e. after instantiation, * as well as by {@link #destroy()}. - * </p> + * </p> */ public boolean isInitialized(); /** Returns the playback speed. */ public float getPlaySpeed(); - - /** + + /** * Sets the playback speed. * <p> * To simplify test, play speed is <i>normalized</i>, i.e. - * <ul> - * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> + * <ul> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> * </ul> * </p> - * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setPlaySpeed(float s); - + /** Returns the volume. */ public float getVolume(); - - /** + + /** * Sets the volume [0f..1f]. * <p> * To simplify test, volume is <i>normalized</i>, i.e. - * <ul> - * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> - * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> + * <ul> + * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> * </ul> * </p> - * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setVolume(float v); - - /** + + /** * Returns the preferred {@link AudioFormat} by this sink. * <p> - * The preferred format is guaranteed to be supported + * The preferred format is guaranteed to be supported * and shall reflect this sinks most native format, - * i.e. best performance w/o data conversion. + * i.e. best performance w/o data conversion. * </p> * <p> * Known {@link #AudioFormat} attributes considered by implementations: @@ -295,20 +295,20 @@ public interface AudioSink { * </ul> * </p> * @see #initSink(AudioFormat) - * @see #isSupported(AudioFormat) + * @see #isSupported(AudioFormat) */ public AudioFormat getPreferredFormat(); - + /** Return the maximum number of supported channels. */ public int getMaxSupportedChannels(); - + /** * Returns true if the given format is supported by the sink, otherwise false. * @see #initSink(AudioFormat) - * @see #getPreferredFormat() + * @see #getPreferredFormat() */ public boolean isSupported(AudioFormat format); - + /** * Initializes the sink. * <p> @@ -319,7 +319,7 @@ public interface AudioSink { * beforehand and try to find a suitable supported one. * {@link #getPreferredFormat()} and {@link #getMaxSupportedChannels()} may help. * </p> - * @param requestedFormat the requested {@link AudioFormat}. + * @param requestedFormat the requested {@link AudioFormat}. * @param frameDuration average or fixed frame duration in milliseconds * helping a caching {@link AudioFrame} based implementation to determine the frame count in the queue. * See {@link #DefaultFrameDuration}. @@ -328,31 +328,31 @@ public interface AudioSink { * @param queueLimit maximum time in milliseconds the queue can hold (and grow), see {@link #DefaultQueueLimitWithVideo} and {@link #DefaultQueueLimitAudioOnly}. * @return true if successful, otherwise false */ - public boolean init(AudioFormat requestedFormat, float frameDuration, + public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit); - + /** * Returns true, if {@link #play()} has been requested <i>and</i> the sink is still playing, * otherwise false. */ public boolean isPlaying(); - - /** + + /** * Play buffers queued via {@link #enqueueData(AudioFrame)} from current internal position. * If no buffers are yet queued or the queue runs empty, playback is being continued when buffers are enqueued later on. * @see #enqueueData(AudioFrame) - * @see #pause() + * @see #pause() */ public void play(); - - /** + + /** * Pause playing buffers while keeping enqueued data incl. it's internal position. * @see #play() * @see #flush() * @see #enqueueData(AudioFrame) */ public void pause(); - + /** * Flush all queued buffers, implies {@link #pause()}. * <p> @@ -363,28 +363,28 @@ public interface AudioSink { * @see #enqueueData(AudioFrame) */ public void flush(); - + /** Destroys this instance, i.e. closes all streams and devices allocated. */ public void destroy(); - - /** - * Returns the number of allocated buffers as requested by + + /** + * Returns the number of allocated buffers as requested by * {@link #init(AudioFormat, float, int, int, int)}. */ public int getFrameCount(); /** @return the current enqueued frames count since {@link #init(AudioFormat, float, int, int, int)}. */ public int getEnqueuedFrameCount(); - - /** + + /** * Returns the current number of frames queued for playing. * <p> * {@link #init(AudioFormat, float, int, int, int)} must be called first. * </p> */ public int getQueuedFrameCount(); - - /** + + /** * Returns the current number of bytes queued for playing. * <p> * {@link #init(AudioFormat, float, int, int, int)} must be called first. @@ -392,28 +392,28 @@ public interface AudioSink { */ public int getQueuedByteCount(); - /** + /** * Returns the current queued frame time in milliseconds for playing. * <p> * {@link #init(AudioFormat, float, int, int, int)} must be called first. * </p> */ public int getQueuedTime(); - - /** + + /** * Return the current audio presentation timestamp (PTS) in milliseconds. */ public int getPTS(); - - /** + + /** * Returns the current number of frames in the sink available for writing. * <p> * {@link #init(AudioFormat, float, int, int, int)} must be called first. * </p> */ public int getFreeFrameCount(); - - /** + + /** * Enqueue the remaining bytes of the given {@link AudioDataFrame}'s direct ByteBuffer to this sink. * <p> * The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}. @@ -426,8 +426,8 @@ public interface AudioSink { * to reuse specialized {@link AudioFrame} instances. */ public AudioFrame enqueueData(AudioDataFrame audioDataFrame); - - /** + + /** * Enqueue <code>byteCount</code> bytes of the remaining bytes of the given NIO {@link ByteBuffer} to this sink. * <p> * The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}. diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java index a6a14f7dd..2cfd40df7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.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. @@ -58,7 +58,7 @@ public class AudioSinkFactory { if( audioSink.isInitialized() ) { return audioSink; } - } catch (Throwable t) { + } catch (Throwable t) { if(AudioSink.DEBUG) { System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 74036a3f7..db6f5fdee 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.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. @@ -49,9 +49,9 @@ import com.jogamp.opengl.util.TimeFrameI; * using the appropriate <a href="#streamIDs">stream id</a>'s. * </p> * <p> - * Camera input can be selected using the {@link #CameraInputScheme} URI. + * Camera input can be selected using the {@link #CameraInputScheme} URI. * </p> - * + * * <a name="streamworker"><h5><i>StreamWorker</i> Decoding Thread</h5></a> * <p> * Most of the stream processing is performed on the decoding thread, a.k.a. <i>StreamWorker</i>: @@ -61,7 +61,7 @@ import com.jogamp.opengl.util.TimeFrameI; * <li>Caught <a href="#streamerror">exceptions on the decoding thread</a> are delivered as {@link StreamException}s.</li> * </ul> * <i>StreamWorker</i> generates it's own {@link GLContext}, shared with the one passed to {@link #initGL(GL)}. - * The shared {@link GLContext} allows the decoding thread to push the video frame data directly into + * The shared {@link GLContext} allows the decoding thread to push the video frame data directly into * the designated {@link TextureFrame}, later returned via {@link #getNextTexture(GL)} and used by the user. * </p> * <a name="streamerror"><h7><i>StreamWorker</i> Error Handling</h7></a> @@ -71,12 +71,12 @@ import com.jogamp.opengl.util.TimeFrameI; * </p> * <p> * An occurring {@link StreamException} triggers a {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} event, - * which can be listened to via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long)}. + * which can be listened to via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long)}. * </p> * <p> - * An occurred {@link StreamException} can be read via {@link #getStreamException()}. + * An occurred {@link StreamException} can be read via {@link #getStreamException()}. * </p> - * + * * </p> * <a name="lifecycle"><h5>GLMediaPlayer Lifecycle</h5></a> * <p> @@ -94,7 +94,7 @@ import com.jogamp.opengl.util.TimeFrameI; * <tr><td>{@link #destroy(GL)}</td> <td>ANY</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT}</td></tr> * </table> * </p> - * + * * <a name="streamIDs"><h5>Audio and video Stream IDs</h5></a> * <p> * <table border="1"> @@ -110,7 +110,7 @@ import com.jogamp.opengl.util.TimeFrameI; * <li>{@link jogamp.opengl.util.av.NullGLMediaPlayer}</li> * <li>{@link jogamp.opengl.util.av.impl.OMXGLMediaPlayer}</li> * <li>{@link jogamp.opengl.util.av.impl.FFMPEGMediaPlayer}</li> - * <li>{@link jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14}</li> + * <li>{@link jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14}</li> * </ul> * </p> * <p> @@ -127,7 +127,7 @@ import com.jogamp.opengl.util.TimeFrameI; * Timestamp type and value range has been chosen to suit embedded CPUs * and characteristics of audio and video streaming. See {@link TimeFrameI}. * </p> - * + * * <a name="synchronization"><h5>Audio and video synchronization</h5></a> * <p> * The class follows a passive A/V synchronization pattern. @@ -158,7 +158,7 @@ import com.jogamp.opengl.util.TimeFrameI; * <li>Film: +22ms and -22ms. audio ahead video / audio after video.</li> * </ul> * </p> - * + * * <a name="teststreams"><h5>Test Streams</h5></a> * <p> * <table border="1"> @@ -185,16 +185,16 @@ import com.jogamp.opengl.util.TimeFrameI; public interface GLMediaPlayer extends TextureSequence { public static final boolean DEBUG = Debug.debug("GLMediaPlayer"); public static final boolean DEBUG_NATIVE = Debug.debug("GLMediaPlayer.Native"); - + /** Minimum texture count, value {@value}. */ public static final int TEXTURE_COUNT_MIN = 4; - + /** Constant {@value} for <i>mute</i> or <i>not available</i>. See <a href="#streamIDs">Audio and video Stream IDs</a>. */ public static final int STREAM_ID_NONE = -2; /** Constant {@value} for <i>auto</i> or <i>unspecified</i>. See <a href="#streamIDs">Audio and video Stream IDs</a>. */ public static final int STREAM_ID_AUTO = -1; - - /** + + /** * {@link URI#getScheme() URI scheme} name {@value} for camera input. E.g. <code>camera:/0</code> * for the 1st camera device. * <p> @@ -203,7 +203,7 @@ public interface GLMediaPlayer extends TextureSequence { * </p> * <p> * The <i>ID</i> is usually an integer value indexing the camera - * ranging from [0..<i>max-number</i>]. + * ranging from [0..<i>max-number</i>]. * </p> * <p> * The {@link URI#getRawQuery() URI query} is used to pass options to the camera @@ -220,7 +220,7 @@ public interface GLMediaPlayer extends TextureSequence { * w/ authority: [user-info@]host[:port] * Note: 'path' starts w/ fwd slash * </pre> - * </p> + * </p> */ public static final String CameraInputScheme = "camera"; /** Camera property {@value}, size as string, e.g. <code>1280x720</code>, <code>hd720</code>. May not be supported on all platforms. See {@link #CameraInputScheme}. */ @@ -231,10 +231,10 @@ public interface GLMediaPlayer extends TextureSequence { public static final String CameraPropHeight = "height"; /** Camera property {@value}. See {@link #CameraInputScheme}. */ public static final String CameraPropRate = "rate"; - + /** Maximum video frame async of {@value} milliseconds. */ public static final int MAXIMUM_VIDEO_ASYNC = 22; - + /** * A StreamException encapsulates a caught exception in the decoder thread, a.k.a <i>StreamWorker</i>, * see See <a href="#streamerror"><i>StreamWorker</i> Error Handling</a>. @@ -248,15 +248,15 @@ public interface GLMediaPlayer extends TextureSequence { super(message, cause); } } - + /** * {@inheritDoc} * <p> * See {@link TexSeqEventListener} for semantics and usage. * </p> - */ + */ public interface GLMediaEventListener extends TexSeqEventListener<GLMediaPlayer> { - + /** State changed to {@link State#Initialized}. See <a href="#lifecycle">Lifecycle</a>.*/ static final int EVENT_CHANGE_INIT = 1<<0; /** State changed to {@link State#Uninitialized}. See <a href="#lifecycle">Lifecycle</a>.*/ @@ -269,7 +269,7 @@ public interface GLMediaPlayer extends TextureSequence { static final int EVENT_CHANGE_EOS = 1<<4; /** An error occurred, e.g. during off-thread initialization. See {@link StreamException} and <a href="#lifecycle">Lifecycle</a>. */ static final int EVENT_CHANGE_ERR = 1<<5; - + /** Stream video id change. */ static final int EVENT_CHANGE_VID = 1<<16; /** Stream audio id change. */ @@ -284,55 +284,55 @@ public interface GLMediaPlayer extends TextureSequence { static final int EVENT_CHANGE_LENGTH = 1<<21; /** Stream codec change. */ static final int EVENT_CHANGE_CODEC = 1<<22; - + /** - * @param mp the event source + * @param mp the event source * @param event_mask the changes attributes - * @param when system time in msec. + * @param when system time in msec. */ - public void attributesChanged(GLMediaPlayer mp, int event_mask, long when); + public void attributesChanged(GLMediaPlayer mp, int event_mask, long when); } - + /** * See <a href="#lifecycle">Lifecycle</a>. */ public enum State { /** Uninitialized player, no resources shall be hold. */ Uninitialized(0), - /** Stream has been initialized, user may play or call {@link #initGL(GL)}. */ - Initialized(1), + /** Stream has been initialized, user may play or call {@link #initGL(GL)}. */ + Initialized(1), /** Stream is playing. */ Playing(2), /** Stream is pausing. */ Paused(3); - + public final int id; State(int id){ this.id = id; } } - + public int getTextureCount(); - + /** Returns the texture target used by implementation. */ public int getTextureTarget(); /** Sets the texture unit. Defaults to 0. */ public void setTextureUnit(int u); - + /** Sets the texture min-mag filter, defaults to {@link GL#GL_NEAREST}. */ public void setTextureMinMagFilter(int[] minMagFilter); /** Sets the texture min-mag filter, defaults to {@link GL#GL_CLAMP_TO_EDGE}. */ public void setTextureWrapST(int[] wrapST); - - /** + + /** * Issues asynchronous stream initialization. * <p> * <a href="#lifecycle">Lifecycle</a>: {@link State#Uninitialized} -> {@link State#Initialized}<sup><a href="#streamworker">1</a></sup> or {@link State#Uninitialized} * </p> * <p> - * {@link State#Initialized} is reached asynchronous, + * {@link State#Initialized} is reached asynchronous, * i.e. user gets notified via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long) attributesChanges(..)}. * </p> * <p> @@ -344,7 +344,7 @@ public interface GLMediaPlayer extends TextureSequence { * </p> * <p> * Muted video can be achieved by passing {@link #STREAM_ID_NONE} to <code>vid</code>, - * in which case <code>textureCount</code> is ignored as well as the passed GL object of the subsequent {@link #initGL(GL)} call. + * in which case <code>textureCount</code> is ignored as well as the passed GL object of the subsequent {@link #initGL(GL)} call. * </p> * @param streamLoc the stream location * @param vid video stream id, see <a href="#streamIDs">audio and video Stream IDs</a> @@ -352,41 +352,41 @@ public interface GLMediaPlayer extends TextureSequence { * @param textureCount desired number of buffered textures to be decoded off-thread, will be validated by implementation. * The minimum value is {@link #TEXTURE_COUNT_MIN}. * Ignored if video is muted. - * @throws IllegalStateException if not invoked in {@link State#Uninitialized} + * @throws IllegalStateException if not invoked in {@link State#Uninitialized} * @throws IllegalArgumentException if arguments are invalid */ public void initStream(URI streamLoc, int vid, int aid, int textureCount) throws IllegalStateException, IllegalArgumentException; - + /** * Returns the {@link StreamException} caught in the decoder thread, or <code>null</code>. * @see GLMediaEventListener#EVENT_CHANGE_ERR * @see StreamException */ public StreamException getStreamException(); - - /** + + /** * Initializes OpenGL related resources. * <p> * <a href="#lifecycle">Lifecycle</a>: {@link State#Initialized} -> {@link State#Paused} or {@link State#Initialized} * </p> * Argument <code>gl</code> is ignored if video is muted, see {@link #initStream(URI, int, int, int)}. - * + * * @param gl current GL object. Maybe <code>null</code>, for audio only. - * @throws IllegalStateException if not invoked in {@link State#Initialized}. + * @throws IllegalStateException if not invoked in {@link State#Initialized}. * @throws StreamException forwarded from the off-thread stream initialization * @throws GLException in case of difficulties to initialize the GL resources */ public void initGL(GL gl) throws IllegalStateException, StreamException, GLException; - - /** + + /** * If implementation uses a {@link AudioSink}, it's instance will be returned. - * <p> - * The {@link AudioSink} instance is available after {@link #initStream(URI, int, int, int)}, + * <p> + * The {@link AudioSink} instance is available after {@link #initStream(URI, int, int, int)}, * if used by implementation. - * </p> + * </p> */ public AudioSink getAudioSink(); - + /** * Releases the GL and stream resources. * <p> @@ -399,11 +399,11 @@ public interface GLMediaPlayer extends TextureSequence { * Sets the playback speed. * <p> * To simplify test, play speed is <i>normalized</i>, i.e. - * <ul> - * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> + * <ul> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> * </ul> * </p> - * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setPlaySpeed(float rate); @@ -414,18 +414,18 @@ public interface GLMediaPlayer extends TextureSequence { * Sets the audio volume, [0f..1f]. * <p> * To simplify test, volume is <i>normalized</i>, i.e. - * <ul> - * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> - * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> + * <ul> + * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> * </ul> * </p> - * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setAudioVolume(float v); - + /** Returns the audio volume. */ public float getAudioVolume(); - + /** * Starts or resumes the <i>StreamWorker</i> decoding thread. * <p> @@ -441,9 +441,9 @@ public interface GLMediaPlayer extends TextureSequence { * </p> * <p> * If a <i>new</i> frame is desired after the next {@link #play()} call, - * e.g. to make a snapshot of a camera input stream, + * e.g. to make a snapshot of a camera input stream, * <code>flush</code> shall be set to <code>true</code>. - * </p> + * </p> * @param flush if <code>true</code> flushes the video and audio buffers, otherwise keep them intact. */ public State pause(boolean flush); @@ -454,10 +454,10 @@ public interface GLMediaPlayer extends TextureSequence { * <p> * Allowed in state {@link State#Playing} and {@link State#Paused}, otherwise ignored, * see <a href="#lifecycle">Lifecycle</a>. - * </p> - * - * @param msec absolute desired time position in milliseconds - * @return time current position in milliseconds, after seeking to the desired position + * </p> + * + * @param msec absolute desired time position in milliseconds + * @return time current position in milliseconds, after seeking to the desired position **/ public int seek(int msec); @@ -466,39 +466,39 @@ public interface GLMediaPlayer extends TextureSequence { * @return the current state, either {@link State#Uninitialized}, {@link State#Initialized}, {@link State#Playing} or {@link State#Paused} */ public State getState(); - + /** * Return the video stream id, see <a href="#streamIDs">audio and video Stream IDs</a>. */ public int getVID(); - + /** * Return the audio stream id, see <a href="#streamIDs">audio and video Stream IDs</a>. */ public int getAID(); - + /** - * @return the current decoded frame count since {@link #play()} and {@link #seek(int)} + * @return the current decoded frame count since {@link #play()} and {@link #seek(int)} * as increased by {@link #getNextTexture(GL)} or the decoding thread. */ public int getDecodedFrameCount(); - + /** - * @return the current presented frame count since {@link #play()} and {@link #seek(int)} + * @return the current presented frame count since {@link #play()} and {@link #seek(int)} * as increased by {@link #getNextTexture(GL)} for new frames. */ public int getPresentedFrameCount(); - + /** - * @return current video presentation timestamp (PTS) in milliseconds of {@link #getLastTexture()} + * @return current video presentation timestamp (PTS) in milliseconds of {@link #getLastTexture()} **/ public int getVideoPTS(); - + /** - * @return current audio presentation timestamp (PTS) in milliseconds. + * @return current audio presentation timestamp (PTS) in milliseconds. **/ public int getAudioPTS(); - + /** * {@inheritDoc} * <p> @@ -511,7 +511,7 @@ public interface GLMediaPlayer extends TextureSequence { /** * {@inheritDoc} - * + * * <p> * In case the current state is not {@link State#Playing}, {@link #getLastTexture()} is returned. * </p> @@ -519,25 +519,25 @@ public interface GLMediaPlayer extends TextureSequence { * See <a href="#synchronization">audio and video synchronization</a>. * </p> * @throws IllegalStateException if not invoked in {@link State#Paused} or {@link State#Playing} - * + * * @see #addEventListener(GLMediaEventListener) * @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, TextureFrame, long) */ @Override public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException; - + /** Return the stream location, as set by {@link #initStream(URI, int, int, int)}. */ public URI getURI(); /** * <i>Warning:</i> Optional information, may not be supported by implementation. - * @return the code of the video stream, if available + * @return the code of the video stream, if available */ public String getVideoCodec(); /** * <i>Warning:</i> Optional information, may not be supported by implementation. - * @return the code of the audio stream, if available + * @return the code of the audio stream, if available */ public String getAudioCodec(); @@ -557,25 +557,25 @@ public interface GLMediaPlayer extends TextureSequence { * @return total duration of stream in msec. */ public int getDuration(); - + /** * <i>Warning:</i> Optional information, may not be supported by implementation. - * @return the overall bitrate of the stream. + * @return the overall bitrate of the stream. */ public long getStreamBitrate(); /** * <i>Warning:</i> Optional information, may not be supported by implementation. - * @return video bitrate + * @return video bitrate */ public int getVideoBitrate(); - + /** * <i>Warning:</i> Optional information, may not be supported by implementation. - * @return the audio bitrate + * @return the audio bitrate */ public int getAudioBitrate(); - + /** * <i>Warning:</i> Optional information, may not be supported by implementation. * @return the framerate of the video @@ -583,10 +583,10 @@ public interface GLMediaPlayer extends TextureSequence { public float getFramerate(); /** - * Returns <code>true</code> if the video frame is oriented in + * Returns <code>true</code> if the video frame is oriented in * OpenGL's coordinate system, <i>origin at bottom left</i>. * <p> - * Otherwise returns <code>false</code>, i.e. + * Otherwise returns <code>false</code>, i.e. * video frame is oriented <i>origin at top left</i>. * </p> * <p> @@ -594,14 +594,14 @@ public interface GLMediaPlayer extends TextureSequence { * but user shall not rely on. * </p> * <p> - * <code>false</code> GL orientation leads to + * <code>false</code> GL orientation leads to * {@link Texture#getMustFlipVertically()} == <code>true</code>, * as reflected by all {@link TextureFrame}'s {@link Texture}s - * retrieved via {@link #getLastTexture()} or {@link #getNextTexture(GL)}. + * retrieved via {@link #getLastTexture()} or {@link #getNextTexture(GL)}. * </p> */ public boolean isGLOriented(); - + /** Returns the width of the video. */ public int getWidth(); @@ -613,7 +613,7 @@ public interface GLMediaPlayer extends TextureSequence { /** Returns a string represantation of this player's performance values. */ public String getPerfString(); - + /** Adds a {@link GLMediaEventListener} to this player. */ public void addEventListener(GLMediaEventListener l); diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java index c7e1ab5e6..248e265f5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.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. @@ -36,7 +36,7 @@ public class GLMediaPlayerFactory { private static final String FFMPEGMediaPlayerClazzName = "jogamp.opengl.util.av.impl.FFMPEGMediaPlayer"; private static final String OMXGLMediaPlayerClazzName = "jogamp.opengl.util.av.impl.OMXGLMediaPlayer"; private static final String isAvailableMethodName = "isAvailable"; - + public static GLMediaPlayer createDefault() { final ClassLoader cl = GLMediaPlayerFactory.class.getClassLoader(); GLMediaPlayer sink = create(cl, OMXGLMediaPlayerClazzName); @@ -54,7 +54,7 @@ public class GLMediaPlayerFactory { public static GLMediaPlayer createNull() { return new NullGLMediaPlayer(); } - + public static GLMediaPlayer create(final ClassLoader cl, String implName) { try { if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java index 9d2ef6572..fb2bdbbcb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.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,22 +41,22 @@ import javax.media.opengl.GL; import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLPixelBuffer; -/** - * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type +/** + * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type * {@link BufferedImage#TYPE_INT_ARGB} or {@link BufferedImage#TYPE_INT_RGB}. * <p> * Implementation uses an array backed {@link IntBuffer}. * </p> * <p> - * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s - * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}. + * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s + * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}. * </p> * <p> * See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)} for {@link #allowRowStride} details. * </p> * <p> * If using <code>allowRowStride == true</code>, user may needs to get the {@link #getAlignedImage(int, int) aligned image} - * since {@link #requiresNewBuffer(GL, int, int, int)} will allow different width in this case. + * since {@link #requiresNewBuffer(GL, int, int, int)} will allow different width in this case. * </p> */ public class AWTGLPixelBuffer extends GLPixelBuffer { @@ -65,9 +65,9 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { /** The underlying {@link BufferedImage}. */ public final BufferedImage image; - + /** - * + * * @param pixelAttributes the desired {@link GLPixelAttributes} * @param width in pixels * @param height in pixels @@ -76,26 +76,26 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @param image the AWT image * @param buffer the backing array * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. - * If <code>true</code>, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}. + * If <code>true</code>, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, + public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, Buffer buffer, boolean allowRowStride) { super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride); this.image = image; } - + @Override public void dispose() { image.flush(); super.dispose(); } - + /** * Returns a width- and height-aligned image representation sharing data w/ {@link #image}. * @param width * @param height * @return - * @throws IllegalArgumentException if requested size exceeds image size + * @throws IllegalArgumentException if requested size exceeds image size */ public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException { if( width * height > image.getWidth() * image.getHeight() ) { @@ -111,12 +111,12 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { final WritableRaster raster = image.getRaster(); final DataBuffer dataBuffer = raster.getDataBuffer(); final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster.getSampleModel(); - final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), + final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), width, height, width /* scanLineStride */, sppsm0.getBitMasks()); final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null); return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null); } - + public StringBuilder toString(StringBuilder sb) { sb = super.toString(sb); sb.append(", allowRowStride ").append(allowRowStride).append(", image [").append(image.getWidth()).append("x").append(image.getHeight()).append(", ").append(image.toString()).append("]"); @@ -125,29 +125,29 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { public String toString() { return "AWTGLPixelBuffer["+toString(null).toString()+"]"; } - + /** * Provider for {@link AWTGLPixelBuffer} instances. */ public static class AWTGLPixelBufferProvider implements GLPixelBufferProvider { private final boolean allowRowStride; - + /** - * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. + * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. * See {@link #getAllowRowStride()} and {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. - * If <code>true</code>, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}. + * If <code>true</code>, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}. */ public AWTGLPixelBufferProvider(boolean allowRowStride) { - this.allowRowStride = allowRowStride; + this.allowRowStride = allowRowStride; } @Override public boolean getAllowRowStride() { return allowRowStride; } - + @Override public GLPixelAttributes getAttributes(GL gl, int componentCount) { return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3; } - + /** * {@inheritDoc} * <p> @@ -162,28 +162,28 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, allowRowStride); } } - + /** * Provider for singleton {@link AWTGLPixelBuffer} instances. * <p> * Provider instance holds the last {@link AWTGLPixelBuffer} instance * {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. - * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation} + * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation} * will return same instance, if a new buffer is not {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int) required}. - * The latter is true if size are compatible, hence <code>allowRowStride</code> should be enabled, if possible. + * The latter is true if size are compatible, hence <code>allowRowStride</code> should be enabled, if possible. * </p> - */ + */ public static class SingleAWTGLPixelBufferProvider extends AWTGLPixelBufferProvider implements SingletonGLPixelBufferProvider { private AWTGLPixelBuffer singleRGBA4 = null; private AWTGLPixelBuffer singleRGB3 = null; - + /** * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ public SingleAWTGLPixelBufferProvider(boolean allowRowStride) { super(allowRowStride); } - + /** * {@inheritDoc} * <p> @@ -194,7 +194,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { if( 4 == pixelAttributes.componentCount ) { if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) { - singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); + singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); } return singleRGBA4; } else { @@ -204,33 +204,33 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { return singleRGB3; } } - + private AWTGLPixelBuffer allocateImpl(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, getAllowRowStride()); } - - /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ + + /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ public AWTGLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes) { return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3; } - - /** + + /** * Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}. * @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated. */ public AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack) { if( 4 == componentCount ) { if( null != singleRGBA4 ) { - return null; + return null; } singleRGBA4 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGBA4, width, height, depth, pack, 0); return singleRGBA4; } else { if( null != singleRGB3 ) { - return null; + return null; } singleRGB3 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGB3, width, height, depth, pack, 0); return singleRGB3; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java index e85f04092..f5d31a132 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.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,7 +42,7 @@ import com.jogamp.opengl.util.GLReadBufferUtil; public class AWTGLReadBufferUtil extends GLReadBufferUtil { /** * {@inheritDoc} - * + * * @param alpha */ public AWTGLReadBufferUtil(GLProfile glp, boolean alpha) { @@ -50,7 +50,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { } public AWTGLPixelBuffer getAWTGLPixelBuffer() { return (AWTGLPixelBuffer)this.getPixelBuffer(); } - + public BufferedImage readPixelsToBufferedImage(GL gl, boolean awtOrientation) { return readPixelsToBufferedImage(gl, 0, 0, 0, 0, awtOrientation); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java index a3139b16a..df3cc4a39 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -54,7 +54,7 @@ public class ImageUtil { WritableRaster raster = image.getRaster(); Object scanline1 = null; Object scanline2 = null; - + for (int i = 0; i < image.getHeight() / 2; i++) { scanline1 = raster.getDataElements(0, i, image.getWidth(), 1, scanline1); scanline2 = raster.getDataElements(0, image.getHeight() - i - 1, image.getWidth(), 1, scanline2); @@ -97,21 +97,21 @@ public class ImageUtil { if (thumbWidth > image.getWidth()) { throw new IllegalArgumentException("Thumbnail width must be greater than image width"); } - + if (thumbWidth == image.getWidth()) { return image; } - + float ratio = (float) image.getWidth() / (float) image.getHeight(); int width = image.getWidth(); BufferedImage thumb = image; - + do { width /= 2; if (width < thumbWidth) { width = thumbWidth; } - + BufferedImage temp = createCompatibleImage(width, (int) (width / ratio)); Graphics2D g2 = temp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, @@ -120,7 +120,7 @@ public class ImageUtil { g2.dispose(); thumb = temp; } while (width != thumbWidth); - + return thumb; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java index 73d694cd9..931f59869 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java index 2ffc27260..f686b672a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 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: - * + * * - 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. @@ -56,18 +56,18 @@ import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.util.GLPixelStorageModes; import com.jogamp.opengl.util.TGAWriter; -/** +/** * Utilities for taking screenshots of OpenGL applications. - * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil}, - * which is AWT independent and does not require a CPU based vertical image flip + * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil}, + * which is AWT independent and does not require a CPU based vertical image flip * in case drawable {@link GLDrawable#isGLOriented() is in OpenGL orientation}. - * Further more you may use {@link AWTGLReadBufferUtil} to read out + * Further more you may use {@link AWTGLReadBufferUtil} to read out * the framebuffer into a BufferedImage for further AWT processing. */ public class Screenshot { private Screenshot() {} - /** + /** * Takes a fast screenshot of the current OpenGL drawable to a Targa * file. Requires the OpenGL context for the desired drawable to be * current. Takes the screenshot from the last assigned read buffer, @@ -94,7 +94,7 @@ public class Screenshot { writeToTargaFile(file, width, height, false); } - /** + /** * Takes a fast screenshot of the current OpenGL drawable to a Targa * file. Requires the OpenGL context for the desired drawable to be * current. Takes the screenshot from the last assigned read buffer, @@ -122,7 +122,7 @@ public class Screenshot { writeToTargaFile(file, 0, 0, width, height, alpha); } - /** + /** * Takes a fast screenshot of the current OpenGL drawable to a Targa * file. Requires the OpenGL context for the desired drawable to be * current. Takes the screenshot from the last assigned read buffer, @@ -410,5 +410,5 @@ public class Screenshot { if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) { throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr"); } - } + } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index c67141525..6e504c089 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -129,7 +129,7 @@ import jogamp.opengl.Debug; */ public class TextRenderer { private static final boolean DEBUG; - + static { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.TextRenderer", true); @@ -200,10 +200,10 @@ public class TextRenderer { // Debugging purposes only private boolean debugged; Pipelined_QuadRenderer mPipelinedQuadRenderer; - + //emzic: added boolean flag private boolean useVertexArrays = true; - + //emzic: added boolean flag private boolean isExtensionAvailable_GL_VERSION_1_5; private boolean checkFor_isExtensionAvailable_GL_VERSION_1_5; @@ -707,7 +707,7 @@ public class TextRenderer { /** * emzic: here the call to glBindBuffer crashes on certain graphicscard/driver combinations * this is why the ugly try-catch block has been added, which falls back to the old textrenderer - * + * * @param ortho * @throws GLException */ @@ -891,7 +891,7 @@ public class TextRenderer { data.markUsed(); Rectangle2D origRect = data.origRect(); - + // Align the leftmost point of the baseline to the (x, y, z) coordinate requested renderer.draw3DRect(x - (scaleFactor * data.origOriginX()), y - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())), z, @@ -1715,7 +1715,7 @@ public class TextRenderer { return glyph; } } - + private static class CharacterCache { private CharacterCache() { } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java index 922fc69c1..26e1eb041 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.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. */ @@ -407,7 +407,7 @@ public class TextureRenderer { this.a = a; gl.glColor4f(this.r, this.g, this.b, this.a); - } + } private float[] compArray; /** Changes the current color of this TextureRenderer to the @@ -437,7 +437,7 @@ public class TextureRenderer { @param screenx the on-screen x coordinate at which to draw the rectangle @param screeny the on-screen y coordinate (relative to lower left) at which to draw the rectangle - + @throws GLException If an OpenGL context is not current when this method is called */ public void drawOrthoRect(int screenx, int screeny) throws GLException { @@ -459,7 +459,7 @@ public class TextureRenderer { rectangle to draw @param width the width of the rectangle to draw @param height the height of the rectangle to draw - + @throws GLException If an OpenGL context is not current when this method is called */ public void drawOrthoRect(int screenx, int screeny, @@ -490,7 +490,7 @@ public class TextureRenderer { @param height the height in texels of the rectangle to draw @param scaleFactor the scale factor to apply (multiplicatively) to the size of the drawn rectangle - + @throws GLException If an OpenGL context is not current when this method is called */ public void draw3DRect(float x, float y, float z, @@ -518,7 +518,7 @@ public class TextureRenderer { OpenGL texture to the screen, if the application intends to draw them as a flat overlay on to the screen. Must be used if {@link #beginOrthoRendering} is used to set up the rendering stage for - this overlay. + this overlay. @throws GLException If an OpenGL context is not current when this method is called */ @@ -552,7 +552,7 @@ public class TextureRenderer { private void beginRendering(boolean ortho, int width, int height, boolean disableDepthTestForOrtho) { GL2 gl = GLContext.getCurrentGL().getGL2(); - int attribBits = + int attribBits = GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL2.GL_COLOR_BUFFER_BIT | (ortho ? (GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0); gl.glPushAttrib(attribBits); @@ -622,7 +622,7 @@ public class TextureRenderer { // Infer the internal format if not an intensity texture int internalFormat = (intensity ? GL2.GL_INTENSITY : 0); - int imageType = + int imageType = (intensity ? BufferedImage.TYPE_BYTE_GRAY : (alpha ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB)); image = new BufferedImage(width, height, imageType); diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java index 34685e1b2..e8df6aaec 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class BitmapCharRec { diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java index 18f7d3b28..d4ee12b32 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class BitmapFontRec { diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java index 9ad95ec03..5e26e0d14 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class CoordRec { diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java index 010ce6699..42529f3f1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -163,7 +163,7 @@ public class GLUT { public void glutSolidCylinder(double radius, double height, int slices, int stacks) { GL2 gl = GLUgl2.getCurrentGL2(); - + // Prepare table of points for drawing end caps double [] x = new double[slices]; double [] y = new double[slices]; @@ -174,7 +174,7 @@ public class GLUT { x[i] = Math.cos(angle) * radius; y[i] = Math.sin(angle) * radius; } - + // Draw bottom cap gl.glBegin(GL2.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,-1); @@ -184,7 +184,7 @@ public class GLUT { } gl.glVertex3d(x[0], y[0], 0); gl.glEnd(); - + // Draw top cap gl.glBegin(GL2.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,1); @@ -194,7 +194,7 @@ public class GLUT { } gl.glVertex3d(x[0], y[0], height); gl.glEnd(); - + // Draw walls quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); @@ -262,7 +262,7 @@ public class GLUT { /** * Renders the teapot as a solid shape of the specified size. The teapot is * created in a way that replicates the C GLUT implementation. - * + * * @param scale * the factor by which to scale the teapot */ @@ -278,7 +278,7 @@ public class GLUT { * instead of the y=-1 plane). Both surface normals and texture coordinates * for the teapot are generated. The teapot is generated with OpenGL * evaluators. - * + * * @param scale * the factor by which to scale the teapot * @param cStyle @@ -292,14 +292,14 @@ public class GLUT { /** * Renders the teapot as a wireframe shape of the specified size. The teapot * is created in a way that replicates the C GLUT implementation. - * + * * @param scale * the factor by which to scale the teapot */ public void glutWireTeapot(double scale) { glutWireTeapot(scale, true); } - + /** * Renders the teapot as a wireframe shape of the specified size. The teapot * can either be created in a way that is backward-compatible with the @@ -308,7 +308,7 @@ public class GLUT { * plane, instead of the y=-1 plane). Both surface normals and texture * coordinates for the teapot are generated. The teapot is generated with * OpenGL evaluators. - * + * * @param scale * the factor by which to scale the teapot * @param cStyle @@ -356,7 +356,7 @@ public class GLUT { int[] skiprows = new int[1]; int[] skippixels = new int[1]; int[] alignment = new int[1]; - beginBitmap(gl, + beginBitmap(gl, swapbytes, lsbfirst, rowlength, @@ -367,7 +367,7 @@ public class GLUT { for (int i = 0; i < len; i++) { bitmapCharacterImpl(gl, font, string.charAt(i)); } - endBitmap(gl, + endBitmap(gl, swapbytes, lsbfirst, rowlength, @@ -502,7 +502,7 @@ public class GLUT { gl.glEnd( ); } } - + /** This function draws a solid-shaded dodecahedron whose facets are rhombic and @@ -522,7 +522,7 @@ public class GLUT { } gl.glEnd( ); } - + //---------------------------------------------------------------------- // Internals only below this point // @@ -879,7 +879,7 @@ public class GLUT { } /* rhombic dodecahedron data: */ - + private static final double rdod_r[][] = { { 0.0, 0.0, 1.0 }, @@ -897,7 +897,7 @@ public class GLUT { { 0.000000000000, -0.707106781187, -0.5 }, { 0.0, 0.0, -1.0 } }; - + private static final int rdod_v[][] = { { 0, 1, 5, 2 }, @@ -913,7 +913,7 @@ public class GLUT { { 7, 11, 13, 12 }, { 8, 12, 13, 9 } }; - + private static final double rdod_n[][] = { { 0.353553390594, 0.353553390594, 0.5 }, @@ -929,7 +929,7 @@ public class GLUT { { -0.353553390594, -0.353553390594, -0.5 }, { 0.353553390594, -0.353553390594, -0.5 } }; - + /* tetrahedron data: */ private static final float T = 1.73205080756887729f; @@ -1124,7 +1124,7 @@ public class GLUT { float[] r = new float[4*4*3]; float[] s = new float[4*4*3]; int i, j, k, l; - + gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_EVAL_BIT | GL2.GL_POLYGON_BIT); gl.glEnable(GL2.GL_AUTO_NORMAL); gl.glEnable(GL2.GL_NORMALIZE); @@ -1183,7 +1183,7 @@ public class GLUT { gl.glPopMatrix(); gl.glPopAttrib(); } - + private static void evaluateTeapotMesh(GL2 gl, int grid, int type, diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java index 07ded652a..c24483777 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java index 5d357f3f7..62af3b631 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java index b9c7e6e50..5f06d697e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java index bc86f6216..8326d6461 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java index 1b2e69ba4..cb11f6bec 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java index f753b56f7..17cbd0796 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java index 073e6e673..9cc2bdc3a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java index b8296924e..3587ca992 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java index 94fa1c4fd..cf51ddd3c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java index af3d538ae..515212f0e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class StrokeCharRec { diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java index d3195f24d..5335c8523 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class StrokeFontRec { diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java index 8796e8b08..b0c91c696 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -41,14 +41,14 @@ package com.jogamp.opengl.util.gl2; /* Copyright (c) Mark J. Kilgard, 1994, 1998. */ -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */ class StrokeRec { public int num_coords; public CoordRec[] coord; - + public StrokeRec(int num_coords, CoordRec[] coord) { this.num_coords = num_coords; diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index edc3d2677..68c1d0fec 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -62,7 +62,7 @@ import com.jogamp.common.util.VersionNumber; * A documented example of how to use this code is available * {@link #create(GL2ES2, int, Class, String, String, String, boolean) here} and * {@link #create(GL2ES2, int, int, Class, String, String[], String, String) here}. - * </p> + * </p> */ public class ShaderCode { public static final boolean DEBUG = Debug.debug("GLSLCode"); @@ -70,22 +70,22 @@ public class ShaderCode { /** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in source code: <code>vp</code> */ public static final String SUFFIX_VERTEX_SOURCE = "vp" ; - + /** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in binary: <code>bvp</code> */ public static final String SUFFIX_VERTEX_BINARY = "bvp" ; - + /** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in source code: <code>gp</code> */ public static final String SUFFIX_GEOMETRY_SOURCE = "gp" ; - + /** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in binary: <code>bgp</code> */ public static final String SUFFIX_GEOMETRY_BINARY = "bgp" ; - + /** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in source code: <code>fp</code> */ public static final String SUFFIX_FRAGMENT_SOURCE = "fp" ; - + /** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in binary: <code>bfp</code> */ public static final String SUFFIX_FRAGMENT_BINARY = "bfp" ; - + /** Unique relative path for binary shader resources for {@link GLES2#GL_NVIDIA_PLATFORM_BINARY_NV NVIDIA}: <code>nvidia</code> */ public static final String SUB_PATH_NVIDIA = "nvidia" ; @@ -94,7 +94,7 @@ public class ShaderCode { * @param count number of shaders * @param source CharSequence array containing the shader sources, organized as <code>source[count][strings-per-shader]</code>. * May be either an immutable <code>String</code> - or mutable <code>StringBuilder</code> array. - * + * * @throws IllegalArgumentException if <code>count</count> and <code>source.length</code> do not match */ public ShaderCode(int type, int count, CharSequence[][] source) { @@ -125,7 +125,7 @@ public class ShaderCode { /** * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} * @param count number of shaders - * @param binary binary buffer containing the shader binaries, + * @param binary binary buffer containing the shader binaries, */ public ShaderCode(int type, int count, int binFormat, Buffer binary) { switch (type) { @@ -147,19 +147,19 @@ public class ShaderCode { /** * Creates a complete {@link ShaderCode} object while reading all shader source of <code>sourceFiles</code>, * which location is resolved using the <code>context</code> class, see {@link #readShaderSource(Class, String)}. - * + * * @param gl current GL object to determine whether a shader compiler is available. If null, no validation is performed. * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} * @param count number of shaders * @param context class used to help resolving the source location * @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code> * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance - * which can be edited later on at the costs of a String conversion when passing to + * which can be edited later on at the costs of a String conversion when passing to * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}. * If <code>false</code> method returns an immutable <code>String</code> instance, * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} * at no additional costs. - * + * * @throws IllegalArgumentException if <code>count</count> and <code>sourceFiles.length</code> do not match * @see #readShaderSource(Class, String) */ @@ -192,16 +192,16 @@ public class ShaderCode { /** * Creates a complete {@link ShaderCode} object while reading the shader binary of <code>binaryFile</code>, * which location is resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}. - * + * * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} * @param count number of shaders * @param context class used to help resolving the source location * @param binFormat a valid native binary format as they can be queried by {@link ShaderUtil#getShaderBinaryFormats(GL)}. * @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code> - * + * * @see #readShaderBinary(Class, String) * @see ShaderUtil#getShaderBinaryFormats(GL) - */ + */ public static ShaderCode create(int type, int count, Class<?> context, int binFormat, String binaryFile) { ByteBuffer shaderBinary = null; if(null!=binaryFile && 0<=binFormat) { @@ -231,12 +231,12 @@ public class ShaderCode { * <li>{@link GL2ES2#GL_VERTEX_SHADER vertex}: {@link #SUFFIX_VERTEX_BINARY}</li> * <li>{@link GL2ES2#GL_FRAGMENT_SHADER fragment}: {@link #SUFFIX_FRAGMENT_BINARY}</li> * <li>{@link GL3#GL_GEOMETRY_SHADER geometry}: {@link #SUFFIX_GEOMETRY_BINARY}</li></ul></li> - * </ul> - * @param binary true for a binary resource, false for a source resource + * </ul> + * @param binary true for a binary resource, false for a source resource * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} - * + * * @throws GLException if <code>type</code> is not supported - * + * * @see #create(GL2ES2, int, Class, String, String, String, boolean) */ public static String getFileSuffix(boolean binary, int type) { @@ -252,16 +252,16 @@ public class ShaderCode { } } - /** + /** * Returns a unique relative path for binary shader resources as follows: * <ul> * <li>{@link GLES2#GL_NVIDIA_PLATFORM_BINARY_NV NVIDIA}: {@link #SUB_PATH_NVIDIA}</li> * </ul> - * + * * @throws GLException if <code>binFormat</code> is not supported - * + * * @see #create(GL2ES2, int, Class, String, String, String, boolean) - */ + */ public static String getBinarySubPath(int binFormat) { switch (binFormat) { case GLES2.GL_NVIDIA_PLATFORM_BINARY_NV: @@ -272,42 +272,42 @@ public class ShaderCode { } /** - * Convenient creation method for instantiating a complete {@link ShaderCode} object - * either from source code using {@link #create(GL2ES2, int, int, Class, String[])}, + * Convenient creation method for instantiating a complete {@link ShaderCode} object + * either from source code using {@link #create(GL2ES2, int, int, Class, String[])}, * or from a binary code using {@link #create(int, int, Class, int, String)}, * whatever is available first. * <p> - * The source and binary location names are expected w/o suffixes which are + * The source and binary location names are expected w/o suffixes which are * resolved and appended using {@link #getFileSuffix(boolean, int)}. * </p> * <p> * Additionally, the binary resource is expected within a subfolder of <code>binRoot</code> * which reflects the vendor specific binary format, see {@link #getBinarySubPath(int)}. * All {@link ShaderUtil#getShaderBinaryFormats(GL)} are being iterated - * using the binary subfolder, the first existing resource is being used. + * using the binary subfolder, the first existing resource is being used. * </p> - * + * * Example: * <pre> * Your std JVM layout (plain or within a JAR): - * + * * org/test/glsl/MyShaderTest.class * org/test/glsl/shader/vertex.vp * org/test/glsl/shader/fragment.fp * org/test/glsl/shader/bin/nvidia/vertex.bvp * org/test/glsl/shader/bin/nvidia/fragment.bfp - * + * * Your Android APK layout: - * + * * classes.dex * assets/org/test/glsl/shader/vertex.vp * assets/org/test/glsl/shader/fragment.fp * assets/org/test/glsl/shader/bin/nvidia/vertex.bvp * assets/org/test/glsl/shader/bin/nvidia/fragment.bfp * ... - * + * * Your invocation in org/test/glsl/MyShaderTest.java: - * + * * ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(), * "shader", new String[] { "vertex" }, "shader/bin", "vertex"); * ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(), @@ -318,11 +318,11 @@ public class ShaderCode { * st.attachShaderProgram(gl, sp0, true); * </pre> * A simplified entry point is {@link #create(GL2ES2, int, Class, String, String, String, boolean)}. - * + * * <p> * The location is finally being resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}. * </p> - * + * * @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used), * or to determine the shader binary format (if <code>binary</code> is used). * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} @@ -333,22 +333,22 @@ public class ShaderCode { * @param binRoot relative <i>root</i> path for <code>binBasenames</code> * @param binBasename basename w/o path or suffix relative to <code>binRoot</code> for the shader's binary code * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance - * which can be edited later on at the costs of a String conversion when passing to + * which can be edited later on at the costs of a String conversion when passing to * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}. * If <code>false</code> method returns an immutable <code>String</code> instance, * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} * at no additional costs. - * + * * @throws IllegalArgumentException if <code>count</count> and <code>srcBasenames.length</code> do not match - * + * * @see #create(GL2ES2, int, int, Class, String[]) * @see #create(int, int, Class, int, String) * @see #readShaderSource(Class, String) * @see #getFileSuffix(boolean, int) * @see ShaderUtil#getShaderBinaryFormats(GL) * @see #getBinarySubPath(int) - */ - public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context, + */ + public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context, String srcRoot, String[] srcBasenames, String binRoot, String binBasename, boolean mutableStringBuilder) { ShaderCode res = null; @@ -391,28 +391,28 @@ public class ShaderCode { /** * Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String)}. * <br> - * + * * Example: * <pre> * Your std JVM layout (plain or within a JAR): - * + * * org/test/glsl/MyShaderTest.class * org/test/glsl/shader/vertex.vp * org/test/glsl/shader/fragment.fp * org/test/glsl/shader/bin/nvidia/vertex.bvp * org/test/glsl/shader/bin/nvidia/fragment.bfp - * + * * Your Android APK layout: - * + * * classes.dex * assets/org/test/glsl/shader/vertex.vp * assets/org/test/glsl/shader/fragment.fp * assets/org/test/glsl/shader/bin/nvidia/vertex.bvp * assets/org/test/glsl/shader/bin/nvidia/fragment.bfp * ... - * + * * Your invocation in org/test/glsl/MyShaderTest.java: - * + * * ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), * "shader", "shader/bin", "vertex"); * ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), @@ -422,7 +422,7 @@ public class ShaderCode { * sp0.add(gl, fp0, System.err); * st.attachShaderProgram(gl, sp0, true); * </pre> - * + * * @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used), * or to determine the shader binary format (if <code>binary</code> is used). * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER} @@ -433,20 +433,20 @@ public class ShaderCode { * @param basenames basename w/o path or suffix relative to <code>srcRoot</code> and <code>binRoot</code> * for the shader's source and binary code. * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance - * which can be edited later on at the costs of a String conversion when passing to + * which can be edited later on at the costs of a String conversion when passing to * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}. * If <code>false</code> method returns an immutable <code>String</code> instance, * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} * at no additional costs. * @throws IllegalArgumentException if <code>count</count> is not 1 - * + * * @see #create(GL2ES2, int, int, Class, String, String[], String, String) - */ - public static ShaderCode create(GL2ES2 gl, int type, Class<?> context, + */ + public static ShaderCode create(GL2ES2 gl, int type, Class<?> context, String srcRoot, String binRoot, String basename, boolean mutableStringBuilder) { - return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder ); + return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder ); } - + /** * returns the uniq shader id as an integer */ @@ -455,7 +455,7 @@ public class ShaderCode { public int shaderType() { return shaderType; } public String shaderTypeStr() { return shaderTypeStr(shaderType); } - public static String shaderTypeStr(int type) { + public static String shaderTypeStr(int type) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: return "VERTEX_SHADER"; @@ -553,7 +553,7 @@ public class ShaderCode { } else { CharSequence[] src = shaderSource[i]; int lineno=0; - + for(int j=0; j<src.length; j++) { out.printf("%4d: // Segment %d/%d: \n", lineno, j, src.length); final BufferedReader reader = new BufferedReader(new StringReader(src[j].toString())); @@ -569,19 +569,19 @@ public class ShaderCode { out.println("--------------------------------------------------------------"); } } - + /** * Adds <code>data</code> after the line containing <code>tag</code>. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * + * * @param shaderIdx the shader index to be used. * @param tag search string * @param fromIndex start search <code>tag</code> begininig with this index * @param data the text to be inserted. Shall end with an EOL '\n' character. * @return index after the inserted <code>data</code> - * + * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ public int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data) { @@ -595,7 +595,7 @@ public class ShaderCode { final int sourceCount = (null!=shaderSource)?shaderSource.length:0; if(shaderIdx>=sourceCount) { throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx); - } + } final CharSequence[] src = shaderSource[shaderIdx]; int curEndIndex = 0; for(int j=0; j<src.length; j++) { @@ -603,8 +603,8 @@ public class ShaderCode { throw new IllegalStateException("shader source not a mutable StringBuilder, but CharSequence of type: "+src[j].getClass().getName()); } final StringBuilder sb = (StringBuilder)src[j]; - curEndIndex += sb.length(); - if(fromIndex < curEndIndex) { + curEndIndex += sb.length(); + if(fromIndex < curEndIndex) { int insertIdx = sb.indexOf(tag, fromIndex); if(0<=insertIdx) { insertIdx += tag.length(); @@ -630,15 +630,15 @@ public class ShaderCode { * Replaces <code>oldName</code> with <code>newName</code> in all shader sources. * <p> * In case <code>oldName</code> and <code>newName</code> are equal, no action is performed. - * </p> + * </p> * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * + * * @param oldName the to be replace string * @param newName the replacement string * @return the number of replacements - * + * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ public int replaceInShaderSource(String oldName, String newName) { @@ -675,18 +675,18 @@ public class ShaderCode { } return num; } - + /** * Adds <code>data</code> at <code>offset</code> in shader source for shader <code>shaderIdx</code>. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * + * * @param shaderIdx the shader index to be used. * @param position in shader source segments of shader <code>shaderIdx</code> * @param data the text to be inserted. Shall end with an EOL '\n' character * @return index after the inserted <code>data</code> - * + * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code> */ public int insertShaderSource(int shaderIdx, int position, CharSequence data) { @@ -700,7 +700,7 @@ public class ShaderCode { final int sourceCount = (null!=shaderSource)?shaderSource.length:0; if(shaderIdx>=sourceCount) { throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx); - } + } final CharSequence[] src = shaderSource[shaderIdx]; int curEndIndex = 0; for(int j=0; j<src.length; j++) { @@ -708,8 +708,8 @@ public class ShaderCode { throw new IllegalStateException("shader source not a mutable StringBuilder, but CharSequence of type: "+src[j].getClass().getName()); } final StringBuilder sb = (StringBuilder)src[j]; - curEndIndex += sb.length(); - if(position < curEndIndex) { + curEndIndex += sb.length(); + if(position < curEndIndex) { sb.insert(position, data); return position+data.length(); } @@ -734,12 +734,12 @@ public class ShaderCode { if (line.startsWith("#include ")) { String includeFile = line.substring(9).trim(); URLConnection nextConn = null; - + // Try relative of current shader location nextConn = IOUtil.openURL(IOUtil.getRelativeOf(conn.getURL(), includeFile), "ShaderCode.relativeOf "); if (nextConn == null) { // Try relative of class and absolute - nextConn = IOUtil.getResource(context, includeFile); + nextConn = IOUtil.getResource(context, includeFile); } if (nextConn == null) { // Fail @@ -757,7 +757,7 @@ public class ShaderCode { } /** - * + * * @param context * @param conn * @param result @@ -766,7 +766,7 @@ public class ShaderCode { public static void readShaderSource(Class<?> context, URLConnection conn, StringBuilder result) throws IOException { readShaderSource(context, conn, result, 0); } - + /** * Reads shader source located in <code>path</code>, * either relative to the <code>context</code> class or absolute <i>as-is</i>. @@ -774,21 +774,21 @@ public class ShaderCode { * Final location lookup is performed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)}, * see {@link IOUtil#getResource(Class, String)}. * </p> - * + * * @param context class used to help resolve the source location * @param path location of shader source * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance - * which can be edited later on at the costs of a String conversion when passing to + * which can be edited later on at the costs of a String conversion when passing to * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}. * If <code>false</code> method returns an immutable <code>String</code> instance, * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} * at no additional costs. - * @throws IOException - * + * @throws IOException + * * @see IOUtil#getResource(Class, String) - */ + */ public static CharSequence readShaderSource(Class<?> context, String path, boolean mutableStringBuilder) throws IOException { - URLConnection conn = IOUtil.getResource(context, path); + URLConnection conn = IOUtil.getResource(context, path); if (conn == null) { return null; } @@ -798,17 +798,17 @@ public class ShaderCode { } /** - * Reads shader binary located in <code>path</code>, + * Reads shader binary located in <code>path</code>, * either relative to the <code>context</code> class or absolute <i>as-is</i>. * <p> * Final location lookup is perfomed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)}, * see {@link IOUtil#getResource(Class, String)}. * </p> - * + * * @param context class used to help resolve the source location * @param path location of shader binary - * @throws IOException - * + * @throws IOException + * * @see IOUtil#getResource(Class, String) */ public static ByteBuffer readShaderBinary(Class<?> context, String path) throws IOException { @@ -824,41 +824,41 @@ public class ShaderCode { } } - // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ? + // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ? /** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader}: {@value #es2_default_precision_vp} */ public static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n"; /** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #es2_default_precision_fp} */ public static final String es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n"; - + /** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader} or {@link GL3#GL_GEOMETRY_SHADER geometry-shader}: {@value #gl3_default_precision_vp_gp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */ public static final String gl3_default_precision_vp_gp = "\nprecision highp float;\nprecision highp int;\n"; /** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #gl3_default_precision_fp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */ public static final String gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n"; - + /** Prefer <code>enable</code> over <code>require</code>, since it won't force a failure. */ public static final String extOESDerivativesEnable = "#extension GL_OES_standard_derivatives : enable\n"; - + /** * Add GLSL version at the head of this shader source code. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * @param gl a GL context, which must have been made current once + * @param gl a GL context, which must have been made current once * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ public final int addGLSLVersion(GL2ES2 gl) { return insertShaderSource(0, 0, gl.getContext().getGLSLVersionString()); } - + /** * Adds default precision to source code at given position if required, i.e. - * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp}, + * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp}, * {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none, * depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * @param gl a GL context, which must have been made current once + * @param gl a GL context, which must have been made current once * @param pos position within this mutable shader source. * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ @@ -871,7 +871,7 @@ public class ShaderCode { case GL2ES2.GL_FRAGMENT_SHADER: defaultPrecision = es2_default_precision_vp; break; default: - defaultPrecision = null; + defaultPrecision = null; break; } } else if( requiresGL3DefaultPrecision(gl) ) { @@ -883,7 +883,7 @@ public class ShaderCode { case GL2ES2.GL_FRAGMENT_SHADER: defaultPrecision = gl3_default_precision_fp; break; default: - defaultPrecision = null; + defaultPrecision = null; break; } } else { @@ -894,7 +894,7 @@ public class ShaderCode { } return pos; } - + /** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */ public static final boolean requiresDefaultPrecision(GL2ES2 gl) { if( gl.isGLES2() ) { @@ -902,7 +902,7 @@ public class ShaderCode { } return requiresGL3DefaultPrecision(gl); } - + /** Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. 1.50[. */ public static final boolean requiresGL3DefaultPrecision(GL2ES2 gl) { if( gl.isGL3() ) { @@ -912,16 +912,16 @@ public class ShaderCode { return false; } } - + /** * Default customization of this shader source code. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * @param gl a GL context, which must have been made current once + * @param gl a GL context, which must have been made current once * @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not. - * @param addDefaultPrecision if <code>true</code> default precision source code line(s) are added, i.e. - * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp}, + * @param addDefaultPrecision if <code>true</code> default precision source code line(s) are added, i.e. + * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp}, * {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none, * depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used. * @return the index after the inserted data, maybe 0 if nothing has be inserted. @@ -940,13 +940,13 @@ public class ShaderCode { } return pos; } - + /** * Default customization of this shader source code. * <p> * Note: The shader source to be edit must be created using a mutable StringBuilder. * </p> - * @param gl a GL context, which must have been made current once + * @param gl a GL context, which must have been made current once * @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not. * @param esDefaultPrecision optional default precision source code line(s) preluded if not null and if {@link GL#isGLES()}. * You may use {@link #es2_default_precision_fp} for fragment shader and {@link #es2_default_precision_vp} for vertex shader. @@ -967,8 +967,8 @@ public class ShaderCode { pos = addDefaultShaderPrecision(gl, pos); } return pos; - } - + } + //---------------------------------------------------------------------- // Internals only below this point // diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index 1337a7e2b..d737d6f4e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -37,7 +37,7 @@ import java.util.Iterator; import java.io.PrintStream; public class ShaderProgram { - + public ShaderProgram() { id = getNextID(); } @@ -111,7 +111,7 @@ public class ShaderProgram { /** * Adds a new shader to this program. - * + * * <p>This command does not compile and attach the shader, * use {@link #add(GL2ES2, ShaderCode)} for this purpose.</p> */ @@ -122,7 +122,7 @@ public class ShaderProgram { public synchronized boolean contains(ShaderCode shaderCode) { return allShaderCode.contains(shaderCode); } - + /** * Warning slow O(n) operation .. * @param id @@ -145,9 +145,9 @@ public class ShaderProgram { /** * Creates the empty GL program object using {@link GL2ES2#glCreateProgram()}, * if not already created. - * + * * @param gl - * @return true if shader program is valid, i.e. not zero + * @return true if shader program is valid, i.e. not zero */ public synchronized final boolean init(GL2ES2 gl) { if( 0 == shaderProgram ) { @@ -155,12 +155,12 @@ public class ShaderProgram { } return 0 != shaderProgram; } - + /** * Adds a new shader to a this non running program. * * <p>Compiles and attaches the shader, if not done yet.</p> - * + * * @return true if the shader was successfully added, false if compilation failed. */ public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) { @@ -179,11 +179,11 @@ public class ShaderProgram { /** * Replace a shader in a program and re-links the program. * - * @param gl + * @param gl * @param oldShader the to be replace Shader * @param newShader the new ShaderCode * @param verboseOut the optional verbose output stream - * + * * @return true if all steps are valid, shader compilation, attachment and linking; otherwise false. * * @see ShaderState#glEnableVertexAttribArray @@ -199,25 +199,25 @@ public class ShaderProgram { if(!init(gl) || !newShader.compile(gl, verboseOut)) { return false; } - + boolean shaderWasInUse = inUse(); if(shaderWasInUse) { useProgram(gl, false); } - + if(null != oldShader && allShaderCode.remove(oldShader)) { if(attachedShaderCode.remove(oldShader)) { ShaderUtil.detachShader(gl, shaderProgram, oldShader.shader()); } } - + add(newShader); if(attachedShaderCode.add(newShader)) { ShaderUtil.attachShader(gl, shaderProgram, newShader.shader()); } - + gl.glLinkProgram(shaderProgram); - + programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err); if ( programLinked && shaderWasInUse ) { useProgram(gl, true); @@ -227,19 +227,19 @@ public class ShaderProgram { /** * Links the shader code to the program. - * + * * <p>Compiles and attaches the shader code to the program if not done by yet</p> - * + * * <p>Within this process, all GL resources (shader and program objects) are created if necessary.</p> - * + * * @param gl * @param verboseOut * @return true if program was successfully linked and is valid, otherwise false - * + * * @see #init(GL2ES2) */ public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) { - if( !init(gl) ) { + if( !init(gl) ) { programLinked = false; // mark unlinked due to user attempt to [re]link return false; } @@ -287,7 +287,7 @@ public class ShaderProgram { sb.append("]"); return sb; } - + public String toString() { return toString(null).toString(); } @@ -299,7 +299,7 @@ public class ShaderProgram { public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) { return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut); } - + public synchronized void useProgram(GL2ES2 gl, boolean on) { if(!programLinked) { throw new GLException("Program is not linked"); } if(programInUse==on) { return; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index 8e7781f07..f60cb6088 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -48,21 +48,21 @@ import com.jogamp.opengl.util.GLArrayDataEditable; * while updating the attribute and uniform locations when switching. * <p> * This allows seamless switching of programs using <i>almost</i> same data - * but performing different artifacts. + * but performing different artifacts. * </p> * <p> * A {@link #useProgram(GL2ES2, boolean) used} ShaderState is attached to the current GL context * and can be retrieved via {@link #getShaderState(GL)}. * </p> */ -public class ShaderState { +public class ShaderState { public static final boolean DEBUG; - + static { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true); } - + public ShaderState() { } @@ -80,7 +80,7 @@ public class ShaderState { /** * Attach user object for the given name to this ShaderState. * Returns the previously set object or null. - * + * * @return the previous mapped object or null if none */ public final Object attachObject(String name, Object obj) { @@ -89,13 +89,13 @@ public class ShaderState { /** * @param name name of the mapped object to detach - * + * * @return the previous mapped object or null if none */ public final Object detachObject(String name) { return attachedObjectsByString.remove(name); - } - + } + /** * Turns the shader program on or off.<br> * @@ -104,7 +104,7 @@ public class ShaderState { * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) */ public synchronized void useProgram(GL2ES2 gl, boolean on) throws GLException { - if(null==shaderProgram) { throw new GLException("No program is attached"); } + if(null==shaderProgram) { throw new GLException("No program is attached"); } if(on) { if(shaderProgram.linked()) { shaderProgram.useProgram(gl, true); @@ -112,7 +112,7 @@ public class ShaderState { resetAllAttributes(gl); resetAllUniforms(gl); } - } else { + } else { if(resetAllShaderData) { setAllAttributes(gl); } @@ -124,7 +124,7 @@ public class ShaderState { resetAllUniforms(gl); } } - resetAllShaderData = false; + resetAllShaderData = false; } else { shaderProgram.useProgram(gl, false); } @@ -141,17 +141,17 @@ public class ShaderState { /** * Attach or switch a shader program * - * <p>Attaching a shader program the first time, + * <p>Attaching a shader program the first time, * as well as switching to another program on the fly, * while managing all attribute and uniform data.</p> - * + * * <p>[Re]sets all data and use program in case of a program switch.</p> - * + * * <p>Use program, {@link #useProgram(GL2ES2, boolean)}, * if <code>enable</code> is <code>true</code>.</p> - * + * * @return true if shader program was attached, otherwise false (already attached) - * + * * @throws GLException if program was not linked and linking fails */ public synchronized boolean attachShaderProgram(GL2ES2 gl, ShaderProgram prog, boolean enable) throws GLException { @@ -161,7 +161,7 @@ public class ShaderState { System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog); if(DEBUG) { Thread.dumpStack(); - } + } } if(null!=shaderProgram) { if(shaderProgram.equals(prog)) { @@ -190,7 +190,7 @@ public class ShaderState { shaderProgram = prog; if(null!=shaderProgram) { - // [re]set all data and use program if switching program, + // [re]set all data and use program if switching program, // or use program if program is linked if(resetAllShaderData || enable) { useProgram(gl, true); // may reset all data @@ -216,7 +216,7 @@ public class ShaderState { */ public synchronized void destroy(GL2ES2 gl) { release(gl, true, true, true); - attachedObjectsByString.clear(); + attachedObjectsByString.clear(); } /** @@ -242,7 +242,7 @@ public class ShaderState { if(destroyBoundAttributes) { for(Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) { iter.next().destroy(gl); - } + } } releaseAllAttributes(gl); releaseAllUniforms(gl); @@ -258,7 +258,7 @@ public class ShaderState { /** * Gets the cached location of a shader attribute. * - * @return -1 if there is no such attribute available, + * @return -1 if there is no such attribute available, * otherwise >= 0 * * @see #bindAttribLocation(GL2ES2, int, String) @@ -270,7 +270,7 @@ public class ShaderState { Integer idx = activeAttribLocationMap.get(name); return (null!=idx)?idx.intValue():-1; } - + /** * Get the previous cached vertex attribute data. * @@ -289,27 +289,27 @@ public class ShaderState { public GLArrayData getAttribute(String name) { return activeAttribDataMap.get(name); } - + public boolean isActiveAttribute(GLArrayData attribute) { return attribute == activeAttribDataMap.get(attribute.getName()); } - + /** * Binds or unbinds the {@link GLArrayData} lifecycle to this ShaderState. - * + * * <p>If an attribute location is cached (ie {@link #bindAttribLocation(GL2ES2, int, String)}) * it is promoted to the {@link GLArrayData} instance.</p> - * - * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)} + * + * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)} * and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.</p> - * + * * <p>The data will not be transfered to the GPU, use {@link #vertexAttribPointer(GL2ES2, GLArrayData)} additionally.</p> - * + * * <p>The data will also be {@link GLArrayData#associate(Object, boolean) associated} with this ShaderState.</p> - * + * * @param attribute the {@link GLArrayData} which lifecycle shall be managed * @param own true if <i>owning</i> shall be performs, false if <i>disowning</i>. - * + * * @see #bindAttribLocation(GL2ES2, int, String) * @see #getAttribute(String) * @see GLArrayData#associate(Object, boolean) @@ -326,11 +326,11 @@ public class ShaderState { } attribute.associate(this, own); } - + public boolean ownsAttribute(GLArrayData attribute) { return managedAttributes.contains(attribute); } - + /** * Binds a shader attribute to a location. * Multiple names can be bound to one location. @@ -339,14 +339,14 @@ public class ShaderState { * * @throws GLException if no program is attached * @throws GLException if the program is already linked - * + * * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String) * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) */ public void bindAttribLocation(GL2ES2 gl, int location, String name) { if(null==shaderProgram) throw new GLException("No program is attached"); - if(shaderProgram.linked()) throw new GLException("Program is already linked"); + if(shaderProgram.linked()) throw new GLException("Program is already linked"); final Integer loc = new Integer(location); activeAttribLocationMap.put(name, loc); gl.glBindAttribLocation(shaderProgram.program(), location, name); @@ -361,7 +361,7 @@ public class ShaderState { * * @throws GLException if no program is attached * @throws GLException if the program is already linked - * + * * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String) * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) @@ -382,7 +382,7 @@ public class ShaderState { * or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.<br> * The location will be cached. * - * @return -1 if there is no such attribute available, + * @return -1 if there is no such attribute available, * otherwise >= 0 * @throws GLException if no program is attached * @throws GLException if the program is not linked and no location was cached. @@ -407,22 +407,22 @@ public class ShaderState { System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location); if(DEBUG) { Thread.dumpStack(); - } + } } } return location; } - + /** * Validates and returns the location of a shader attribute.<br> - * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid, + * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid, * or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.<br> - * The location will be cached and set in the + * The location will be cached and set in the * {@link GLArrayData} object. * - * @return -1 if there is no such attribute available, + * @return -1 if there is no such attribute available, * otherwise >= 0 - * + * * @throws GLException if no program is attached * @throws GLException if the program is not linked and no location was cached. * @@ -451,13 +451,13 @@ public class ShaderState { System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location); if(DEBUG) { Thread.dumpStack(); - } + } } - } + } activeAttribDataMap.put(data.getName(), data); return location; } - + // // Enabled Vertex Arrays and its data // @@ -469,14 +469,14 @@ public class ShaderState { final Boolean v = activedAttribEnabledMap.get(name); return null != v && v.booleanValue(); } - + /** * @return true if the {@link GLArrayData} attribute is enable */ public final boolean isVertexAttribArrayEnabled(GLArrayData data) { return isVertexAttribArrayEnabled(data.getName()); } - + private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) { activedAttribEnabledMap.put(name, Boolean.TRUE); if(0>location) { @@ -486,7 +486,7 @@ public class ShaderState { System.err.println("ShaderState: glEnableVertexAttribArray failed, no index for: "+name); if(DEBUG) { Thread.dumpStack(); - } + } } return false; } @@ -497,12 +497,12 @@ public class ShaderState { gl.glEnableVertexAttribArray(location); return true; } - + /** * Enables a vertex attribute array. - * + * * This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)} - * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred. + * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred. * * Even if the attribute is not found in the current shader, * it is marked enabled in this state. @@ -510,7 +510,7 @@ public class ShaderState { * @return false, if the name is not found, otherwise true * * @throws GLException if the program is not linked and no location was cached. - * + * * @see #glEnableVertexAttribArray * @see #glDisableVertexAttribArray * @see #glVertexAttribPointer @@ -519,7 +519,7 @@ public class ShaderState { public boolean enableVertexAttribArray(GL2ES2 gl, String name) { return enableVertexAttribArray(gl, name, -1); } - + /** * Enables a vertex attribute array, usually invoked by {@link GLArrayDataEditable#enableBuffer(GL, boolean)}. @@ -528,7 +528,7 @@ public class ShaderState { * and is the preferred alternative to {@link #enableVertexAttribArray(GL2ES2, String)}. * If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set * and cached in this state. - * + * * Even if the attribute is not found in the current shader, * it is marked enabled in this state. * @@ -547,11 +547,11 @@ public class ShaderState { getAttribLocation(gl, data); } else { // ensure data is the current bound one - activeAttribDataMap.put(data.getName(), data); + activeAttribDataMap.put(data.getName(), data); } return enableVertexAttribArray(gl, data.getName(), data.getLocation()); } - + private boolean disableVertexAttribArray(GL2ES2 gl, String name, int location) { activedAttribEnabledMap.put(name, Boolean.FALSE); if(0>location) { @@ -572,13 +572,13 @@ public class ShaderState { gl.glDisableVertexAttribArray(location); return true; } - + /** * Disables a vertex attribute array * * This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)} * hence {@link #disableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred. - * + * * Even if the attribute is not found in the current shader, * it is removed from this state enabled list. * @@ -603,7 +603,7 @@ public class ShaderState { * and is the preferred alternative to {@link #disableVertexAttribArray(GL2ES2, String)}. * If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set * and cached in this state. - * + * * Even if the attribute is not found in the current shader, * it is removed from this state enabled list. * @@ -623,20 +623,20 @@ public class ShaderState { } return disableVertexAttribArray(gl, data.getName(), data.getLocation()); } - + /** * Set the {@link GLArrayData} vertex attribute data, if it's location is valid, i.e. ≥ 0. * <p> * This method uses the {@link GLArrayData}'s location if valid, i.e. ≥ 0.<br/> - * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)}, + * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)}, * set and cached in this state. * </p> - * + * * @return false, if the location could not be determined, otherwise true * * @throws GLException if no program is attached * @throws GLException if the program is not linked and no location was cached. - * + * * @see #glEnableVertexAttribArray * @see #glDisableVertexAttribArray * @see #glVertexAttribPointer @@ -646,7 +646,7 @@ public class ShaderState { int location = data.getLocation(); if(0 > location) { location = getAttribLocation(gl, data); - } + } if(0 <= location) { // only pass the data, if the attribute exists in the current shader if(DEBUG) { @@ -683,16 +683,16 @@ public class ShaderState { activeAttribDataMap.clear(); activedAttribEnabledMap.clear(); activeAttribLocationMap.clear(); - managedAttributes.clear(); + managedAttributes.clear(); } - + /** * Disables all vertex attribute arrays. * * Their enabled stated will be removed from this state only * if 'removeFromState' is true. * - * This method purpose is more for debugging. + * This method purpose is more for debugging. * * @see #glEnableVertexAttribArray * @see #glDisableVertexAttribArray @@ -717,7 +717,7 @@ public class ShaderState { } private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) { - // get new location .. note: 'activeAttribLocationMap' is cleared before + // get new location .. note: 'activeAttribLocationMap' is cleared before final String name = attribute.getName(); final int loc = attribute.setLocation(gl, shaderProgram.program()); if(0<=loc) { @@ -729,34 +729,34 @@ public class ShaderState { // enable attrib, VBO and pass location/data gl.glEnableVertexAttribArray(loc); } - + if( attribute.isVBO() ) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName()); gl.glVertexAttribPointer(attribute); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); - } else { + } else { gl.glVertexAttribPointer(attribute); } } } - + /** * Reset all previously enabled mapped vertex attribute data. - * + * * <p> * Attribute data is bound to the GL state, i.e. VBO data itself will not be updated. * </p> - * + * * <p> * Attribute location and it's data assignment is bound to the program, * hence both are updated. * </p> - * + * * <p> - * Note: Such update could only be prevented, + * Note: Such update could only be prevented, * if tracking am attribute/program dirty flag. * </p> - * + * * @throws GLException is the program is not linked * * @see #attachShaderProgram(GL2ES2, ShaderProgram) @@ -764,7 +764,7 @@ public class ShaderState { private final void resetAllAttributes(GL2ES2 gl) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); activeAttribLocationMap.clear(); - + for(int i=0; i<managedAttributes.size(); i++) { ((GLArrayData)managedAttributes.get(i)).setLocation(-1); } @@ -780,22 +780,22 @@ public class ShaderState { if(0<=loc) { bindAttribLocation(gl, loc, name); - + if(isVertexAttribArrayEnabled(name)) { // enable attrib, VBO and pass location/data gl.glEnableVertexAttribArray(loc); } - + if( attribute.isVBO() ) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName()); gl.glVertexAttribPointer(attribute); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); - } else { + } else { gl.glVertexAttribPointer(attribute); } } } - + /** * preserves the attribute location .. (program not linked) */ @@ -812,7 +812,7 @@ public class ShaderState { /** * Gets the cached location of the shader uniform. * - * @return -1 if there is no such uniform available, + * @return -1 if there is no such uniform available, * otherwise >= 0 */ public final int getCachedUniformLocation(String name) { @@ -822,38 +822,38 @@ public class ShaderState { /** * Bind the {@link GLUniform} lifecycle to this ShaderState. - * + * * <p>If a uniform location is cached it is promoted to the {@link GLUniformData} instance.</p> - * - * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)} + * + * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)} * and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.</p> - * + * * <p>The data will not be transfered to the GPU, use {@link #uniform(GL2ES2, GLUniformData)} additionally.</p> - * + * * @param uniform the {@link GLUniformData} which lifecycle shall be managed - * + * * @see #getUniform(String) */ public void ownUniform(GLUniformData uniform) { final int location = getCachedUniformLocation(uniform.getName()); if(0<=location) { uniform.setLocation(location); - } + } activeUniformDataMap.put(uniform.getName(), uniform); - managedUniforms.add(uniform); + managedUniforms.add(uniform); } - + public boolean ownsUniform(GLUniformData uniform) { return managedUniforms.contains(uniform); } - + /** * Gets the location of a shader uniform with given <code>name</code>.<br> * Uses either the cached value {@link #getCachedUniformLocation(String)} if valid, * or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.<br> * The location will be cached. * <p> - * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)}) + * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)}) * must be in use ({@link #useProgram(GL2ES2, boolean) }) !</p> * * @return -1 if there is no such attribute available, @@ -884,15 +884,15 @@ public class ShaderState { } return location; } - + /** * Validates and returns the location of a shader uniform.<br> * Uses either the cached value {@link #getCachedUniformLocation(String)} if valid, * or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.<br> - * The location will be cached and set in the + * The location will be cached and set in the * {@link GLUniformData} object. * <p> - * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)}) + * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)}) * must be in use ({@link #useProgram(GL2ES2, boolean) }) !</p> * * @return -1 if there is no such attribute available, @@ -922,16 +922,16 @@ public class ShaderState { Thread.dumpStack(); } } - } - activeUniformDataMap.put(name, data); + } + activeUniformDataMap.put(name, data); return location; } - + /** * Set the uniform data, if it's location is valid, i.e. ≥ 0. * <p> * This method uses the {@link GLUniformData}'s location if valid, i.e. ≥ 0.<br/> - * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)}, + * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)}, * set and cached in this state. * </p> * @@ -959,7 +959,7 @@ public class ShaderState { } return false; } - + /** * Get the uniform data, previously set. * @@ -978,7 +978,7 @@ public class ShaderState { activeUniformLocationMap.clear(); managedUniforms.clear(); } - + /** * Reset all previously mapped uniform data * <p> @@ -986,20 +986,20 @@ public class ShaderState { * hence both are updated. * </p> * <p> - * Note: Such update could only be prevented, + * Note: Such update could only be prevented, * if tracking a uniform/program dirty flag. * </p> - * + * * @throws GLException is the program is not in use - * + * * @see #attachShaderProgram(GL2ES2, ShaderProgram) */ private final void resetAllUniforms(GL2ES2 gl) { - if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); + if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); activeUniformLocationMap.clear(); for(Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) { iter.next().setLocation(-1); - } + } for(Iterator<GLUniformData> iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) { final GLUniformData data = iter.next(); final int loc = data.setLocation(gl, shaderProgram.program()); @@ -1018,9 +1018,9 @@ public class ShaderState { if(null==sb) { sb = new StringBuilder(); } - + sb.append("ShaderState[ "); - + sb.append(Platform.getNewline()).append(" "); if(null != shaderProgram) { shaderProgram.toString(sb); @@ -1066,25 +1066,25 @@ public class ShaderState { sb.append(Platform.getNewline()).append(" ]").append(Platform.getNewline()).append("]"); return sb; } - + @Override public String toString() { return toString(null, DEBUG).toString(); } - + private boolean verbose = DEBUG; private ShaderProgram shaderProgram=null; - + private HashMap<String, Boolean> activedAttribEnabledMap = new HashMap<String, Boolean>(); private HashMap<String, Integer> activeAttribLocationMap = new HashMap<String, Integer>(); private HashMap<String, GLArrayData> activeAttribDataMap = new HashMap<String, GLArrayData>(); private ArrayList<GLArrayData> managedAttributes = new ArrayList<GLArrayData>(); - + private HashMap<String, Integer> activeUniformLocationMap = new HashMap<String, Integer>(); private HashMap<String, GLUniformData> activeUniformDataMap = new HashMap<String, GLUniformData>(); private ArrayList<GLUniformData> managedUniforms = new ArrayList<GLUniformData>(); - - private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>(); + + private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>(); private boolean resetAllShaderData = false; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index d18fd4bae..5cd384c58 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2009 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,7 +28,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 com.jogamp.opengl.util.glsl; @@ -117,11 +117,11 @@ public class ShaderUtil { } return true; } - + /** * Performs {@link GL2ES2#glValidateProgram(int)} * <p> - * One shall only call this method while debugging and only if all required + * One shall only call this method while debugging and only if all required * resources by the shader are set. * </p> * <p> @@ -150,7 +150,7 @@ public class ShaderUtil { } /** - * If supported, queries the natively supported shader binary formats using + * If supported, queries the natively supported shader binary formats using * {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS} * via {@link GL2ES2#glGetIntegerv(int, int[], int)}. */ @@ -172,9 +172,9 @@ public class ShaderUtil { info.shaderBinaryFormats.add(new Integer(formats[i])); } } - } catch (GLException gle) { - System.err.println("Catched Exception on thread "+Thread.currentThread().getName()); - gle.printStackTrace(); + } catch (GLException gle) { + System.err.println("Catched Exception on thread "+Thread.currentThread().getName()); + gle.printStackTrace(); } } } @@ -202,13 +202,13 @@ public class ShaderUtil { } info.shaderCompilerAvailable = new Boolean(v); queryOK = true; - } catch (GLException gle) { - System.err.println("Catched Exception on thread "+Thread.currentThread().getName()); - gle.printStackTrace(); + } catch (GLException gle) { + System.err.println("Catched Exception on thread "+Thread.currentThread().getName()); + gle.printStackTrace(); } if(!queryOK) { info.shaderCompilerAvailable = new Boolean(true); - } + } } else if( gl.isGL2ES2() ) { info.shaderCompilerAvailable = new Boolean(true); } else { @@ -217,8 +217,8 @@ public class ShaderUtil { } return info.shaderCompilerAvailable.booleanValue(); } - - /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ + + /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ public static boolean isGeometryShaderSupported(GL _gl) { final GLContext ctx = _gl.getContext(); return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 || @@ -240,7 +240,7 @@ public class ShaderUtil { IntBuffer lengths = Buffers.newDirectIntBuffer(count); for(int i=0; i<count; i++) { lengths.put(i, source[i].length()); - } + } if(source instanceof String[]) { // rare case .. gl.glShaderSource(shader, count, (String[])source, lengths); @@ -338,7 +338,7 @@ public class ShaderUtil { } createShader(gl, shaderType, shader); - err = gl.glGetError(); + err = gl.glGetError(); if(err!=GL.GL_NO_ERROR) { throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); } @@ -353,7 +353,7 @@ public class ShaderUtil { } public static boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType, - CharSequence[][] sources, + CharSequence[][] sources, PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); @@ -363,32 +363,32 @@ public class ShaderUtil { } createShader(gl, shaderType, shader); - err = gl.glGetError(); + err = gl.glGetError(); if(err!=GL.GL_NO_ERROR) { throw new GLException("createAndCompileShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err)); } shaderSource(gl, shader, sources); - err = gl.glGetError(); + err = gl.glGetError(); if(err!=GL.GL_NO_ERROR) { throw new GLException("createAndCompileShader: ShaderSource failed, GL Error: 0x"+Integer.toHexString(err)); } compileShader(gl, shader); - err = gl.glGetError(); + err = gl.glGetError(); if(err!=GL.GL_NO_ERROR && null!=verboseOut) { verboseOut.println("createAndCompileShader: CompileShader failed, GL Error: 0x"+Integer.toHexString(err)); } return isShaderStatusValid(gl, shader, GL2ES2.GL_COMPILE_STATUS, verboseOut) && err == GL.GL_NO_ERROR; } - + private static final String implObjectKey = "com.jogamp.opengl.util.glsl.ShaderUtil" ; - + private static class ProfileInformation { Boolean shaderCompilerAvailable = null; Set<Integer> shaderBinaryFormats = null; - } + } private static ProfileInformation getProfileInformation(GL gl) { final GLContext context = gl.getContext(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index a653bd467..2f8884a3a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -24,13 +24,13 @@ import com.jogamp.opengl.util.PMVMatrix; public class FixedFuncUtil { /** * @param gl - * @param mode one of the {@link ShaderSelectionMode}s + * @param mode one of the {@link ShaderSelectionMode}s * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline} * @return If gl is a GL2ES1 and force is false, return the type cast object, * otherwise create a fixed function emulation pipeline using the given GL2ES2 impl * and hook it to the GLContext via {@link GLContext#setGL(GL)}. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 - * + * * @see ShaderSelectionMode#AUTO * @see ShaderSelectionMode#COLOR * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX @@ -53,13 +53,13 @@ public class FixedFuncUtil { /** * @param gl - * @param mode one of the {@link ShaderSelectionMode}s + * @param mode one of the {@link ShaderSelectionMode}s * @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline} * @return If gl is a GL2ES1, return the type cast object, * otherwise create a fixed function emulation pipeline using the GL2ES2 impl. * and hook it to the GLContext via {@link GLContext#setGL(GL)}. * @throws GLException if the GL object is neither GL2ES1 nor GL2ES2 - * + * * @see ShaderSelectionMode#AUTO * @see ShaderSelectionMode#COLOR * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX @@ -71,11 +71,11 @@ public class FixedFuncUtil { } /** - * Mapping fixed function (client) array indices to + * Mapping fixed function (client) array indices to * GLSL array attribute names. * * Useful for uniq mapping of canonical array index names as listed. - * + * * @see #mgl_Vertex * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY * @see #mgl_Normal diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java index e6bdf702c..426fb0d85 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java @@ -1,8 +1,8 @@ package com.jogamp.opengl.util.glsl.fixedfunc; -/** +/** * Shader selection mode - * + * * @see ShaderSelectionMode#AUTO * @see ShaderSelectionMode#COLOR * @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX @@ -11,17 +11,17 @@ package com.jogamp.opengl.util.glsl.fixedfunc; */ public enum ShaderSelectionMode { /** Auto shader selection, based upon FFP states. */ - AUTO, + AUTO, /** Fixed shader selection: Simple color. */ - COLOR, + COLOR, /** Fixed shader selection: Multi-Textured color. 2 texture units. */ - COLOR_TEXTURE2, + COLOR_TEXTURE2, /** Fixed shader selection: Multi-Textured color. 4 texture units. */ - COLOR_TEXTURE4, + COLOR_TEXTURE4, /** Fixed shader selection: Multi-Textured color. 8 texture units. */ - COLOR_TEXTURE8, + COLOR_TEXTURE8, /** Fixed shader selection: Color with vertex-lighting. */ - COLOR_LIGHT_PER_VERTEX, + COLOR_LIGHT_PER_VERTEX, /** Fixed shader selection: Multi-Textured color with vertex-lighting. 8 texture units.*/ - COLOR_TEXTURE8_LIGHT_PER_VERTEX + COLOR_TEXTURE8_LIGHT_PER_VERTEX }
\ No newline at end of file diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index a5b1c6687..9573ea5c3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -55,8 +55,8 @@ public abstract class CompileShader { URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); String dirName = dirname(resourceURL.getPath()); - outName = dirName + File.separator + "bin" + File.separator + - ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator + + outName = dirName + File.separator + "bin" + File.separator + + ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator + outName; processOneShader(resourceName, outName, type); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java index 7b6a1b479..c1b5025f8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java index 5ba3f7330..44b4fea9e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.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. */ @@ -128,7 +128,7 @@ public class Level { candidate.setSize(candidate.w() - rect.w(), height); freeList.add(candidate); } - + coalesceFreeList(); return true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java index 6783aec3b..e14eef5ba 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.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. */ @@ -108,7 +108,7 @@ public class LevelSet { if (level.remove(rect)) return true; } - + return false; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java index 6206c4a11..23f143b83 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.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. */ @@ -72,7 +72,7 @@ public class Rect { // there is no room left due either to fragmentation or just being // out of space) private Rect nextLocation; - + public Rect() { this(null); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java index 49cfc82e6..5db216742 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java index 1496a04a6..a9d609745 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.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. */ @@ -203,7 +203,7 @@ public class RectanglePacker { } nextLevelSet = new LevelSet(newWidth, newHeight); - + // Make copies of all existing rectangles List/*<Rect>*/ newRects = new ArrayList/*<Rect>*/(); for (Iterator i1 = levels.iterator(); i1.hasNext(); ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 4236e22fb..fd026d76e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. @@ -53,8 +53,8 @@ import com.jogamp.opengl.util.texture.spi.*; * for enabling/disabling OpenGL texture state, binding this texture, * and computing texture coordinates for both the entire image as well * as a sub-image. - * - * <a name="textureCallOrder"><h5>Order of Texture Commands</h5></a> + * + * <a name="textureCallOrder"><h5>Order of Texture Commands</h5></a> * <p> * Due to many confusions w/ texture usage, following list described the order * and semantics of texture unit selection, binding and enabling. @@ -67,16 +67,16 @@ import com.jogamp.opengl.util.texture.spi.*; * <li>Issue draw commands</li> * </ul> * </p> - * + * * <p><a name="nonpow2"><b>Non-power-of-two restrictions</b></a> * <br> When creating an OpenGL texture object, the Texture class will * attempt to use <i>non-power-of-two textures</i> (NPOT) if available, see {@link GL#isNPOTTextureAvailable()}. - * Further more, + * Further more, * <a href="http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt">GL_ARB_texture_rectangle</a> * (RECT) will be attempted on OSX w/ ATI drivers. * If NPOT is not available or RECT not chosen, the Texture class will simply upload a non-pow2-sized * image into a standard pow2-sized texture (without any special - * scaling). + * scaling). * Since the choice of extension (or whether one is used at * all) depends on the user's machine configuration, developers are * recommended to use {@link #getImageTexCoords} and {@link @@ -106,7 +106,7 @@ import com.jogamp.opengl.util.texture.spi.*; * #bind}, but when drawing many triangles all using the same texture, * for best performance only one call to {@link #bind} should be made. * User may also utilize multiple texture units, - * see <a href="#textureCallOrder"> order of texture commands above</a>. + * see <a href="#textureCallOrder"> order of texture commands above</a>. * * <p><a name="premult"><b>Alpha premultiplication and blending</b></a> * <p> @@ -119,7 +119,7 @@ import com.jogamp.opengl.util.texture.spi.*; * <p> * The mathematically correct way to perform blending in OpenGL * with the SrcOver "source over destination" mode, or any other - * Porter-Duff rule, is to use <i>premultiplied color components</i>, + * Porter-Duff rule, is to use <i>premultiplied color components</i>, * which means the R/G/ B color components must have been multiplied by * the alpha value. If using <i>premultiplied color components</i> * it is important to use the correct blending function; for @@ -137,7 +137,7 @@ import com.jogamp.opengl.util.texture.spi.*; float g = g * a; float b = b * a; gl.glColor4f(r, g, b, a); -</pre> +</pre> * * For reference, here is a list of the Porter-Duff compositing rules * and the associated OpenGL blend functions (source and destination @@ -187,8 +187,8 @@ public class Texture { /** The texture coordinates corresponding to the entire image. */ private TextureCoords coords; - - public String toString() { + + public String toString() { return "Texture[target 0x"+Integer.toHexString(target)+", name "+texID+", "+ imgWidth+"/"+texWidth+" x "+imgHeight+"/"+texHeight+", y-flip "+mustFlipVertically+ ", "+estimatedMemorySize+" bytes]"; @@ -237,7 +237,7 @@ public class Texture { * gl.glEnable(texture.getTarget()); * </pre> * <p> - * Call is ignored if the {@link GL} object's context + * Call is ignored if the {@link GL} object's context * is using a core profile, see {@link GL#isGLcore()}, * or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}. * </p> @@ -255,7 +255,7 @@ public class Texture { gl.glEnable(target); } } - + /** * Disables this texture's target (e.g., GL_TEXTURE_2D) in the * given GL state. This method is a shorthand equivalent @@ -264,7 +264,7 @@ public class Texture { * gl.glDisable(texture.getTarget()); * </pre> * <p> - * Call is ignored if the {@link GL} object's context + * Call is ignored if the {@link GL} object's context * is using a core profile, see {@link GL#isGLcore()}, * or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}. * </p> @@ -282,7 +282,7 @@ public class Texture { gl.glDisable(target); } } - + /** * Binds this texture to the given GL context. This method is a * shorthand equivalent of the following OpenGL code: @@ -292,16 +292,16 @@ public class Texture { * * See the <a href="#perftips">performance tips</a> above for hints * on how to maximize performance when using many Texture objects. - * + * * @param gl the current GL context * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ public void bind(GL gl) throws GLException { validateTexID(gl, true); - gl.glBindTexture(target, texID); + gl.glBindTexture(target, texID); } - + /** * Destroys the native resources used by this texture object. * @@ -335,7 +335,7 @@ public class Texture { public int getWidth() { return texWidth; } - + /** * Returns the height of the allocated OpenGL texture in pixels. * Note that the texture height will be greater than or equal to the @@ -345,9 +345,9 @@ public class Texture { */ public int getHeight() { return texHeight; - } - - /** + } + + /** * Returns the width of the image contained within this texture. * Note that for non-power-of-two textures in particular this may * not be equal to the result of {@link #getWidth}. It is @@ -389,7 +389,7 @@ public class Texture { * entire image. If the TextureData indicated that the texture * coordinates must be flipped vertically, the returned * TextureCoords will take that into account. - * + * * @return the texture coordinates corresponding to the entire image */ public TextureCoords getImageTexCoords() { @@ -406,7 +406,7 @@ public class Texture { * flipped vertically, the returned TextureCoords will take that * into account; this should not be handled by the end user in the * specification of the y1 and y2 coordinates. - * + * * @return the texture coordinates corresponding to the specified sub-image */ public TextureCoords getSubImageTexCoords(int x1, int y1, int x2, int y2) { @@ -431,9 +431,9 @@ public class Texture { } /** - * Updates the entire content area incl. {@link TextureCoords} + * Updates the entire content area incl. {@link TextureCoords} * of this texture using the data in the given image. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void updateImage(GL gl, TextureData data) throws GLException { @@ -465,12 +465,12 @@ public class Texture { updateTexCoords(); } } - + /** * Updates the content area incl. {@link TextureCoords} of the specified target of this texture * using the data in the given image. In general this is intended * for construction of cube maps. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void updateImage(GL gl, TextureData data, int targetOverride) throws GLException { @@ -791,7 +791,7 @@ public class Texture { * texture's target. This gives control over parameters such as * GL_TEXTURE_MAX_ANISOTROPY_EXT. Causes this texture to be bound to * the current texture state. - * + * * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ @@ -805,7 +805,7 @@ public class Texture { * Sets the OpenGL multi-floating-point texture parameter for the * texture's target. Causes this texture to be bound to the current * texture state. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void setTexParameterfv(GL gl, int parameterName, @@ -818,7 +818,7 @@ public class Texture { * Sets the OpenGL multi-floating-point texture parameter for the * texture's target. Causes this texture to be bound to the current * texture state. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void setTexParameterfv(GL gl, int parameterName, @@ -834,7 +834,7 @@ public class Texture { * to GL_CLAMP_TO_EDGE if OpenGL 1.2 is supported on the current * platform and GL_CLAMP if not. Causes this texture to be bound to * the current texture state. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void setTexParameteri(GL gl, int parameterName, @@ -847,7 +847,7 @@ public class Texture { * Sets the OpenGL multi-integer texture parameter for the texture's * target. Causes this texture to be bound to the current texture * state. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void setTexParameteriv(GL gl, int parameterName, @@ -860,7 +860,7 @@ public class Texture { * Sets the OpenGL multi-integer texture parameter for the texture's * target. Causes this texture to be bound to the current texture * state. - * + * * @throws GLException if any OpenGL-related errors occurred */ public void setTexParameteriv(GL gl, int parameterName, @@ -886,7 +886,7 @@ public class Texture { } /** - * Returns the underlying OpenGL texture object for this texture, + * Returns the underlying OpenGL texture object for this texture, * maybe <code>0</code> if not yet generated. * <p> * Most applications will not need to access this, since it is @@ -967,19 +967,19 @@ public class Texture { } } else { if (mustFlipVertically) { - coords = new TextureCoords(0, // l + coords = new TextureCoords(0, // l (float) imgHeight / (float) texHeight, // b (float) imgWidth / (float) texWidth, // r 0 // t ); } else { - coords = new TextureCoords(0, // l + coords = new TextureCoords(0, // l 0, // b (float) imgWidth / (float) texWidth, // r (float) imgHeight / (float) texHeight // t ); } - } + } } private void updateSubImageImpl(GL gl, TextureData data, int newTarget, int mipmapLevel, diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java index 3931b7290..63f100630 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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,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. @@ -77,7 +77,7 @@ public class TextureCoords { d[6+d_off] = right *ss; d[7+d_off] = top *ts; return d; } - + /** Returns the leftmost (x) texture coordinate of this rectangle. */ public float left() { return left; } @@ -93,6 +93,6 @@ public class TextureCoords { /** Returns the topmost (y) texture coordinate of this rectangle. */ public float top() { return top; } - + public String toString() { return "TexCoord[h: "+left+" - "+right+", v: "+bottom+" - "+top+"]"; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index afc5bf70c..28029efc5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. @@ -57,8 +57,8 @@ import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; public class TextureData { /** ColorSpace of pixel data. */ - public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK }; - + public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK }; + protected int width; protected int height; private int border; @@ -83,7 +83,7 @@ public class TextureData { protected GLProfile glProfile; protected ColorSpace pixelCS = ColorSpace.RGB; - /** + /** * Constructs a new TextureData object with the specified parameters * and data contained in the given Buffer. The optional Flusher can * be used to clean up native resources associated with this @@ -123,7 +123,7 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, + public TextureData(GLProfile glp, int internalFormat, int width, int height, @@ -135,11 +135,11 @@ public class TextureData { boolean mustFlipVertically, Buffer buffer, Flusher flusher) throws IllegalArgumentException { - this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), + this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), mipmap, dataIsCompressed, mustFlipVertically, buffer, flusher); } - /** + /** * Constructs a new TextureData object with the specified parameters * and data contained in the given Buffer. The optional Flusher can * be used to clean up native resources associated with this @@ -178,7 +178,7 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, + public TextureData(GLProfile glp, int internalFormat, int width, int height, @@ -207,8 +207,8 @@ public class TextureData { alignment = 1; // FIXME: is this correct enough in all situations? estimatedMemorySize = estimatedMemorySize(buffer); } - - /** + + /** * Constructs a new TextureData object with the specified parameters * and data for multiple mipmap levels contained in the given array * of Buffers. The optional Flusher can be used to clean up native @@ -258,11 +258,11 @@ public class TextureData { boolean mustFlipVertically, Buffer[] mipmapData, Flusher flusher) throws IllegalArgumentException { - this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), + this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), dataIsCompressed, mustFlipVertically, mipmapData, flusher); } - /** + /** * Constructs a new TextureData object with the specified parameters * and data for multiple mipmap levels contained in the given array * of Buffers. The optional Flusher can be used to clean up native @@ -325,19 +325,19 @@ public class TextureData { estimatedMemorySize += estimatedMemorySize(mipmapData[i]); } } - - /** + + /** * Returns the color space of the pixel data. - * @see #setColorSpace(ColorSpace) + * @see #setColorSpace(ColorSpace) */ public ColorSpace getColorSpace() { return pixelCS; } - /** + /** * Set the color space of the pixel data, which defaults to {@link ColorSpace#RGB}. - * @see #getColorSpace() + * @see #getColorSpace() */ public void setColorSpace(ColorSpace cs) { pixelCS = cs; } - + /** Used only by subclasses */ protected TextureData(GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; } @@ -346,8 +346,8 @@ public class TextureData { /** Returns the height in pixels of the texture data. */ public int getHeight() { return height; } /** Returns the border in pixels of the texture data. */ - public int getBorder() { - return border; + public int getBorder() { + return border; } /** Returns the intended OpenGL {@link GLPixelAttributes} of the texture data, i.e. format and type. */ public GLPixelAttributes getPixelAttributes() { @@ -362,21 +362,21 @@ public class TextureData { return pixelAttributes.type; } /** Returns the intended OpenGL internal format of the texture data. */ - public int getInternalFormat() { - return internalFormat; + public int getInternalFormat() { + return internalFormat; } /** Returns whether mipmaps should be generated for the texture data. */ - public boolean getMipmap() { - return mipmap; + public boolean getMipmap() { + return mipmap; } /** Indicates whether the texture data is in compressed form. */ - public boolean isDataCompressed() { - return dataIsCompressed; + public boolean isDataCompressed() { + return dataIsCompressed; } /** Indicates whether the texture coordinates must be flipped vertically for proper display. */ - public boolean getMustFlipVertically() { - return mustFlipVertically; + public boolean getMustFlipVertically() { + return mustFlipVertically; } /** Returns the texture data, or null if it is specified as a set of mipmaps. */ public Buffer getBuffer() { @@ -384,18 +384,18 @@ public class TextureData { } /** Returns all mipmap levels for the texture data, or null if it is specified as a single image. */ - public Buffer[] getMipmapData() { - return mipmapData; + public Buffer[] getMipmapData() { + return mipmapData; } /** Returns the required byte alignment for the texture data. */ - public int getAlignment() { - return alignment; + public int getAlignment() { + return alignment; } /** Returns the row length needed for correct GL_UNPACK_ROW_LENGTH specification. This is currently only supported for non-mipmapped, non-compressed textures. */ - public int getRowLength() { - return rowLength; + public int getRowLength() { + return rowLength; } /** Sets the width in pixels of the texture data. */ @@ -405,25 +405,25 @@ public class TextureData { /** Sets the border in pixels of the texture data. */ public void setBorder(int border) { this.border = border; } /** Sets the intended OpenGL pixel format of the texture data. */ - public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } - /** + public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } + /** * Sets the intended OpenGL pixel format component of {@link GLPixelAttributes} of the texture data. * <p> - * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. - * </p> + * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. + * </p> */ public void setPixelFormat(int pixelFormat) { if( pixelAttributes.format != pixelFormat ) { pixelAttributes = new GLPixelAttributes(pixelFormat, pixelAttributes.type); } } - /** + /** * Sets the intended OpenGL pixel type component of {@link GLPixelAttributes} of the texture data. * <p> - * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. - * </p> + * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. + * </p> */ - public void setPixelType(int pixelType) { + public void setPixelType(int pixelType) { if( pixelAttributes.type != pixelType) { pixelAttributes = new GLPixelAttributes(pixelAttributes.format, pixelType); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index 3748cd336..b6d89d6d2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. */ @@ -161,11 +161,11 @@ public class TextureIO { /** Constant which can be used as a file suffix to indicate a PAM file, NetPbm magic 7 - binary RGB and RGBA. Write support only. */ public static final String PAM = "pam"; - + /** Constant which can be used as a file suffix to indicate a PAM file, NetPbm magic 6 - binary RGB. Write support only. */ public static final String PPM = "ppm"; - + private static final boolean DEBUG = Debug.debug("TextureIO"); // For manually disabling the use of the texture rectangle @@ -421,7 +421,7 @@ public class TextureIO { // methods that *do* require a current context // - /** + /** * Creates an OpenGL texture object from the specified TextureData * using the current OpenGL context. * @@ -434,7 +434,7 @@ public class TextureIO { return newTexture(GLContext.getCurrentGL(), data); } - /** + /** * Creates an OpenGL texture object from the specified TextureData * using the given OpenGL context. * @@ -449,8 +449,8 @@ public class TextureIO { } return new Texture(gl, data); } - - /** + + /** * Creates an OpenGL texture object from the specified file using * the current OpenGL context. * @@ -474,7 +474,7 @@ public class TextureIO { return texture; } - /** + /** * Creates an OpenGL texture object from the specified stream using * the current OpenGL context. * @@ -503,7 +503,7 @@ public class TextureIO { return texture; } - /** + /** * Creates an OpenGL texture object from the specified URL using the * current OpenGL context. * @@ -535,13 +535,13 @@ public class TextureIO { return texture; } - /** + /** * Creates an OpenGL texture object associated with the given OpenGL * texture target. The texture has * no initial data. This is used, for example, to construct cube * maps out of multiple TextureData objects. * - * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D, + * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D, * GL.GL_TEXTURE_RECTANGLE_ARB */ public static Texture newTexture(int target) { @@ -556,7 +556,7 @@ public class TextureIO { * undefined results. * * @param textureID the OpenGL texture object to wrap - * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D, + * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D, * GL2.GL_TEXTURE_RECTANGLE * @param texWidth the width of the texture in pixels * @param texHeight the height of the texture in pixels @@ -689,7 +689,7 @@ public class TextureIO { gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, packSkipRows); gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels); gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes); - + data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE, false, false, false, res, null); @@ -701,7 +701,7 @@ public class TextureIO { write(data, file); } - + public static void write(TextureData data, File file) throws IOException, GLException { for (Iterator<TextureWriter> iter = textureWriters.iterator(); iter.hasNext(); ) { TextureWriter writer = iter.next(); @@ -712,12 +712,12 @@ public class TextureIO { throw new IOException("No suitable texture writer found for "+file.getAbsolutePath()); } - + //---------------------------------------------------------------------- // SPI support // - /** + /** * Adds a TextureProvider to support reading of a new file format. * <p> * The last provider added, will be the first provider to be tested. @@ -730,7 +730,7 @@ public class TextureIO { textureProviders.add(0, provider); } - /** + /** * Adds a TextureWriter to support writing of a new file format. * <p> * The last provider added, will be the first provider to be tested. @@ -779,7 +779,7 @@ public class TextureIO { private static List<TextureProvider> textureProviders = new ArrayList<TextureProvider>(); private static List<TextureWriter> textureWriters = new ArrayList<TextureWriter>(); - static { + static { // ImageIO provider, the fall-back, must be the first one added if(GLProfile.isAWTAvailable()) { try { @@ -1221,7 +1221,7 @@ public class TextureIO { return null; } } - + //---------------------------------------------------------------------- // DDS texture writer // @@ -1249,7 +1249,7 @@ public class TextureIO { case GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: d3dFormat = DDSImage.D3DFMT_DXT5; break; default: throw new IOException("Unsupported pixel format 0x" + Integer.toHexString(pixelFormat) + " by DDS writer"); } - + ByteBuffer[] mipmaps = null; if (data.getMipmapData() != null) { mipmaps = new ByteBuffer[data.getMipmapData().length]; @@ -1319,7 +1319,7 @@ public class TextureIO { //---------------------------------------------------------------------- // TGA (Targa) texture writer - + static class TGATextureWriter implements TextureWriter { public boolean write(File file, TextureData data) throws IOException { @@ -1329,19 +1329,19 @@ public class TextureIO { final int pixelFormat = pixelAttribs.format; final int pixelType = pixelAttribs.type; if ((pixelFormat == GL.GL_RGB || - pixelFormat == GL.GL_RGBA || + pixelFormat == GL.GL_RGBA || pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { - + ByteBuffer buf = (ByteBuffer) data.getBuffer(); if (null == buf) { buf = (ByteBuffer) data.getMipmapData()[0]; } buf.rewind(); - - if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) { + + if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) { // Must reverse order of red and blue channels to get correct results int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4); for (int i = 0; i < buf.remaining(); i += skip) { @@ -1364,12 +1364,12 @@ public class TextureIO { } return false; - } + } } //---------------------------------------------------------------------- // PNG texture writer - + static class PNGTextureWriter implements TextureWriter { public boolean write(File file, TextureData data) throws IOException { if (PNG.equals(IOUtil.getFileSuffix(file))) { @@ -1402,13 +1402,13 @@ public class TextureIO { break; } if ( ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel) && - ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { + ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { ByteBuffer buf = (ByteBuffer) data.getBuffer(); if (null == buf) { buf = (ByteBuffer) data.getMipmapData()[0]; } buf.rewind(); - + PNGImage image = PNGImage.createFromData(data.getWidth(), data.getHeight(), -1f, -1f, bytesPerPixel, reversedChannels, !data.getMustFlipVertically(), buf); image.write(file, true); @@ -1418,9 +1418,9 @@ public class TextureIO { " / type 0x"+Integer.toHexString(pixelFormat)+" (only GL_RGB/A, GL_BGR/A + bytes)"); } return false; - } + } } - + //---------------------------------------------------------------------- // Helper routines // diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java index 5c6b63535..e4f72abf0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.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. @@ -36,26 +36,26 @@ import com.jogamp.opengl.util.TimeFrameI; /** * Protocol for texture sequences, like animations, movies, etc. * <p> - * Ensure to respect the texture coordinates provided by + * Ensure to respect the texture coordinates provided by * {@link TextureFrame}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getImageTexCoords() getImageTexCoords()}. * </p> - * The user's shader shall be fitted for this implementation. + * The user's shader shall be fitted for this implementation. * Assuming we use a base shader code w/o headers using </code>ShaderCode</code>. * (Code copied from unit test / demo <code>TexCubeES2</code>) * <pre> - * + * static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; static final String gl2_prelude = "#version 110\n"; static final String shaderBasename = "texsequence_xxx"; // the base shader code w/o headers - static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function - + static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function + private void initShader(GL2ES2 gl, TextureSequence texSeq) { // Create & Compile the shader objects - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class, + ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class, "shader", "shader/bin", shaderBasename, true); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class, + ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class, "shader", "shader/bin", shaderBasename, true); - + // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] int rsFpPos; if(gl.isGLES2()) { @@ -72,25 +72,25 @@ import com.jogamp.opengl.util.TimeFrameI; if(gl.isGLES2()) { // insert ES2 default precision declaration rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]); - } + } // negotiate the texture lookup function name final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName); - - // in case a fixed lookup function is being chosen, replace the name in our code + + // in case a fixed lookup function is being chosen, replace the name in our code rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName); - + // Cache the TextureSequence shader details in StringBuilder: final StringBuilder sFpIns = new StringBuilder(); - + // .. declaration of the texture sampler using the implementation specific type sFpIns.append("uniform ").append(texSeq.getTextureSampler2DType()).append(" mgl_ActiveTexture;\n"); - + // .. the actual texture lookup function, maybe null in case a built-in function is being used sFpIns.append(texSeq.getTextureLookupFragmentShaderImpl()); - + // Now insert the TextureShader details in our shader after the given tag: rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns); - + // Create & Link the shader program ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); @@ -102,16 +102,16 @@ import com.jogamp.opengl.util.TimeFrameI; * </pre> * The above procedure might look complicated, however, it allows most flexibility and * workarounds to also deal with GLSL bugs. - * + * */ public interface TextureSequence { public static final String GL_OES_EGL_image_external_Required_Prelude = "#extension GL_OES_EGL_image_external : enable\n"; public static final String samplerExternalOES = "samplerExternalOES"; public static final String sampler2D = "sampler2D"; - - /** + + /** * Texture holder interface, maybe specialized by implementation - * to associated related data. + * to associated related data. */ public static class TextureFrame extends TimeFrameI { public TextureFrame(Texture t, int pts, int duration) { @@ -121,9 +121,9 @@ public interface TextureSequence { public TextureFrame(Texture t) { texture = t; } - + public final Texture getTexture() { return texture; } - + public String toString() { return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ (null != texture ? texture.getTextureObject() : 0) + "]"; } @@ -139,30 +139,30 @@ public interface TextureSequence { * <p> * Further more, the call may happen off-thread, possibly holding another, possibly shared, OpenGL context current. * </p> - * Hence a user shall not issue <i>any</i> OpenGL, time consuming + * Hence a user shall not issue <i>any</i> OpenGL, time consuming * or {@link TextureSequence} lifecycle operations directly.<br> * Instead, the user shall: * <ul> * <li>issue commands off-thread via spawning off another thread, or</li> * <li>injecting {@link GLRunnable} objects via {@link GLAutoDrawable#invoke(boolean, GLRunnable)}, or</li> * <li>simply changing a volatile state of their {@link GLEventListener} implementation.</li> - * </ul> + * </ul> * </p> * */ public interface TexSeqEventListener<T extends TextureSequence> { - /** + /** * Signaling listeners that a new {@link TextureFrame} is available. * <p> - * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain - * a consistent queue. + * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain + * a consistent queue. * </p> - * @param ts the event source + * @param ts the event source * @param newFrame the newly enqueued frame - * @param when system time in msec. + * @param when system time in msec. **/ public void newFrameAvailable(T ts, TextureFrame newFrame, long when); } - + /** Return the texture unit used to render the current frame. */ public int getTextureUnit(); @@ -174,17 +174,17 @@ public interface TextureSequence { * Returns the last updated texture. * <p> * In case the instance is just initialized, it shall return a <code>TextureFrame</code> - * object with valid attributes. The texture content may be undefined + * object with valid attributes. The texture content may be undefined * until the first call of {@link #getNextTexture(GL)}.<br> - * </p> + * </p> * Not blocking. - * - * @throws IllegalStateException if instance is not initialized + * + * @throws IllegalStateException if instance is not initialized */ public TextureFrame getLastTexture() throws IllegalStateException ; /** - * Returns the next texture to be rendered. + * Returns the next texture to be rendered. * <p> * Implementation shall return the next frame if available, may block if a next frame may arrive <i>soon</i>. * Otherwise implementation shall return the last frame. @@ -192,41 +192,41 @@ public interface TextureSequence { * <p> * Shall return <code>null</code> in case <i>no</i> next or last frame is available. * </p> - * - * @throws IllegalStateException if instance is not initialized + * + * @throws IllegalStateException if instance is not initialized */ public TextureFrame getNextTexture(GL gl) throws IllegalStateException ; - + /** - * In case a shader extension is required, based on the implementation + * In case a shader extension is required, based on the implementation * and the runtime GL profile, this method returns the preprocessor macros, e.g.: * <pre> * #extension GL_OES_EGL_image_external : enable - * </pre> - * - * @throws IllegalStateException if instance is not initialized + * </pre> + * + * @throws IllegalStateException if instance is not initialized */ public String getRequiredExtensionsShaderStub() throws IllegalStateException ; - - /** + + /** * Returns either <code>sampler2D</code> or <code>samplerExternalOES</code> - * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}. - * - * @throws IllegalStateException if instance is not initialized + * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}. + * + * @throws IllegalStateException if instance is not initialized **/ public String getTextureSampler2DType() throws IllegalStateException ; - + /** * @param desiredFuncName desired lookup function name. If <code>null</code> or ignored by the implementation, - * a build-in name is returned. + * a build-in name is returned. * @return the final lookup function name - * + * * @see {@link #getTextureLookupFragmentShaderImpl()} - * + * * @throws IllegalStateException if instance is not initialized */ public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException ; - + /** * Returns the complete texture2D lookup function code of type * <pre> @@ -239,14 +239,14 @@ public interface TextureSequence { * <i>funcName</i> can be negotiated and queried via {@link #getTextureLookupFunctionName(String)}. * </p> * Note: This function may return an empty string in case a build-in lookup - * function is being chosen. If the implementation desires so, + * function is being chosen. If the implementation desires so, * {@link #getTextureLookupFunctionName(String)} will ignore the desired function name * and returns the build-in lookup function name. * </p> * @see #getTextureLookupFunctionName(String) * @see #getTextureSampler2DType() - * - * @throws IllegalStateException if instance is not initialized + * + * @throws IllegalStateException if instance is not initialized */ - public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ; + public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java index 4a5d368e3..c8437d07c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java @@ -43,55 +43,55 @@ import javax.media.opengl.GLException; * - GL.GL_TEXTURE_MAG_FILTER * - GL.GL_TEXTURE_MIN_FILTER * - GL.GL_TEXTURE_WRAP_S - * - GL.GL_TEXTURE_WRAP_T + * - GL.GL_TEXTURE_WRAP_T * </pre> */ public class TextureState { - /** + /** * Returns the <code>pname</code> to query the <code>textureTarget</code> currently bound to the active texture-unit. * <p> * Returns <code>0</code> is <code>textureTarget</code> is not supported. - * </p> - */ + * </p> + */ public static final int getTextureTargetQueryName(int textureTarget) { final int texBindQName; switch(textureTarget) { - case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break; - case GL.GL_TEXTURE_CUBE_MAP: texBindQName = GL.GL_TEXTURE_BINDING_CUBE_MAP; break; - case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break; - case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break; - case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break; - case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break; - case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break; - case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break; - case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; + case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break; + case GL.GL_TEXTURE_CUBE_MAP: texBindQName = GL.GL_TEXTURE_BINDING_CUBE_MAP; break; + case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break; + case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break; + case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break; + case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break; + case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break; + case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break; + case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; case GL3.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break; default: texBindQName = 0; } return texBindQName; } - + private final int target; - /** + /** * <pre> * 0 - unit * 1 - texture object * 2 - GL.GL_TEXTURE_MAG_FILTER * 3 - GL.GL_TEXTURE_MIN_FILTER * 4 - GL.GL_TEXTURE_WRAP_S - * 5 - GL.GL_TEXTURE_WRAP_T + * 5 - GL.GL_TEXTURE_WRAP_T * </pre> */ private final int[] state = new int[] { 0, 0, 0, 0, 0, 0 }; - + private static final String toHexString(int i) { return "0x"+Integer.toHexString(i); } - + private static final int activeTexture(GL gl) { final int[] vi = { 0 }; gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, vi, 0); return vi[0]; } - + /** * Creates a texture state for the retrieved active texture-unit and the given texture-target. * See {@link TextureState}. @@ -102,7 +102,7 @@ public class TextureState { public TextureState(GL gl, int textureTarget) throws GLException { this(gl, activeTexture(gl), textureTarget); } - + /** * Creates a texture state for the given active texture-unit and the given texture-target. * See {@link TextureState}. @@ -124,7 +124,7 @@ public class TextureState { gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_S, state, 4); gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_T, state, 5); } - + /** * Restores the texture-unit's texture-target state. * <p> @@ -140,12 +140,12 @@ public class TextureState { gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, state[4]); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, state[5]); } - + /** Returns the texture-unit of this state, key value. Unit is of range [ {@link GL#GL_TEXTURE0}.. ]. */ public final int getUnit() { return state[0]; } /** Returns the texture-target of this state, key value. */ public final int getTarget() { return target; } - + /** Returns the state's texture-object. */ public final int getObject() { return state[1]; } /** Returns the state's mag-filter param. */ @@ -156,12 +156,12 @@ public class TextureState { public final int getWrapS() { return state[4]; } /** Returns the state's wrap-t param. */ public final int getWrapT() { return state[5]; } - - + + public final String toString() { return "TextureState[unit "+(state[0] - GL.GL_TEXTURE0)+", target "+toHexString(target)+ ": obj "+toHexString(state[1])+ - ", filter[mag "+toHexString(state[2])+", min "+toHexString(state[3])+"], "+ + ", filter[mag "+toHexString(state[2])+", min "+toHexString(state[3])+"], "+ ": wrap[s "+toHexString(state[4])+", t "+toHexString(state[5])+"]]"; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index d7e825c1d..202c08e4e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. @@ -80,7 +80,7 @@ public class AWTTextureData extends TextureData { private static final java.awt.image.ColorModel rgbaColorModel = new ComponentColorModel(java.awt.color.ColorSpace.getInstance(java.awt.color.ColorSpace.CS_sRGB), - new int[] {8, 8, 8, 8}, true, true, + new int[] {8, 8, 8, 8}, true, true, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); private static final java.awt.image.ColorModel rgbColorModel = @@ -90,7 +90,7 @@ public class AWTTextureData extends TextureData { DataBuffer.TYPE_BYTE); - /** + /** * Constructs a new TextureData object with the specified parameters * and data contained in the given BufferedImage. The resulting * TextureData "wraps" the contents of the BufferedImage, so if a @@ -113,7 +113,7 @@ public class AWTTextureData extends TextureData { * texture * @param image the image containing the texture data */ - public AWTTextureData(GLProfile glp, + public AWTTextureData(GLProfile glp, int internalFormat, int pixelFormat, boolean mipmap, @@ -142,15 +142,15 @@ public class AWTTextureData extends TextureData { (expectingGL12 && haveGL12))) { revertPixelAttributes(); } - } + } } - + @Override public GLPixelAttributes getPixelAttributes() { validatePixelAttributes(); return super.getPixelAttributes(); } - + @Override public int getPixelFormat() { validatePixelAttributes(); @@ -246,7 +246,7 @@ public class AWTTextureData extends TextureData { // we can pass the image data directly to OpenGL only if // we have an integral number of pixels in each scanline // and only if the GL_EXT_abgr extension is present - + // NOTE: disabling this code path for now as it appears it's // buggy at least on some NVidia drivers and doesn't perform // the necessary byte swapping (FIXME: needs more @@ -255,7 +255,7 @@ public class AWTTextureData extends TextureData { pixelAttributes = new GLPixelAttributes(GL2.GL_ABGR_EXT, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 4; alignment = 4; - + // Store a reference to the original image for later in // case it turns out that we don't have GL_EXT_abgr at the // time we're going to do the texture upload to OpenGL diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java index fdd1365f7..c70f5d0f3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -100,7 +100,7 @@ public class AWTTextureIO extends TextureIO { return newTextureDataImpl(glp, image, internalFormat, pixelFormat, mipmap); } - /** + /** * Creates an OpenGL texture object from the specified BufferedImage * using the current OpenGL context. * @@ -119,7 +119,7 @@ public class AWTTextureIO extends TextureIO { return texture; } - private static TextureData newTextureDataImpl(GLProfile glp, + private static TextureData newTextureDataImpl(GLProfile glp, BufferedImage image, int internalFormat, int pixelFormat, diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java index 3f91ae966..d75bb3767 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -166,7 +166,7 @@ public class DDSImage { public static DDSImage read(String filename) throws IOException { return read(new File(filename)); } - + /** Reads a DirectDraw surface from the specified file, returning the resulting DDSImage. @@ -212,7 +212,7 @@ public class DDSImage { } } - /** + /** * Creates a new DDSImage from data supplied by the user. The * resulting DDSImage can be written to disk using the write() * method. @@ -763,7 +763,7 @@ public class DDSImage { default: throw new IllegalArgumentException("d3dFormat must be one of the known formats"); } - + // Now check the mipmaps against this size int curSize = topmostMipmapSize; int totalSize = 0; @@ -785,7 +785,7 @@ public class DDSImage { buf.put(mipmapData[i]); } this.buf = buf; - + // Allocate and initialize a Header header = new Header(); header.size = Header.size(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java index 4d3d088ba..471938754 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.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. @@ -40,12 +40,12 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.texture.TextureData.ColorSpace; public class JPEGImage { - private static final boolean DEBUG = Debug.debug("JPEGImage"); - - + private static final boolean DEBUG = Debug.debug("JPEGImage"); + + /** * Reads a JPEG image from the specified InputStream, using the given color space for storage. - * + * * @param in * @param cs Storage color space, either {@link ColorSpace#RGB} or {@link ColorSpace#YCbCr}. {@link ColorSpace#YCCK} and {@link ColorSpace#CMYK} will throw an exception! * @return @@ -54,12 +54,12 @@ public class JPEGImage { public static JPEGImage read(InputStream in, ColorSpace cs) throws IOException { return new JPEGImage(in, cs); } - + /** Reads a JPEG image from the specified InputStream, using the {@link ColorSpace#RGB}. */ public static JPEGImage read(InputStream in) throws IOException { return new JPEGImage(in, ColorSpace.RGB); } - + private static class JPEGColorSink implements JPEGDecoder.ColorSink { int width=0, height=0; int sourceComponents=0; @@ -67,7 +67,7 @@ public class JPEGImage { int storageComponents; final ColorSpace storageCS; ByteBuffer data = null; - + JPEGColorSink(ColorSpace storageCM) { this.storageCS = storageCM; switch(storageCS) { @@ -79,7 +79,7 @@ public class JPEGImage { throw new IllegalArgumentException("Unsupported storage color-space: "+storageCS); } } - + @Override public final ColorSpace allocate(int width, int height, ColorSpace sourceCM, int sourceComponents) throws RuntimeException { this.width = width; @@ -96,7 +96,7 @@ public class JPEGImage { data.put(i++, r); data.put(i++, g); data.put(i++, b); - // data.put(i++, (byte)0xff); + // data.put(i++, (byte)0xff); } @Override @@ -111,12 +111,12 @@ public class JPEGImage { data.put(i++, Cb); data.put(i++, Cr); } - + public String toString() { return "JPEGPixels["+width+"x"+height+", sourceComp "+sourceComponents+", sourceCS "+sourceCS+", storageCS "+storageCS+", storageComp "+storageComponents+"]"; } }; - + private JPEGImage(InputStream in, ColorSpace cs) throws IOException { pixelStorage = new JPEGColorSink(cs); final JPEGDecoder decoder = new JPEGDecoder(); @@ -126,7 +126,7 @@ public class JPEGImage { decoder.getPixel(pixelStorage, pixelWidth, pixelHeight); data = pixelStorage.data; final boolean hasAlpha = false; - + bytesPerPixel = 3; glFormat = GL.GL_RGB; reversedChannels = false; // RGB[A] @@ -142,7 +142,7 @@ public class JPEGImage { private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel; private boolean reversedChannels; private final ByteBuffer data; - + /** Returns the color space of the pixel data */ public ColorSpace getColorSpace() { return pixelStorage.storageCS; } @@ -157,10 +157,10 @@ public class JPEGImage { /** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */ public boolean getHasReversedChannels() { return reversedChannels; } - + /** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */ public int getGLFormat() { return glFormat; } - + /** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */ public int getGLType() { return GL.GL_UNSIGNED_BYTE; } @@ -170,6 +170,6 @@ public class JPEGImage { /** Returns the raw data for this texture in the correct (bottom-to-top) order for calls to glTexImage2D. */ public ByteBuffer getData() { return data; } - + public String toString() { return "JPEGImage["+pixelWidth+"x"+pixelHeight+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+pixelStorage+", "+data+"]"; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java index b7262aa3e..4020ab3c0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -148,7 +148,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput } public final int readUnsignedShort() throws IOException - { + { int ch1 = dataIn.read(); int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) @@ -195,7 +195,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput /** * dont call this it is not implemented. - * @return empty new string + * @return empty new string **/ public final String readLine() throws IOException { @@ -204,7 +204,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput /** * dont call this it is not implemented - * @return empty new string + * @return empty new string **/ public final String readUTF() throws IOException { @@ -213,7 +213,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput /** * dont call this it is not implemented - * @return empty new string + * @return empty new string **/ public final static String readUTF(DataInput in) throws IOException { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java index e1e1ca924..a7101a576 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java index cd42a1157..43b8eebe6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -87,8 +87,8 @@ public class NetPbmTextureWriter implements TextureWriter { public boolean write(File file, TextureData data) throws IOException { boolean res; final int magic_old = magic; - - // file suffix selection + + // file suffix selection if (0==magic) { if (PPM.equals(IOUtil.getFileSuffix(file))) { magic = 6; @@ -97,7 +97,7 @@ public class NetPbmTextureWriter implements TextureWriter { } else { return false; } - } + } try { res = writeImpl(file, data); } finally { @@ -105,7 +105,7 @@ public class NetPbmTextureWriter implements TextureWriter { } return res; } - + private boolean writeImpl(File file, TextureData data) throws IOException { int pixelFormat = data.getPixelFormat(); final int pixelType = data.getPixelType(); @@ -115,16 +115,16 @@ public class NetPbmTextureWriter implements TextureWriter { pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { - + ByteBuffer buf = (ByteBuffer) data.getBuffer(); if (null == buf ) { buf = (ByteBuffer) data.getMipmapData()[0]; } buf.rewind(); - + int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; - - if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) { + + if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) { // Must reverse order of red and blue channels to get correct results for (int i = 0; i < buf.remaining(); i += comps) { byte red = buf.get(i + 0); @@ -141,7 +141,7 @@ public class NetPbmTextureWriter implements TextureWriter { } FileOutputStream fos = IOUtil.getFileOutputStream(file, true); - + StringBuilder header = new StringBuilder(); header.append("P"); header.append(magic); @@ -171,7 +171,7 @@ public class NetPbmTextureWriter implements TextureWriter { } fos.write(header.toString().getBytes()); - + FileChannel fosc = fos.getChannel(); fosc.write(buf); fosc.force(true); @@ -180,7 +180,7 @@ public class NetPbmTextureWriter implements TextureWriter { buf.rewind(); return true; - } + } throw new IOException("NetPbmTextureWriter writer doesn't support this pixel format / type (only GL_RGB/A + bytes)"); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java index 0f4559036..bfde1bfac 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.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. @@ -51,15 +51,15 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; public class PNGImage { - private static final boolean DEBUG = Debug.debug("PNGImage"); - + private static final boolean DEBUG = Debug.debug("PNGImage"); + /** * Creates a PNGImage from data supplied by the end user. Shares * data with the passed ByteBuffer. Assumes the data is already in * the correct byte order for writing to disk, i.e., LUMINANCE, RGB or RGBA. * Orientation is <i>bottom-to-top</i> (OpenGL coord. default) * or <i>top-to-bottom</i> depending on <code>isGLOriented</code>. - * + * * @param width * @param height * @param dpiX @@ -74,17 +74,17 @@ public class PNGImage { int bytesPerPixel, boolean reversedChannels, boolean isGLOriented, ByteBuffer data) { return new PNGImage(width, height, dpiX, dpiY, bytesPerPixel, reversedChannels, isGLOriented, data); } - - /** + + /** * Reads a PNG image from the specified InputStream. * <p> * Implicitly flip image to GL orientation, see {@link #isGLOriented()}. - * </p> + * </p> */ public static PNGImage read(InputStream in) throws IOException { return new PNGImage(in); } - + /** Reverse read and store, implicitly flip image to GL orientation, see {@link #isGLOriented()}. */ private static final int getPixelRGBA8(ByteBuffer d, int dOff, int[] scanline, int lineOff, boolean hasAlpha) { final int b = hasAlpha ? 4-1 : 3-1; @@ -95,11 +95,11 @@ public class PNGImage { d.put(dOff--, (byte)scanline[lineOff + 3]); // A } d.put(dOff--, (byte)scanline[lineOff + 2]); // B - d.put(dOff--, (byte)scanline[lineOff + 1]); // G + d.put(dOff--, (byte)scanline[lineOff + 1]); // G d.put(dOff--, (byte)scanline[lineOff ]); // R return dOff; } - + /** Reverse write and store, implicitly flip image from current orientation, see {@link #isGLOriented()}. Handle reversed channels (BGR[A]). */ private int setPixelRGBA8(ImageLine line, int lineOff, ByteBuffer d, int dOff, boolean hasAlpha) { final int b = hasAlpha ? 4-1 : 3-1; @@ -138,9 +138,9 @@ public class PNGImage { this.bytesPerPixel = bytesPerPixel; this.reversedChannels = reversedChannels; this.isGLOriented = isGLOriented; - this.data = data; + this.data = data; } - + private PNGImage(InputStream in) { final PngReader pngr = new PngReader(new BufferedInputStream(in), null); final ImageInfo imgInfo = pngr.imgInfo; @@ -148,12 +148,12 @@ public class PNGImage { final PngChunkTRNS trns = pngr.getMetadata().getTRNS(); final boolean indexed = imgInfo.indexed; final boolean hasAlpha = indexed ? ( trns != null ) : imgInfo.alpha ; - + final int channels = indexed ? ( hasAlpha ? 4 : 3 ) : imgInfo.channels ; if ( ! ( 1 == channels || 3 == channels || 4 == channels ) ) { throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 channels] images for now. Channels "+channels + " Paletted: " + indexed); } - + bytesPerPixel = indexed ? channels : imgInfo.bytesPixel ; if ( ! ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel ) ) { throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now. BytesPerPixel "+bytesPerPixel); @@ -189,14 +189,14 @@ public class PNGImage { ", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+ ", pixels "+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+"x"+dpi[1]+", glFormat 0x"+Integer.toHexString(glFormat)); } - + data = Buffers.newDirectByteBuffer(bytesPerPixel * pixelWidth * pixelHeight); reversedChannels = false; // RGB[A] isGLOriented = true; int dataOff = bytesPerPixel * pixelWidth * pixelHeight - 1; // start at end-of-buffer, reverse store int[] rgbaScanline = indexed ? new int[imgInfo.cols * channels] : null; - + for (int row = 0; row < pixelHeight; row++) { final ImageLine l1 = pngr.readRow(row); int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse read (PNG top-left -> OpenGL bottom-left origin) @@ -224,7 +224,7 @@ public class PNGImage { private final boolean isGLOriented; private final double[] dpi; private final ByteBuffer data; - + /** Returns the width of the image. */ public int getWidth() { return pixelWidth; } @@ -233,23 +233,23 @@ public class PNGImage { /** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */ public boolean getHasReversedChannels() { return reversedChannels; } - + /** - * Returns <code>true</code> if the drawable is rendered in + * Returns <code>true</code> if the drawable is rendered in * OpenGL's coordinate system, <i>origin at bottom left</i>. * Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>. * <p> * Default impl. is <code>true</code>, i.e. OpenGL coordinate system. - * </p> + * </p> */ public boolean isGLOriented() { return isGLOriented; } - + /** Returns the dpi of the image. */ public double[] getDpi() { return dpi; } - + /** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */ public int getGLFormat() { return glFormat; } - + /** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */ public int getGLType() { return GL.GL_UNSIGNED_BYTE; } @@ -260,12 +260,12 @@ public class PNGImage { (bottom-to-top) order for calls to glTexImage2D. */ public ByteBuffer getData() { return data; } - public void write(File out, boolean allowOverwrite) throws IOException { - final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha + public void write(File out, boolean allowOverwrite) throws IOException { + final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha // open image for writing to a output stream final OutputStream outs = new BufferedOutputStream(IOUtil.getFileOutputStream(out, allowOverwrite)); try { - final PngWriter png = new PngWriter(outs, imi); + final PngWriter png = new PngWriter(outs, imi); // add some optional metadata (chunks) png.getMetadata().setDpi(dpi[0], dpi[1]); png.getMetadata().setTimeNow(0); // 0 seconds fron now = now @@ -275,7 +275,7 @@ public class PNGImage { final ImageLine l1 = new ImageLine(imi); if( isGLOriented ) { // start at last pixel at end-of-buffer, reverse read (OpenGL bottom-left -> PNG top-left origin) - int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line + int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line ( ( pixelWidth - 1 ) * bytesPerPixel ); // one line - 1 pixel for (int row = 0; row < pixelHeight; row++) { int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse store (OpenGL bottom-left -> PNG top-left origin) @@ -306,13 +306,13 @@ public class PNGImage { } } png.writeRow(l1, row); - } + } } png.end(); } finally { IOUtil.close(outs, false); } } - - public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; } + + public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java index d35330f58..fd96fba80 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java @@ -1,21 +1,21 @@ /* * Portions Copyright (c) 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. */ @@ -72,15 +72,15 @@ public class SGIImage { byte storage; // Storage format // 0 for uncompressed // 1 for RLE compression - byte bpc; // Number of bytes per pixel channel + byte bpc; // Number of bytes per pixel channel // Legally 1 or 2 short dimension; // Number of dimensions // Legally 1, 2, or 3 // 1 means a single row, XSIZE long // 2 means a single 2D image // 3 means multiple 2D images - short xsize; // X size in pixels - short ysize; // Y size in pixels + short xsize; // X size in pixels + short ysize; // Y size in pixels short zsize; // Number of channels // 1 indicates greyscale // 3 indicates RGB @@ -233,7 +233,7 @@ public class SGIImage { //---------------------------------------------------------------------- // Internals only below this point // - + private void decodeImage(DataInputStream in) throws IOException { if (header.storage == 1) { // Read RLE compression data; row starts and sizes @@ -478,7 +478,7 @@ public class SGIImage { for (int z = 0; z < zsize; z++) { for (int y = ystart; y != yend; y += yincr) { // RLE-compress each row. - + int x = 0; byte count = 0; boolean repeat_mode = false; @@ -486,7 +486,7 @@ public class SGIImage { int start_ptr = ptr; int num_ptr = ptr++; byte repeat_val = 0; - + while (x < xsize) { // see if we should switch modes should_switch = false; @@ -503,7 +503,7 @@ public class SGIImage { if (DEBUG) System.err.println("left side was " + ((int) imgref(data, x, y, z, xsize, ysize, zsize)) + ", right side was " + (int)imgref(data, x+i, y, z, xsize, ysize, zsize)); - + if (imgref(data, x, y, z, xsize, ysize, zsize) != imgref(data, x+i, y, z, xsize, ysize, zsize)) should_switch = false; @@ -531,7 +531,7 @@ public class SGIImage { repeat_mode = true; repeat_val = imgref(data, x, y, z, xsize, ysize, zsize); } - + if (x > 0) { // reset the number pointer num_ptr = ptr++; @@ -539,7 +539,7 @@ public class SGIImage { count = 0; } } - + // if not in repeat mode, copy element to ptr if (!repeat_mode) { rlebuf[ptr++] = imgref(data, x, y, z, xsize, ysize, zsize); @@ -581,8 +581,8 @@ public class SGIImage { // Now we have the offset tables computed, as well as the RLE data. // Output this information to the file. total_size = ptr; - - if (DEBUG) + + if (DEBUG) System.err.println("total_size was " + total_size); DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true))); @@ -604,7 +604,7 @@ public class SGIImage { byte[] dest = new byte[16384]; int pos = 0; int numRead = 0; - + boolean done = false; do { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java index 2ff3b9cf0..df9430a26 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.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. */ @@ -146,9 +146,9 @@ public class TGAImage { tgaType = TYPE_OLD; // dont try and get footer. // initial header fields - idLength = in.readUnsignedByte(); + idLength = in.readUnsignedByte(); colorMapType = in.readUnsignedByte(); - imageType = in.readUnsignedByte(); + imageType = in.readUnsignedByte(); // color map header fields firstEntryIndex = in.readUnsignedShort(); @@ -288,14 +288,14 @@ public class TGAImage { throw new IOException("TGADecoder Compressed Grayscale images not supported"); } } - + /** * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ private void decodeRGBImageU24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { setupImage24_32(glp); - + int i; // row index int y; // output row index int rawWidth = header.width() * bpp; @@ -317,14 +317,14 @@ public class TGAImage { swapBGR(tmpData, rawWidth, header.height(), bpp); data = ByteBuffer.wrap(tmpData); } - + /** * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ private void decodeRGBImageRLE24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { setupImage24_32(glp); - + byte[] pixel = new byte[bpp]; int rawWidth = header.width() * bpp; byte[] tmpData = new byte[rawWidth * header.height()]; @@ -341,17 +341,17 @@ public class TGAImage { dIn.read(tmpData, i, len * bpp); i += bpp * len; } - + if(format == GL.GL_RGB || format == GL.GL_RGBA) swapBGR(tmpData, rawWidth, header.height(), bpp); data = ByteBuffer.wrap(tmpData); } - + private void setupImage24_32(GLProfile glp) { bpp = header.pixelDepth / 8; switch (header.pixelDepth) { - case 24: - format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB; + case 24: + format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB; break; case 32: boolean useBGRA = glp.isGL2GL3(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java index 88018edbe..0299531b1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java index 55527cef5..35b8efa72 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java index 6e2f1b992..f23cb74bf 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java index 89d0d20a1..438ab6cc2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -113,7 +113,7 @@ public class IIOTextureWriter implements TextureWriter { return ImageIO.write(image, IOUtil.getFileSuffix(file), file); } - + throw new IOException("ImageIO writer doesn't support this pixel format / type (only GL_RGB/A + bytes)"); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java index 05bcf3d5e..3c064a18f 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL2.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL2.java @@ -10,7 +10,7 @@ package javax.media.opengl; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new DebugGL(drawable.getGL())); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java index c17f90667..b490a63f4 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3.java @@ -10,7 +10,7 @@ package javax.media.opengl; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new DebugGL(drawable.getGL())); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java index 6e294d42b..1d42afbc6 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java @@ -10,7 +10,7 @@ package javax.media.opengl; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new DebugGL(drawable.getGL())); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java index d21d39390..249d850a3 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL4.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL4.java @@ -10,7 +10,7 @@ package javax.media.opengl; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new DebugGL(drawable.getGL())); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java index dee363c1b..6d666d82a 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java +++ b/src/jogl/classes/javax/media/opengl/DebugGLES2.java @@ -10,7 +10,7 @@ package javax.media.opengl; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new DebugGL(drawable.getGL())); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java index b0f3da8e4..7e243471e 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-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,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. */ @@ -91,7 +91,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); } - + private final static int NO_SCORE = -9999999; private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; private final static int OPAQUE_MISMATCH_PENALTY = 750; @@ -106,7 +106,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { private final static int ACCUM_MISMATCH_PENALTY_SCALE = 1; private final static int STENCIL_MISMATCH_PENALTY_SCALE = 3; private final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3; - + @Override public int chooseCapabilities(final CapabilitiesImmutable desired, final List<? extends CapabilitiesImmutable> available, @@ -143,12 +143,12 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { // Create score array int[] scores = new int[availnum]; - + for (int i = 0; i < scores.length; i++) { scores[i] = NO_SCORE; } final int gldes_samples = gldes.getNumSamples(); - + // Compute score for each for (int i = 0; i < availnum; i++) { final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); @@ -165,24 +165,24 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { } */ if (gldes.isPBuffer() && !cur.isPBuffer()) { continue; // requested pBuffer, but n/a - } + } if (gldes.isBitmap() && !cur.isBitmap()) { continue; // requested pBuffer, but n/a - } + } } if (gldes.getStereo() != cur.getStereo()) { continue; } final int cur_samples = cur.getNumSamples() ; int score = 0; - + // Compute difference in color depth // (Note that this decides the direction of all other penalties) score += (COLOR_MISMATCH_PENALTY_SCALE * ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - (gldes.getRedBits() + gldes.getGreenBits() + gldes.getBlueBits() + gldes.getAlphaBits()))); // Compute difference in depth buffer depth - score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * + score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * Math.abs(cur.getDepthBits() - gldes.getDepthBits())); // Compute difference in accumulation buffer depth score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * @@ -261,7 +261,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { System.err.println(" ]"); } - // Ready to select. Choose score closest to 0. + // Ready to select. Choose score closest to 0. int scoreClosestToZero = NO_SCORE; int chosenIndex = -1; for (int i = 0; i < availnum; i++) { diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/javax/media/opengl/FPSCounter.java index 9c07b58e4..4997258e0 100644 --- a/src/jogl/classes/javax/media/opengl/FPSCounter.java +++ b/src/jogl/classes/javax/media/opengl/FPSCounter.java @@ -36,28 +36,28 @@ import java.io.PrintStream; */ public interface FPSCounter { public static final int DEFAULT_FRAMES_PER_INTERVAL = 5*60; - + /** - * @param frames Update interval in frames.<br> At every rendered <i>frames</i> interval the currentTime and fps values are updated. + * @param frames Update interval in frames.<br> At every rendered <i>frames</i> interval the currentTime and fps values are updated. * If the <i>frames</i> interval is <= 0, no update will be issued, ie the FPSCounter feature is turned off. You may choose {@link #DEFAULT_FRAMES_PER_INTERVAL}. - * @param out optional print stream where the fps values gets printed if not null at every <i>frames</i> interval + * @param out optional print stream where the fps values gets printed if not null at every <i>frames</i> interval */ void setUpdateFPSFrames(int frames, PrintStream out); - + /** * Reset all performance counter (startTime, currentTime, frame number) */ void resetFPSCounter(); - + /** * @return update interval in frames - * + * * @see #setUpdateFPSFrames(int, PrintStream) */ int getUpdateFPSFrames(); - + /** - * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.<br> + * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.<br> * This value is reset via {@link #resetFPSCounter()}. * * @see #setUpdateFPSFrames(int, PrintStream) @@ -81,18 +81,18 @@ public interface FPSCounter { * @see #resetFPSCounter() */ long getLastFPSPeriod(); - + /** * @return Last update interval's frames per seconds, {@link #getUpdateFPSFrames()} / {@link #getLastFPSPeriod()} - * + * * @see #setUpdateFPSFrames(int, PrintStream) * @see #resetFPSCounter() */ - float getLastFPS(); - + float getLastFPS(); + /** * @return Number of frame rendered since {@link #getFPSStartTime()} up to {@link #getLastFPSUpdateTime()} - * + * * @see #setUpdateFPSFrames(int, PrintStream) * @see #resetFPSCounter() */ @@ -108,10 +108,10 @@ public interface FPSCounter { /** - * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()} - * + * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()} + * * @see #setUpdateFPSFrames(int, PrintStream) * @see #resetFPSCounter() */ - float getTotalFPS(); + float getTotalFPS(); } diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java index a72403eae..827145654 100644 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java @@ -29,7 +29,7 @@ package javax.media.opengl; /** - * An animator control interface, + * An animator control interface, * which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation. */ public interface GLAnimatorControl extends FPSCounter { @@ -56,8 +56,8 @@ public interface GLAnimatorControl extends FPSCounter { boolean isAnimating(); /** - * Indicates whether this animator {@link #isStarted() is started} - * and either {@link #pause() manually paused} or paused + * Indicates whether this animator {@link #isStarted() is started} + * and either {@link #pause() manually paused} or paused * automatically due to no {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable}s. * * @see #start() @@ -157,15 +157,15 @@ public interface GLAnimatorControl extends FPSCounter { /** * Adds a drawable to this animator's list of rendering drawables. * <p> - * This allows the animator thread to become {@link #isAnimating() animating}, + * This allows the animator thread to become {@link #isAnimating() animating}, * in case the first drawable is added and the animator {@link #isStarted() is started}. * </p> - * + * * @param drawable the drawable to be added * @throws IllegalArgumentException if drawable was already added to this animator */ void add(GLAutoDrawable drawable); - + /** * Removes a drawable from the animator's list of rendering drawables. * <p> @@ -173,10 +173,10 @@ public interface GLAnimatorControl extends FPSCounter { * and will not be recovered. * </p> * <p> - * This allows the animator thread to become {@link #isAnimating() not animating}, + * This allows the animator thread to become {@link #isAnimating() not animating}, * in case the last drawable has been removed. * </p> - * + * * @param drawable the drawable to be removed * @throws IllegalArgumentException if drawable was not added to this animator */ diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java index 8e1383031..4025170cf 100644 --- a/src/jogl/classes/javax/media/opengl/GLArrayData.java +++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java @@ -43,7 +43,7 @@ public interface GLArrayData { * Implementation and type dependent object association. * <p> * One currently known use case is to associate a {@link com.jogamp.opengl.util.glsl.ShaderState ShaderState} - * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's + * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's * data persistence, location and state change.<br/> * This is implicitly done via {@link com.jogamp.opengl.util.glsl.ShaderState#ownAttribute(GLArrayData, boolean) shaderState.ownAttribute(GLArrayData, boolean)}. * </p> @@ -51,7 +51,7 @@ public interface GLArrayData { * @param enable pass true to enable the association and false to disable it. */ public void associate(Object obj, boolean enable); - + /** * Returns true if this data set is intended for a GLSL vertex shader attribute, * otherwise false, ie intended for fixed function vertex pointer @@ -110,7 +110,7 @@ public interface GLArrayData { * <0 denotes an invalid location, i.e. not found or used in the given shader program. */ public int setLocation(GL2ES2 gl, int program); - + /** * Binds the location of the shader attribute to the given location for the unlinked shader program. * <p> @@ -121,7 +121,7 @@ public interface GLArrayData { * @return the given location */ public int setLocation(GL2ES2 gl, int program, int location); - + /** * Determines whether the data is server side (VBO) and enabled, * or a client side array (false). @@ -150,7 +150,7 @@ public interface GLArrayData { */ public int getVBOTarget(); - + /** * The Buffer holding the data, may be null if a GPU buffer without client bound data */ @@ -179,7 +179,7 @@ public interface GLArrayData { * In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position. */ public int getElementCount(); - + /** * The currently used size in bytes.<br> * In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position. @@ -187,18 +187,18 @@ public interface GLArrayData { public int getSizeInBytes(); /** - * True, if GL shall normalize fixed point data while converting + * True, if GL shall normalize fixed point data while converting * them into float. - * <p> + * <p> * Default behavior (of the fixed function pipeline) is <code>true</code> * for fixed point data type and <code>false</code> for floating point data types. * </p> */ public boolean getNormalized(); - /** + /** * @return the byte offset between consecutive components - */ + */ public int getStride(); public String toString(); diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index 989a61aaf..38824ce8f 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -50,8 +50,8 @@ import jogamp.opengl.Debug; rendering context which is associated with the GLAutoDrawable for the lifetime of the object. <p> - Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent} - implementation is synchronized, i.e. blocks if the context + Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent} + implementation is synchronized, i.e. blocks if the context is current on another thread, the internal {@link GLContext} for the GLAutoDrawable can be used for the event based rendering mechanism and by end users directly. @@ -123,7 +123,7 @@ public interface GLAutoDrawable extends GLDrawable { * otherwise return <code>this</code> instance. */ public GLDrawable getDelegatedDrawable(); - + /** * Returns the context associated with this drawable. The returned * context will be synchronized. @@ -135,38 +135,38 @@ public interface GLAutoDrawable extends GLDrawable { * Associate the new context, <code>newtCtx</code>, to this auto-drawable. * <p> * The current context will be destroyed if <code>destroyPrevCtx</code> is <code>true</code>, - * otherwise it will be dis-associated from this auto-drawable + * otherwise it will be dis-associated from this auto-drawable * via {@link GLContext#setGLDrawable(GLDrawable, boolean) setGLDrawable(null, true);} first. * </p> * <p> - * The new context will be associated with this auto-drawable + * The new context will be associated with this auto-drawable * 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 association. - * The new context will be made current afterwards, if it was current before. + * The new context will be made current afterwards, if it was current before. * However the user shall take extra care that no other thread * attempts to make this context current. * </p> - * + * * @param newCtx the new context, maybe <code>null</code> for dis-association. - * @param destroyPrevCtx if <code>true</code>, destroy the previous context if exists + * @param destroyPrevCtx if <code>true</code>, destroy the previous context if exists * @return the previous GLContext, maybe <code>null</code> - * + * * @see GLContext#setGLDrawable(GLDrawable, boolean) * @see GLContext#setGLReadDrawable(GLDrawable) * @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, boolean, GLContext, int) */ public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx); - + /** * Adds the given {@link GLEventListener listener} to the end of this drawable queue. * The {@link GLEventListener listeners} are notified of events in the order of the queue. * <p> - * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} + * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} * method will be called once before any other of it's callback methods. * See {@link #getGLEventListenerInitState(GLEventListener)} for details. - * </p> + * </p> * @param listener The GLEventListener object to be inserted */ public void addGLEventListener(GLEventListener listener); @@ -175,10 +175,10 @@ public interface GLAutoDrawable extends GLDrawable { * Adds the given {@link GLEventListener listener} at the given index of this drawable queue. * The {@link GLEventListener listeners} are notified of events in the order of the queue. * <p> - * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} + * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} * method will be called once before any other of it's callback methods. * See {@link #getGLEventListenerInitState(GLEventListener)} for details. - * </p> + * </p> * @param index Position where the listener will be inserted. * Should be within (0 <= index && index <= size()). * An index value of -1 is interpreted as the end of the list, size(). @@ -192,7 +192,7 @@ public interface GLAutoDrawable extends GLDrawable { * @return The number of GLEventListener objects of this drawable queue. */ public int getGLEventListenerCount(); - + /** * Returns the {@link GLEventListener} at the given index of this drawable queue. * @param index Position of the listener to be returned. @@ -202,18 +202,18 @@ public interface GLAutoDrawable extends GLDrawable { * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index < size()), or -1 */ public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException; - + /** * Retrieves whether the given {@link GLEventListener listener} is initialized or not. * <p> - * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is + * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is * marked <i>uninitialized</i> and added to a list of to be initialized {@link GLEventListener}. - * If such <i>uninitialized</i> {@link GLEventListener}'s handler methods (reshape, display) + * If such <i>uninitialized</i> {@link GLEventListener}'s handler methods (reshape, display) * are about to be invoked, it's {@link GLEventListener#init(GLAutoDrawable) init(..)} method is invoked first. * Afterwards the {@link GLEventListener} is marked <i>initialized</i> * and removed from the list of to be initialized {@link GLEventListener}. * </p> - * <p> + * <p> * This methods returns the {@link GLEventListener} initialized state, * i.e. returns <code>false</code> if it is included in the list of to be initialized {@link GLEventListener}, * otherwise <code>true</code>. @@ -221,17 +221,17 @@ public interface GLAutoDrawable extends GLDrawable { * @param listener the GLEventListener object to query it's initialized state. */ public boolean getGLEventListenerInitState(GLEventListener listener); - + /** * Sets the given {@link GLEventListener listener's} initialized state. - * <p> + * <p> * This methods allows manually setting the {@link GLEventListener} initialized state, * i.e. adding it to, or removing it from the list of to be initialized {@link GLEventListener}. * See {@link #getGLEventListenerInitState(GLEventListener)} for details. * </p> * <p> * <b>Warning:</b> This method does not validate whether the given {@link GLEventListener listener's} - * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}. + * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}. * </p> * <p> * This method is only exposed to allow users full control over the {@link GLEventListener}'s state @@ -239,16 +239,16 @@ public interface GLAutoDrawable extends GLDrawable { * </p> * <p> * One use case is moving a {@link GLContext} and their initialized {@link GLEventListener} - * from one {@link GLAutoDrawable} to another, + * from one {@link GLAutoDrawable} to another, * where a subsequent {@link GLEventListener#init(GLAutoDrawable) init(..)} call after adding it - * to the new owner is neither required nor desired. + * to the new owner is neither required nor desired. * See {@link com.jogamp.opengl.util.GLDrawableUtil#swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable) swapGLContextAndAllGLEventListener(..)}. * </p> * @param listener the GLEventListener object to perform a state change. - * @param initialized if <code>true</code>, mark the listener initialized, otherwise uninitialized. + * @param initialized if <code>true</code>, mark the listener initialized, otherwise uninitialized. */ public void setGLEventListenerInitState(GLEventListener listener, boolean initialized); - + /** * Disposes the given {@link GLEventListener listener} via {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} * if it has been initialized and added to this queue. @@ -257,7 +257,7 @@ public interface GLAutoDrawable extends GLDrawable { * otherwise marked uninitialized. * </p> * <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> * <p> @@ -268,8 +268,8 @@ public interface GLAutoDrawable extends GLDrawable { * Use {@link #removeGLEventListener(GLEventListener) removeGLEventListener(listener)} instead * if you just want to remove the {@link GLEventListener listener} and <i>don't care</i> about the disposal of the it's (OpenGL) resources. * </p> - * <p> - * Also note that this is done from within a particular drawable's + * <p> + * Also note that this is done from within a particular drawable's * {@link GLEventListener} handler (reshape, display, etc.), that it is not * guaranteed that all other listeners will be evaluated properly * during this update cycle. @@ -277,30 +277,30 @@ public interface GLAutoDrawable extends GLDrawable { * @param listener The GLEventListener object to be disposed and removed if <code>remove</code> is <code>true</code> * @param remove pass <code>true</code> to have the <code>listener</code> removed from this drawable queue, otherwise pass <code>false</code> * @return the disposed and/or removed GLEventListener, or null if no action was performed, i.e. listener was not added - */ + */ public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove); - - /** + + /** * Removes the given {@link GLEventListener listener} from this drawable queue. * <p> - * This is an inexpensive operation, since the removed listener's + * This is an inexpensive operation, since the removed listener's * {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} method will <i>not</i> be called. * </p> * <p> - * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)} + * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)} * instead to ensure disposal of the {@link GLEventListener listener}'s (OpenGL) resources. - * </p> - * <p> - * Note that if this is done from within a particular drawable's + * </p> + * <p> + * Note that if this is done from within a particular drawable's * {@link GLEventListener} handler (reshape, display, etc.), that it is not * guaranteed that all other listeners will be evaluated properly * during this update cycle. * </p> * @param listener The GLEventListener object to be removed * @return the removed GLEventListener, or null if listener was not added - */ + */ public GLEventListener removeGLEventListener(GLEventListener listener); - + /** * Registers the usage of an animator, an {@link javax.media.opengl.GLAnimatorControl} implementation. * The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not. @@ -334,17 +334,17 @@ public interface GLAutoDrawable extends GLDrawable { /** * 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 @@ -359,17 +359,17 @@ public interface GLAutoDrawable extends GLDrawable { * and spare redundant context switches, see {@link com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)}. * </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 * @see com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean) */ public Thread setExclusiveContextThread(Thread t) throws GLException; - + /** - * @see #setExclusiveContextThread(Thread) + * @see #setExclusiveContextThread(Thread) */ public Thread getExclusiveContextThread(); - + /** * Enqueues a one-shot {@link GLRunnable}, * which will be executed within the next {@link #display()} call @@ -391,7 +391,7 @@ public interface GLAutoDrawable extends GLDrawable { * has been executed by the {@link GLAnimatorControl animator}, otherwise the method returns immediately. * </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 #isRealized()} returns <code>false</code> <i>or</i> {@link #getContext()} returns <code>null</code>, * the call is ignored and returns <code>false</code>.<br> * This helps avoiding deadlocking the caller. @@ -404,16 +404,16 @@ public interface GLAutoDrawable extends GLDrawable { * @param wait if <code>true</code> block until execution of <code>glRunnable</code> is finished, otherwise return immediately w/o waiting * @param glRunnable the {@link GLRunnable} to execute within {@link #display()} * @return <code>true</code> if the {@link GLRunnable} has been processed or queued, otherwise <code>false</code>. - * + * * @see #setAnimator(GLAnimatorControl) * @see #display() * @see GLRunnable * @see #invoke(boolean, List) */ public boolean invoke(boolean wait, GLRunnable glRunnable); - + /** - * Extends {@link #invoke(boolean, GLRunnable)} functionality + * Extends {@link #invoke(boolean, GLRunnable)} functionality * allowing to inject a list of {@link GLRunnable}s. * @param wait if <code>true</code> block until execution of the last <code>glRunnable</code> is finished, otherwise return immediately w/o waiting * @param glRunnables the {@link GLRunnable}s to execute within {@link #display()} @@ -494,16 +494,16 @@ public interface GLAutoDrawable extends GLDrawable { * <p> * This GLAutoDrawable implementation holds it's own GLContext reference, * thus created a GLContext using this methods won't replace it implicitly. - * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}. + * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}. * </p> * <p> - * The GLAutoDrawable implementation shall also set the - * context creation flags as customized w/ {@link #setContextCreationFlags(int)}. + * The GLAutoDrawable implementation shall also set the + * context creation flags as customized w/ {@link #setContextCreationFlags(int)}. * </p> */ @Override public GLContext createContext(GLContext shareWith); - + /** Returns the {@link GL} pipeline object this GLAutoDrawable uses. If this method is called outside of the {@link GLEventListener}'s callback methods (init, display, etc.) it may @@ -522,13 +522,13 @@ public interface GLAutoDrawable extends GLDrawable { demos for examples. @return the set GL pipeline or null if not successful */ public GL setGL(GL gl); - + /** * Method <i>may</i> return the upstream UI toolkit object * holding this {@link GLAutoDrawable} instance, if exist. * <p> * Currently known Java UI toolkits and it's known return types are: - * + * * <table border="1"> * <tr><td>Toolkit</td> <td>GLAutoDrawable Implementation</td> <td>~</td> <td>Return Type of getUpstreamWidget()</td</tr> * <tr><td>NEWT</td> <td>{@link com.jogamp.newt.opengl.GLWindow}</td> <td>has a</td> <td>{@link com.jogamp.newt.Window}</td</tr> @@ -536,7 +536,7 @@ public interface GLAutoDrawable extends GLDrawable { * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLCanvas}</td> <td>is a</td> <td>{@link java.awt.Canvas}</td</tr> * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLJPanel}</td> <td>is a</td> <td>{@link javax.swing.JPanel}</td</tr> * </table> - * However, the result may be other object types than the listed above + * However, the result may be other object types than the listed above * due to new supported toolkits. * </p> * <p> diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index 1f75a7b4a..e84dd7be9 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -32,7 +32,7 @@ package javax.media.opengl; /** * <P>The base interface from which all GL profiles derive, providing * checked conversion down to concrete profiles, access to the - * OpenGL context associated with the GL and extension/function + * OpenGL context associated with the GL and extension/function * availability queries as described below.</P> * * <P> While the APIs for vendor extensions are unconditionally @@ -79,7 +79,7 @@ package javax.media.opengl; * */ public interface GLBase { - + /** * Indicates whether this GL object conforms to any of the OpenGL profiles. */ @@ -131,7 +131,7 @@ public interface GLBase { * <p> * Remark: ES2 compatible desktop profiles are not included. * To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}. - * </p> + * </p> * @see #isGLES2Compatible() * @see GLContext#isGLES2() */ @@ -142,12 +142,12 @@ public interface GLBase { * <p> * Remark: ES3 compatible desktop profiles are not included. * To query whether core ES3 functionality is provided, use {@link #isGLES3Compatible()}. - * </p> + * </p> * @see #isGLES3Compatible() * @see GLContext#isGLES3() */ public boolean isGLES3(); - + /** * Indicates whether this GL object conforms to one of the OpenGL ES profiles, * see {@link #isGLES1()} and {@link #isGLES2()}. @@ -180,7 +180,7 @@ public interface GLBase { public boolean isGL3ES3(); /** - * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true. + * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true. * <p>Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p> * @see GLContext#isGL4ES3() */ @@ -192,29 +192,29 @@ public interface GLBase { */ public boolean isGL2GL3(); - /** + /** * Indicates whether this GL object uses a GL4 core profile. <p>Includes [ GL4 ].</p> * @see GLContext#isGL4core() */ public boolean isGL4core(); - - /** + + /** * Indicates whether this GL object uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p> * @see GLContext#isGL3core() */ public boolean isGL3core(); - - /** + + /** * Indicates whether this GL object uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GL2ES2 ].</p> * @see GLContext#isGLcore() */ public boolean isGLcore(); - + /** * Indicates whether this GL object is compatible with the core OpenGL ES2 functionality. - * @return true if this context is an ES2 context or implements + * @return true if this context is an ES2 context or implements * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false - * @see GLContext#isGLES2Compatible() + * @see GLContext#isGLES2Compatible() */ public boolean isGLES2Compatible(); @@ -227,26 +227,26 @@ public interface GLBase { * <p> * Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ] * </p> - * @see GLContext#isGLES3Compatible() + * @see GLContext#isGLES3Compatible() */ public boolean isGLES3Compatible(); - /** - * Indicates whether this GL object supports GLSL. - * @see GLContext#hasGLSL() + /** + * Indicates whether this GL object supports GLSL. + * @see GLContext#hasGLSL() */ public boolean hasGLSL(); /** * Returns the downstream GL instance in case this is a wrapping pipeline, otherwise <code>null</code>. * <p> - * See {@link #getRootGL()} for retrieving the implementing root instance. + * See {@link #getRootGL()} for retrieving the implementing root instance. * </p> * @throws GLException if the downstream instance is not null and not a GL implementation * @see #getRootGL() */ public GL getDownstreamGL() throws GLException; - + /** * Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}. * <p> @@ -256,7 +256,7 @@ public interface GLBase { * @throws GLException if the root instance is not a GL implementation */ public GL getRootGL() throws GLException; - + /** * Casts this object to the GL interface. * @throws GLException if this object is not a GL implementation @@ -360,14 +360,14 @@ public interface GLBase { /** * Returns true if the specified OpenGL core- or extension-function can be * used successfully through this GL instance given the current host (OpenGL - * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> - * By "successfully" we mean that the function is both <i>callable</i> - * on the machine running the program and <i>available</i> on the current - * display.<P> + * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> + * By "successfully" we mean that the function is both <i>callable</i> + * on the machine running the program and <i>available</i> on the current + * display.<P> * * In order to call a function successfully, the function must be both - * <i>callable</i> on the machine running the program and <i>available</i> on - * the display device that is rendering the output (note: on non-networked, + * <i>callable</i> on the machine running the program and <i>available</i> on + * the display device that is rendering the output (note: on non-networked, * single-display machines these two conditions are identical; on networked and/or * multi-display machines this becomes more complicated). These conditions are * met if the function is either part of the core OpenGL version supported by @@ -376,7 +376,7 @@ public interface GLBase { * * A GL function is <i>callable</i> if it is successfully linked at runtime, * hence the GLContext must be made current at least once. - * + * * @param glFunctionName the name of the OpenGL function (e.g., use * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link * GL#glBindRenderbuffer(int,int)} is available). @@ -386,14 +386,14 @@ public interface GLBase { /** * Returns true if the specified OpenGL extension can be * used successfully through this GL instance given the current host (OpenGL - * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> + * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P> * * @param glExtensionName the name of the OpenGL extension (e.g., * "GL_ARB_vertex_program"). */ public boolean isExtensionAvailable(String glExtensionName); - /** + /** * Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>. * <p> * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions @@ -407,12 +407,12 @@ public interface GLBase { */ public boolean hasBasicFBOSupport(); - /** + /** * Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>. * <p> * Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions * <code>ARB_framebuffer_object</code>, or all of - * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, + * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, * <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>. * </p> * <p> @@ -424,7 +424,7 @@ public interface GLBase { /** * Returns the maximum number of FBO RENDERBUFFER samples - * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. + * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. * @see GLContext#getMaxRenderbufferSamples() */ public int getMaxRenderbufferSamples(); @@ -440,7 +440,7 @@ public interface GLBase { public boolean isNPOTTextureAvailable(); public boolean isTextureFormatBGRA8888Available(); - + /** Provides a platform-independent way to specify the minimum swap interval for buffer swaps. An argument of 0 disables sync-to-vertical-refresh completely, while an argument of 1 @@ -449,7 +449,7 @@ public interface GLBase { is usually either 0 or 1. This function is not guaranteed to have an effect, and in particular only affects heavyweight onscreen components. - + @see #getSwapInterval @throws GLException if this context is not the current */ @@ -458,8 +458,8 @@ public interface GLBase { /** Provides a platform-independent way to get the swap interval set by {@link #setSwapInterval}. <br> - If the interval is not set by {@link #setSwapInterval} yet, - -1 is returned, indicating that the platforms default + If the interval is not set by {@link #setSwapInterval} yet, + -1 is returned, indicating that the platforms default is being used. @see #setSwapInterval @@ -498,10 +498,10 @@ public interface GLBase { */ public Object getExtension(String extensionName); - /** Aliased entrypoint of <code> void {@native glClearDepth}(GLclampd depth); </code> and <code> void {@native glClearDepthf}(GLclampf depth); </code>. */ + /** Aliased entrypoint of <code> void {@native glClearDepth}(GLclampd depth); </code> and <code> void {@native glClearDepthf}(GLclampf depth); </code>. */ public void glClearDepth( double depth ); - /** Aliased entrypoint of <code> void {@native glDepthRange}(GLclampd depth); </code> and <code> void {@native glDepthRangef}(GLclampf depth); </code>. */ + /** Aliased entrypoint of <code> void {@native glDepthRange}(GLclampd depth); </code> and <code> void {@native glDepthRangef}(GLclampf depth); </code>. */ public void glDepthRange(double zNear, double zFar); /** @@ -526,44 +526,44 @@ public interface GLBase { */ public boolean glIsVBOElementArrayBound(); - /** - * Return the framebuffer name bound to this context, + /** + * Return the framebuffer name bound to this context, * see {@link GL#glBindFramebuffer(int, int)}. */ public int getBoundFramebuffer(int target); - /** + /** * Return the default draw framebuffer name. - * <p> + * <p> * May differ from it's default <code>zero</code> * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. - * </p> + * </p> */ public int getDefaultDrawFramebuffer(); - /** + /** * Return the default read framebuffer name. - * <p> + * <p> * May differ from it's default <code>zero</code> * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. - * </p> + * </p> */ public int getDefaultReadFramebuffer(); - - /** - * Returns the default color buffer within the current bound + + /** + * Returns the default color buffer within the current bound * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER, - * which will be used as the source for pixel reading commands, + * which will be used as the source for pixel reading commands, * like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc. * <p> * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0}, - * otherwise this is {@link GL#GL_FRONT} for single buffer configurations + * otherwise this is {@link GL#GL_FRONT} for single buffer configurations * and {@link GL#GL_BACK} for double buffer configurations. - * </p> + * </p> */ public int getDefaultReadBuffer(); - + } diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 872069fb8..b825d6388 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -99,7 +99,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** - * Copies all {@link GLCapabilities} and {@link Capabilities} values + * Copies all {@link GLCapabilities} and {@link Capabilities} values * from <code>source</code> into this instance. * @return this instance */ @@ -122,11 +122,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil sampleExtension = source.getSampleExtension(); return this; } - + @Override public int hashCode() { // 31 * x == (x << 5) - x - int hash = super.hashCode(); + int hash = super.hashCode(); hash = ((hash << 5) - hash) + this.glProfile.hashCode() ; hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 ); @@ -238,7 +238,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public void setGLProfile(GLProfile profile) { glProfile=profile; } - + @Override public final boolean isPBuffer() { return isPBuffer; @@ -255,7 +255,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * <p> * Requesting offscreen pbuffer mode disables the offscreen auto selection. * </p> - */ + */ public void setPBuffer(boolean enable) { if(enable) { setOnscreen(false); @@ -267,7 +267,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public final boolean isFBO() { return isFBO; } - + /** * Requesting offscreen FBO mode. * <p> @@ -422,7 +422,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil return sampleBuffers; } - /** + /** * If sample buffers are enabled, indicates the number of buffers * to be allocated. Defaults to 2. * @see #getNumSamples() @@ -491,7 +491,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil if(isOnscreen()) { sink.append("."); // no additional off-screen modes besides on-screen } else { - sink.append("auto-cfg"); // auto-config off-screen mode + sink.append("auto-cfg"); // auto-config off-screen mode } } sink.append("]"); diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java index 5d575c2ee..2e0bec1f9 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-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,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. */ @@ -53,7 +53,7 @@ import javax.media.opengl.GLCapabilitiesImmutable; the appropriate method of {@link GLDrawableFactory}; the chooser will be called during the OpenGL context creation process. Note that this is only a marker interface; its signature is the same as - {@link CapabilitiesChooser} and the {@link List} of + {@link CapabilitiesChooser} and the {@link List} of objects extending {@link CapabilitiesImmutable} passed to {@link #chooseCapabilities chooseCapabilities} is actually a {@link List} of type {@link GLCapabilitiesImmutable}. */ diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java index 6af35021f..dc28539a0 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java @@ -37,13 +37,13 @@ import javax.media.nativewindow.CapabilitiesImmutable; * @see javax.media.nativewindow.CapabilitiesImmutable */ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable { - /** - * One of the platform's default sample extension + /** + * One of the platform's default sample extension * <code>EGL.EGL_SAMPLES, GLX.GLX_SAMPLES, WGLExt.WGL_SAMPLES_ARB</code> * if available, or any other <i>known</i> fallback one, ie <code>EGLExt.EGL_COVERAGE_SAMPLES_NV</code> */ public static final String DEFAULT_SAMPLE_EXTENSION = "default" ; - + /** * Returns the GL profile you desire or used by the drawable. */ @@ -110,10 +110,10 @@ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable { * </p> */ String getSampleExtension(); - + /** * Returns whether sample buffers for full-scene antialiasing - * (FSAA) should be allocated for this drawable. + * (FSAA) should be allocated for this drawable. * <p> * Default is false. * </p> diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index f4dbde6b2..bd6867359 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -72,14 +72,14 @@ import com.jogamp.opengl.GLRendererQuirks; abstraction provides a stable object which clients can use to refer to a given context. */ public abstract class GLContext { - + public static final boolean DEBUG = Debug.debug("GLContext"); public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); - public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; + public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; - /** - * If <code>true</code> (default), bootstrapping the available GL profiles - * will use the highest compatible GL context for each profile, + /** + * If <code>true</code> (default), bootstrapping the available GL profiles + * will use the highest compatible GL context for each profile, * hence skipping querying lower profiles if a compatible higher one is found: * <ul> * <li>4.2-core -> 4.2-core, 3.3-core</li> @@ -95,17 +95,17 @@ public abstract class GLContext { * </ul> * Using aliasing speeds up initialization about: * <ul> - * <li>Linux x86_64 - Nvidia: 28%, 700ms down to 500ms</li> - * <li>Linux x86_64 - AMD : 40%, 1500ms down to 900ms</li> + * <li>Linux x86_64 - Nvidia: 28%, 700ms down to 500ms</li> + * <li>Linux x86_64 - AMD : 40%, 1500ms down to 900ms</li> * <p> * Can be turned off with property <code>jogl.debug.GLContext.NoProfileAliasing</code>. * </p> */ public static final boolean PROFILE_ALIASING = !Debug.isPropertyDefined("jogl.debug.GLContext.NoProfileAliasing", true); - + protected static final boolean FORCE_NO_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.none", true); protected static final boolean FORCE_MIN_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.min", true); - + /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true); /** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */ @@ -130,31 +130,31 @@ public abstract class GLContext { public static final VersionNumber Version140 = new VersionNumber(1, 40, 0); /* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */ public static final VersionNumber Version150 = new VersionNumber(1, 50, 0); - + /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. */ public static final VersionNumber Version300 = new VersionNumber(3, 0, 0); - + /** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */ public static final VersionNumber Version310 = new VersionNumber(3, 1, 0); - + /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ public static final VersionNumber Version320 = new VersionNumber(3, 2, 0); - + /** Version 4.3. As an OpenGL version, it qualifies for <code>GL_ARB_ES3_compatibility</code> */ public static final VersionNumber Version430 = new VersionNumber(4, 3, 0); - + protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0); // // Cached keys, bits [0..15] // - + /** Context option bits, full bit mask covering bits [0..15], i.e. <code>0x0000FFFF</code>, {@value}. */ protected static final int CTX_IMPL_FULL_MASK = 0x0000FFFF; - + /** Context option bits, cached bit mask covering 9 bits [0..8], i.e. <code>0x000001FF</code>, {@value}. Leaving 7 bits for non cached options, i.e. 9:7. */ protected static final int CTX_IMPL_CACHE_MASK = 0x000001FF; - + /** <code>ARB_create_context</code> related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IS_ARB_CREATED = 1 << 0; /** <code>ARB_create_context</code> related: desktop compatibility profile. Cache key value. See {@link #isGLCompatibilityProfile()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ @@ -173,14 +173,14 @@ public abstract class GLContext { // // Non cached keys, bits [9..15] // - + /** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IMPL_ES2_COMPAT = 1 << 9; /** <code>GL_ARB_ES3_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IMPL_ES3_COMPAT = 1 << 10; - - /** + + /** * Context supports basic FBO, details see {@link #hasBasicFBOSupport()}. * Not a cache key. * @see #hasBasicFBOSupport() @@ -188,15 +188,15 @@ public abstract class GLContext { */ protected static final int CTX_IMPL_FBO = 1 << 11; - /** - * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points, + /** + * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points, * see {@link #hasFP32CompatAPI()}. * Not a cache key. * @see #hasFP32CompatAPI() * @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile) */ protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 12; - + private static final ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>(); private final HashMap<String, Object> attachedObjects = new HashMap<String, Object>(); @@ -219,9 +219,9 @@ public abstract class GLContext { private int currentSwapInterval; protected GLRendererQuirks glRendererQuirks; - /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */ - protected boolean drawableRetargeted; - + /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */ + protected boolean drawableRetargeted; + /** * @param isInit true if called for class initialization, otherwise false (re-init or destruction). */ @@ -242,12 +242,12 @@ public abstract class GLContext { drawableRetargeted = false; } - /** + /** * Returns the instance of {@link GLRendererQuirks}, allowing one to determine workarounds. * @return instance of {@link GLRendererQuirks} if context was made current once, otherwise <code>null</code>. */ public final GLRendererQuirks getRendererQuirks() { return glRendererQuirks; } - + /** * Returns true if the <code>quirk</code> exist in {@link #getRendererQuirks()}, otherwise false. * <p> @@ -260,10 +260,10 @@ public abstract class GLContext { * @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}. * @throws IllegalArgumentException if the quirk is out of range */ - public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException { - return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ; + public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException { + return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ; } - + /** * Sets the read/write drawable for framebuffer operations. * <p> @@ -276,13 +276,13 @@ public abstract class GLContext { * attempts to make this context current. Otherwise a race condition may happen. * </p> * @param readWrite The read/write drawable for framebuffer operations, maybe <code>null</code> to remove association. - * @param setWriteOnly Only change the write-drawable, if <code>setWriteOnly</code> is <code>true</code> and - * if the {@link #getGLReadDrawable() read-drawable} differs - * from the {@link #getGLDrawable() write-drawable}. + * @param setWriteOnly Only change the write-drawable, if <code>setWriteOnly</code> is <code>true</code> and + * if the {@link #getGLReadDrawable() read-drawable} differs + * from the {@link #getGLDrawable() write-drawable}. * Otherwise set both drawables, read and write. * @return The previous read/write drawable * - * @throws GLException in case <code>null</code> is being passed or + * @throws GLException in case <code>null</code> is being passed or * this context is made current on another thread. * * @see #isGLReadDrawableAvailable() @@ -292,13 +292,13 @@ public abstract class GLContext { * @see #getGLDrawable() */ public abstract GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly); - + /** * Returns the write-drawable this context uses for framebuffer operations. * <p> * If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)}, * it equals to the write-drawable (default). - * </p> + * </p> * @see #setGLDrawable(GLDrawable, boolean) * @see #setGLReadDrawable(GLDrawable) */ @@ -336,10 +336,10 @@ public abstract class GLContext { * <p> * If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)}, * it equals to the write-drawable (default). - * </p> + * </p> * @see #isGLReadDrawableAvailable() * @see #setGLReadDrawable(GLDrawable) - * @see #getGLReadDrawable() + * @see #getGLReadDrawable() */ public abstract GLDrawable getGLReadDrawable(); @@ -354,9 +354,9 @@ public abstract class GLContext { * </p> * <p> * A return value of {@link #CONTEXT_CURRENT_NEW} - * indicates that that context has been made current for the 1st time, + * indicates that that context has been made current for the 1st time, * or that the state of the underlying context or drawable has - * changed since the last time this context was current. + * changed since the last time this context was current. * In this case, the application may wish to initialize the render state. * </p> * <p> @@ -378,7 +378,7 @@ public abstract class GLContext { * </p> * * @return <ul> - * <li>{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,</li> + * <li>{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,</li> * <li>{@link #CONTEXT_CURRENT} if the context was successfully made current,</li> * <li>{@link #CONTEXT_NOT_CURRENT} if the context could not be made current.</li> * </ul> @@ -514,7 +514,7 @@ public abstract class GLContext { public abstract void destroy(); /** - * Returns the implementing root GL instance of this GLContext's GL object, + * Returns the implementing root GL instance of this GLContext's GL object, * considering a wrapped pipelined hierarchy, see {@link GLBase#getDownstreamGL()}. * @throws GLException if the root instance is not a GL implementation * @see GLBase#getRootGL() @@ -523,7 +523,7 @@ public abstract class GLContext { * @see #setGL(GL) */ public abstract GL getRootGL(); - + /** * Returns the GL pipeline object for this GLContext. * @@ -716,16 +716,16 @@ public abstract class GLContext { } /** - * Returns this context OpenGL version. - * @see #getGLSLVersionNumber() + * Returns this context OpenGL version. + * @see #getGLSLVersionNumber() **/ public final VersionNumber getGLVersionNumber() { return ctxVersion; } - /** + /** * Returns the vendor's version, i.e. version number at the end of <code>GL_VERSION</code> not being the GL version. * <p> - * In case no such version exists within <code>GL_VERSION</code>, + * In case no such version exists within <code>GL_VERSION</code>, * the {@link VersionNumberString#zeroVersion zero version} instance is returned. - * </p> + * </p> * <p> * The vendor's version is usually the vendor's OpenGL driver version. * </p> @@ -743,31 +743,31 @@ public abstract class GLContext { * via {@link GL2ES2#GL_SHADING_LANGUAGE_VERSION} if ≥ ES2.0 or GL2.0, * otherwise a static match is being utilized. * <p> - * The context must have been current once, - * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. + * The context must have been current once, + * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. * </p> * <p> - * Examples w/ <code>major.minor</code>: + * Examples w/ <code>major.minor</code>: * <pre> - * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2), + * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2), * 3.30 (GL 3.3), 4.00 (GL 4.0), 4.10 (GL 4.1), 4.20 (GL 4.2) * </pre > * </p> * <p> * <i>Matching</i> could also refer to the maximum GLSL version usable by this context * since <i>normal</i> GL implementations are capable of using a lower GLSL version as well. - * The latter is not true on OSX w/ a GL3 context. + * The latter is not true on OSX w/ a GL3 context. * </p> - * - * @return GLSL version number if context has been made current at least once, + * + * @return GLSL version number if context has been made current at least once, * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. - * + * * @see #getGLVersionNumber() */ public final VersionNumber getGLSLVersionNumber() { return ctxGLSLVersion; } - + /** * Returns the GLSL version string as to be used in a shader program, including a terminating newline '\n', * i.e. for desktop @@ -794,10 +794,10 @@ public abstract class GLContext { return ""; } final int minor = ctxGLSLVersion.getMinor(); - final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : ""; + final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : ""; return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ; } - + protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) { if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) { if( 3 > glMajorVersion ) { @@ -814,13 +814,13 @@ public abstract class GLContext { switch ( glMinorVersion ) { case 0: return Version130; // GL 3.0 -> GLSL 1.30 case 1: return Version140; // GL 3.1 -> GLSL 1.40 - default: return Version150; // GL 3.2 -> GLSL 1.50 + default: return Version150; // GL 3.2 -> GLSL 1.50 } } // The new default: GL >= 3.3, ES >= 3.0 return new VersionNumber(glMajorVersion, glMinorVersion * 10, 0); // GL M.N -> GLSL M.N } - + /** * @return true if this context is an ES2 context or implements * the extension <code>GL_ARB_ES3_compatibility</code> or <code>GL_ARB_ES2_compatibility</code>, otherwise false @@ -840,18 +840,18 @@ public abstract class GLContext { return 0 != ( ctxOptions & CTX_IMPL_ES3_COMPAT ) ; } - /** + /** * @return true if impl. is a hardware rasterizer, otherwise false. * @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile) - * @see GLProfile#isHardwareRasterizer() + * @see GLProfile#isHardwareRasterizer() */ public final boolean isHardwareRasterizer() { return 0 == ( ctxOptions & CTX_IMPL_ACCEL_SOFT ) ; } - + /** * @return true if context supports GLSL, i.e. is either {@link #isGLES2()}, {@link #isGL3()} or {@link #isGL2()} <i>and</i> major-version > 1. - * @see GLProfile#hasGLSL() + * @see GLProfile#hasGLSL() */ public final boolean hasGLSL() { return isGLES2() || @@ -859,7 +859,7 @@ public abstract class GLContext { isGL2() && ctxVersion.getMajor()>1 ; } - /** + /** * Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>. * <p> * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions @@ -875,30 +875,30 @@ public abstract class GLContext { return 0 != ( ctxOptions & CTX_IMPL_FBO ) ; } - /** - * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available, + /** + * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available, * otherwise <code>false</code>. * @see #CTX_IMPL_FP32_COMPAT_API */ public final boolean hasFP32CompatAPI() { return 0 != ( ctxOptions & CTX_IMPL_FP32_COMPAT_API ) ; } - - /** + + /** * Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>. * <p> * Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions * <code>ARB_framebuffer_object</code>, or all of - * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, + * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, * <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>. * </p> * <p> * Full FBO support includes multiple color attachments and multisampling. * </p> */ - public final boolean hasFullFBOSupport() { + public final boolean hasFullFBOSupport() { return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) && - ( isGL3() || // GL >= 3.0 + ( isGL3() || // GL >= 3.0 isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object* isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) && @@ -907,10 +907,10 @@ public abstract class GLContext { ) ) ; } - + /** * Returns the maximum number of FBO RENDERBUFFER samples - * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. + * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. */ public final int getMaxRenderbufferSamples() { if( hasFullFBOSupport() ) { @@ -928,7 +928,7 @@ public abstract class GLContext { } return 0; } - + /** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns <code>true</code>. */ public boolean isNPOTTextureAvailable() { return isGL3() || isGLES2Compatible() || isExtensionAvailable(GLExtensions.ARB_texture_non_power_of_two); @@ -940,9 +940,9 @@ public abstract class GLContext { isExtensionAvailable(GLExtensions.IMG_texture_format_BGRA8888) ; } - /** + /** * Indicates whether this GLContext is capable of GL4bc. <p>Includes [ GL4bc ].</p> - * @see GLProfile#isGL4bc() + * @see GLProfile#isGL4bc() */ public final boolean isGL4bc() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && @@ -950,9 +950,9 @@ public abstract class GLContext { ctxVersion.getMajor() >= 4; } - /** + /** * Indicates whether this GLContext is capable of GL4. <p>Includes [ GL4bc, GL4 ].</p> - * @see GLProfile#isGL4() + * @see GLProfile#isGL4() */ public final boolean isGL4() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && @@ -960,7 +960,7 @@ public abstract class GLContext { ctxVersion.getMajor() >= 4; } - /** + /** * Indicates whether this GLContext uses a GL4 core profile. <p>Includes [ GL4 ].</p> */ public final boolean isGL4core() { @@ -968,10 +968,10 @@ public abstract class GLContext { 0 != ( ctxOptions & CTX_PROFILE_CORE ) && ctxVersion.getMajor() >= 4; } - - /** + + /** * Indicates whether this GLContext is capable of GL3bc. <p>Includes [ GL4bc, GL3bc ].</p> - * @see GLProfile#isGL3bc() + * @see GLProfile#isGL3bc() */ public final boolean isGL3bc() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && @@ -979,17 +979,17 @@ public abstract class GLContext { ctxVersion.compareTo(Version310) >= 0 ; } - /** + /** * Indicates whether this GLContext is capable of GL3. <p>Includes [ GL4bc, GL4, GL3bc, GL3 ].</p> - * @see GLProfile#isGL3() + * @see GLProfile#isGL3() */ public final boolean isGL3() { return 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) && ctxVersion.compareTo(Version310) >= 0 ; - } - - /** + } + + /** * Indicates whether this GLContext uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p> */ public final boolean isGL3core() { @@ -997,8 +997,8 @@ public abstract class GLContext { 0 != ( ctxOptions & CTX_PROFILE_CORE ) && ctxVersion.compareTo(Version310) >= 0; } - - /** + + /** * Indicates whether this GLContext uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GLES2 ].</p> */ public final boolean isGLcore() { @@ -1008,26 +1008,26 @@ public abstract class GLContext { ctxVersion.compareTo(Version310) >= 0 ) ; } - + /** * Indicates whether this GLContext allows CPU data sourcing (indices, vertices ..) as opposed to using a GPU buffer source (VBO), - * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}. + * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}. * <p>Includes [GL2ES1, GLES2] == [ GL4bc, GL3bc, GL2, GLES1, GL2ES1, GLES2 ].</p> * <p>See Bug 852 - https://jogamp.org/bugzilla/show_bug.cgi?id=852 </p> */ public final boolean isCPUDataSourcingAvail() { return isGL2ES1() || isGLES2(); } - - /** - * Indicates whether this GLContext's native profile does not implement a default <i>vertex array object</i> (VAO), + + /** + * Indicates whether this GLContext's native profile does not implement a default <i>vertex array object</i> (VAO), * starting w/ OpenGL 3.1 core and GLES3. * <p>Includes [ GL4, GL3, GLES3 ].</p> * <pre> Due to GL 3.1 core spec: E.1. DEPRECATED AND REMOVED FEATURES (p 296), GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331) there is no more default VAO buffer 0 bound, hence generating and binding one - to avoid INVALID_OPERATION at VertexAttribPointer. + to avoid INVALID_OPERATION at VertexAttribPointer. More clear is GL 4.3 core spec: 10.4 (p 307). * </pre> * <pre> @@ -1047,87 +1047,87 @@ public abstract class GLContext { ctxVersion.compareTo(Version310) >= 0 ) ; } - + /** * If this GLContext does not implement a default VAO, see {@link #hasNoDefaultVAO()}, * an <i>own default VAO</i> will be created and bound at context creation. * <p> * If this GLContext does implement a default VAO, i.e. {@link #hasNoDefaultVAO()} * returns <code>false</code>, this method returns <code>0</code>. - * </p> + * </p> * <p> * Otherwise this method returns the VAO object name - * representing this GLContext's <i>own default VAO</i>. - * </p> + * representing this GLContext's <i>own default VAO</i>. + * </p> * @see #hasNoDefaultVAO() */ public abstract int getDefaultVAO(); - /** + /** * Indicates whether this GLContext is capable of GL2. <p>Includes [ GL4bc, GL3bc, GL2 ].</p> - * @see GLProfile#isGL2() + * @see GLProfile#isGL2() */ public final boolean isGL2() { return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ; } - /** + /** * Indicates whether this GLContext is capable of GL2GL3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].</p> - * @see GLProfile#isGL2GL3() - */ + * @see GLProfile#isGL2GL3() + */ public final boolean isGL2GL3() { return isGL2() || isGL3(); } - /** + /** * Indicates whether this GLContext is capable of GLES1. <p>Includes [ GLES1 ].</p> - * @see GLProfile#isGLES1() + * @see GLProfile#isGLES1() */ public final boolean isGLES1() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 1 ; } /** - * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2 ].</p> - * @see GLProfile#isGLES2() + * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2 ].</p> + * @see GLProfile#isGLES2() */ public final boolean isGLES2() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 2 ; } - /** + /** * Indicates whether this GLContext is capable of GLES3. <p>Includes [ GLES3 ].</p> - * @see GLProfile#isGLES3() + * @see GLProfile#isGLES3() */ public final boolean isGLES3() { return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ; } - /** + /** * Indicates whether this GLContext is capable of GLES. <p>Includes [ GLES3, GLES1, GLES2 ].</p> - * @see GLProfile#isGLES() + * @see GLProfile#isGLES() */ public final boolean isGLES() { return 0 != ( CTX_PROFILE_ES & ctxOptions ) ; } - /** + /** * Indicates whether this GLContext is capable of GL2ES1. <p>Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].</p> - * @see GLProfile#isGL2ES1() + * @see GLProfile#isGL2ES1() */ public final boolean isGL2ES1() { return isGLES1() || isGL2(); } - /** + /** * Indicates whether this GLContext is capable of GL2ES2. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].</p> - * @see GLProfile#isGL2ES2() + * @see GLProfile#isGL2ES2() */ public final boolean isGL2ES2() { return isGLES2() || isGL2GL3(); } - /** + /** * Indicates whether this GLContext is capable of GL2ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].</p> * @see GLProfile#isGL2ES3() * @see #isGL3ES3() @@ -1137,16 +1137,16 @@ public abstract class GLContext { return isGL3ES3() || isGL2GL3(); } - /** + /** * Indicates whether this GLContext is capable of GL3ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].</p> - * @see GLProfile#isGL3ES3() + * @see GLProfile#isGL3ES3() */ public final boolean isGL3ES3() { return isGL4ES3() || isGL3(); } - /** - * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true. + /** + * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true. * <p>Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p> * @see GLProfile#isGL4ES3() */ @@ -1185,7 +1185,7 @@ public abstract class GLContext { * </p> * <p> * For a valid context the default value is <code>1</code> - * in case of an EGL based profile (ES1 or ES2) and <code>-1</code> + * in case of an EGL based profile (ES1 or ES2) and <code>-1</code> * (undefined) for desktop. * </p> */ @@ -1222,51 +1222,51 @@ public abstract class GLContext { } protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; } - /** - * Return the framebuffer name bound to this context, + /** + * Return the framebuffer name bound to this context, * see {@link GL#glBindFramebuffer(int, int)}. */ public abstract int getBoundFramebuffer(int target); - - /** + + /** * Return the default draw framebuffer name. - * <p> + * <p> * May differ from it's default <code>zero</code> * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. - * </p> + * </p> */ public abstract int getDefaultDrawFramebuffer(); - - /** + + /** * Return the default read framebuffer name. - * <p> + * <p> * May differ from it's default <code>zero</code> * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable * is being used. - * </p> + * </p> */ public abstract int getDefaultReadFramebuffer(); - - /** - * Returns the default color buffer within the current bound - * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​, - * which will be used as the source for pixel reading commands, + + /** + * Returns the default color buffer within the current bound + * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​, + * which will be used as the source for pixel reading commands, * like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc. * <p> * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0}, - * otherwise this is {@link GL#GL_FRONT} for single buffer configurations + * otherwise this is {@link GL#GL_FRONT} for single buffer configurations * and {@link GL#GL_BACK} for double buffer configurations. - * </p> + * </p> */ public abstract int getDefaultReadBuffer(); - + /** Get the default pixel data type, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */ public abstract int getDefaultPixelDataType(); - + /** Get the default pixel data format, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */ public abstract int getDefaultPixelDataFormat(); - + /** * @return The extension implementing the GLDebugOutput feature, * either {@link GLExtensions#ARB_debug_output} or {@link GLExtensions#AMD_debug_output}. @@ -1486,13 +1486,13 @@ public abstract class GLContext { } if (DEBUG) { System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey); - System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); + System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); } } } - /** - * Returns a unique String object using {@link String#intern()} for the given arguments, + /** + * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) { @@ -1575,7 +1575,7 @@ public abstract class GLContext { } return val; } - + /** * @param reqMajor Key Value either 1, 2, 3 or 4 * @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} @@ -1647,7 +1647,7 @@ public abstract class GLContext { reqMajorCTP[1]=CTX_PROFILE_CORE; } } - + /** * @param device the device the context profile is being requested for * @param GLProfile the GLProfile the context profile is being requested for @@ -1656,7 +1656,7 @@ public abstract class GLContext { protected static final int getAvailableContextProperties(final AbstractGraphicsDevice device, final GLProfile glp) { final int[] reqMajorCTP = new int[] { 0, 0 }; getRequestMajorAndCompat(glp, reqMajorCTP); - + int _major[] = { 0 }; int _minor[] = { 0 }; int _ctp[] = { 0 }; @@ -1702,7 +1702,7 @@ public abstract class GLContext { * Returns true if it is possible to create an <i>framebuffer object</i> (FBO). * <p> * FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent. - * </p> + * </p> * <p> * FBO support is queried as described in {@link #hasBasicFBOSupport()}. * </p> @@ -1714,16 +1714,16 @@ public abstract class GLContext { public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) { return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) ); } - + /** - * @return <code>1</code> if using a hardware rasterizer, <code>0</code> if using a software rasterizer and <code>-1</code> if not determined yet. + * @return <code>1</code> if using a hardware rasterizer, <code>0</code> if using a software rasterizer and <code>-1</code> if not determined yet. * @see GLContext#isHardwareRasterizer() - * @see GLProfile#isHardwareRasterizer() + * @see GLProfile#isHardwareRasterizer() */ public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) { final int r; final int ctp = getAvailableContextProperties(device, glp); - if(0 == ctp) { + if(0 == ctp) { r = -1; } else if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctp ) ) { r = 1; @@ -1732,7 +1732,7 @@ public abstract class GLContext { } return r; } - + /** * @param device the device to request whether the profile is available for * @param reqMajor Key Value either 1, 2, 3 or 4 @@ -1774,7 +1774,7 @@ public abstract class GLContext { int minor[] = { 0 }; int ctp[] = { 0 }; boolean ok; - + ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp); if( !ok ) { ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp); @@ -1784,7 +1784,7 @@ public abstract class GLContext { } return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT ); } - + public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware); } @@ -1859,6 +1859,6 @@ public abstract class GLContext { } protected static String getThreadName() { return Thread.currentThread().getName(); } - + } diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/javax/media/opengl/GLDebugListener.java index 8887d022a..ec7f7cec1 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugListener.java +++ b/src/jogl/classes/javax/media/opengl/GLDebugListener.java @@ -29,16 +29,16 @@ package javax.media.opengl; /** * Listener for {@link GLDebugMessage}s. - * + * * <p>One can enable GLDebugOutput via {@link GLContext#enableGLDebugMessage(boolean)} * and add listeners via {@link GLContext#addGLDebugListener(GLDebugListener)}. */ public interface GLDebugListener { - /** + /** * Handle {@link GLDebugMessage} message sent from native GL implementation. - * + * * <p>Since this method is invoked directly by the GL implementation, it shall * return as fast as possible.</p> */ - void messageSent(GLDebugMessage event); + void messageSent(GLDebugMessage event); } diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java index 4b8d62898..1032cf929 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java +++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java @@ -30,18 +30,18 @@ package javax.media.opengl; import com.jogamp.common.os.Platform; /** - * OpenGL debug message generated by the driver + * OpenGL debug message generated by the driver * and delivered via {@link GLDebugListener}. */ public class GLDebugMessage { final GLContext source; - final long when; + final long when; final int dbgSource; final int dbgType; final int dbgId; final int dbgSeverity; final String dbgMsg; - + /** * @param source The source of the event * @param when The time of the event @@ -60,9 +60,9 @@ public class GLDebugMessage { this.dbgSeverity = dbgSeverity; this.dbgMsg = dbgMsg; } - + /** - * + * * @param source * @param when * @param dbgId @@ -73,88 +73,88 @@ public class GLDebugMessage { */ public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) { int dbgSource, dbgType; - + // AMD category == ARB source/type switch(amdDbgCategory) { - case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD: + case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_API; - dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR; + dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR; break; // // def source / other type // - - case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: + + case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; break; - + case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; break; - + case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION; dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; break; - - + + // // other source / def type // - + case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; + dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; break; - + case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; + dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; break; - + case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD: dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE; + dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE; break; - - case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD: + + case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD: default: dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; } - - return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg); + + return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg); } public static int translateARB2AMDCategory(int dbgSource, int dbgType) { switch (dbgSource) { case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: - return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD; - + return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD; + case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD; - + case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD; } - + switch(dbgType) { case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD; - + case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD; - - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: + + case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD; } - - return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD; + + return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD; } - + public GLContext getSource() { return source; } @@ -162,7 +162,7 @@ public class GLDebugMessage { public long getWhen() { return when; } - + public int getDbgSource() { return dbgSource; } @@ -182,14 +182,14 @@ public class GLDebugMessage { public String getDbgMsg() { return dbgMsg; } - + public StringBuilder toString(StringBuilder sb) { - final String crtab = Platform.getNewline()+"\t"; + final String crtab = Platform.getNewline()+"\t"; if(null==sb) { sb = new StringBuilder(); - } + } sb.append("GLDebugEvent[ id "); - toHexString(sb, dbgId) + toHexString(sb, dbgId) .append(crtab).append("type ").append(getDbgTypeString(dbgType)) .append(crtab).append("severity ").append(getDbgSeverityString(dbgSeverity)) .append(crtab).append("source ").append(getDbgSourceString(dbgSource)) @@ -199,46 +199,46 @@ public class GLDebugMessage { sb.append(crtab).append("source ").append(source.getGLVersion()).append(" - hash 0x").append(Integer.toHexString(source.hashCode())); } sb.append("]"); - return sb; + return sb; } public String toString() { return toString(null).toString(); } - + public static String getDbgSourceString(int dbgSource) { switch(dbgSource) { case GL2GL3.GL_DEBUG_SOURCE_API: return "GL API"; - case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; - case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; + case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; + case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party"; case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return "Application"; case GL2GL3.GL_DEBUG_SOURCE_OTHER: return "generic"; default: return "Unknown (" + toHexString(dbgSource) + ")"; } } - + public static String getDbgTypeString(int dbgType) { switch(dbgType) { case GL2GL3.GL_DEBUG_TYPE_ERROR: return "Error"; - case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; + case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior"; - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; - case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; - case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; + case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; + case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; + case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; default: return "Unknown (" + toHexString(dbgType) + ")"; } } - + public static String getDbgSeverityString(int dbgSeverity) { switch(dbgSeverity) { - case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; - case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; - case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; + case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; + case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; + case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; default: return "Unknown (" + toHexString(dbgSeverity) + ")"; } } - + public static StringBuilder toHexString(StringBuilder sb, int i) { if(null==sb) { sb = new StringBuilder(); @@ -247,6 +247,6 @@ public class GLDebugMessage { } public static String toHexString(int i) { return "0x"+Integer.toHexString(i); - } - + } + } diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java index 46fa923ad..5a032db29 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java @@ -73,13 +73,13 @@ public interface GLDrawable { * </p> * <p> * End users do not need to call this method; it is not necessary to - * call <code>setRealized</code> on a {@link GLAutoDrawable} + * call <code>setRealized</code> on a {@link GLAutoDrawable} * as these perform the appropriate calls on their underlying GLDrawables internally. * </p> * <p> * Developers implementing new OpenGL components for various window * toolkits need to call this method against GLDrawables obtained - * from the GLDrawableFactory via the + * from the GLDrawableFactory via the * {@link GLDrawableFactory#createGLDrawable(NativeSurface)} method. * It must typically be * called with an argument of <code>true</code> when the component @@ -89,7 +89,7 @@ public interface GLDrawable { * the <code>addNotify</code> method and with an argument of * <code>false</code> in the <code>removeNotify</code> method. * </p> - * <p> + * <p> * <code>GLDrawable</code> implementations should handle multiple * cycles of <code>setRealized(true)</code> / * <code>setRealized(false)</code> calls. Most, if not all, Java @@ -104,7 +104,7 @@ public interface GLDrawable { * associated resources as the component becomes realized and * unrealized, respectively. * </p> - * <p> + * <p> * With an argument of <code>true</code>, * the minimum implementation shall call * {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successful: @@ -117,7 +117,7 @@ public interface GLDrawable { * ensures resolving the window/surface handles, and the drawable's {@link GLCapabilities} * might have changed. * </p> - * <p> + * <p> * Calling this method has no other effects. For example, if * <code>removeNotify</code> is called on a Canvas implementation * for which a GLDrawable has been created, it is also necessary to @@ -130,7 +130,7 @@ public interface GLDrawable { */ public void setRealized(boolean realized); - /** + /** * Returns <code>true</code> if this drawable is realized, otherwise <code>true</code>. * <p> * A drawable can be realized and unrealized via {@link #setRealized(boolean)}. @@ -146,19 +146,19 @@ public interface GLDrawable { public int getHeight(); /** - * Returns <code>true</code> if the drawable is rendered in + * Returns <code>true</code> if the drawable is rendered in * OpenGL's coordinate system, <i>origin at bottom left</i>. * Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>. * <p> * Default impl. is <code>true</code>, i.e. OpenGL coordinate system. - * </p> + * </p> * <p> * Currently only MS-Windows bitmap offscreen drawable uses a non OpenGL orientation and hence returns <code>false</code>.<br/> * This removes the need of a vertical flip when used in AWT or Windows applications. * </p> */ public boolean isGLOriented(); - + /** Swaps the front and back buffers of this drawable. For {@link GLAutoDrawable} implementations, when automatic buffer swapping is enabled (as is the default), this method is called @@ -191,11 +191,11 @@ public interface GLDrawable { public NativeSurface getNativeSurface(); /** - * Returns the GL drawable handle, + * Returns the GL drawable handle, * guaranteed to be valid after {@link #setRealized(boolean) realization} * <i>and</i> while it's {@link NativeSurface surface} is being {@link NativeSurface#lockSurface() locked}. * <p> - * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s + * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s * {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle() handle} * or an intermediate layer to suite GL, e.g. an EGL surface. * </p> diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 7c3c42e45..e486e2bfd 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.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. */ @@ -83,7 +83,7 @@ import jogamp.opengl.Debug; during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.<br> {@link javax.media.opengl.GLPbuffer} are always - created immediately and their creation will fail with a + created immediately and their creation will fail with a {@link javax.media.opengl.GLException} if errors occur. </P> <P> The concrete GLDrawableFactory subclass instantiated by {@link @@ -94,21 +94,21 @@ import jogamp.opengl.Debug; public abstract class GLDrawableFactory { protected static final boolean DEBUG = Debug.debug("GLDrawable"); - - /** - * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. + + /** + * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. * When run in the mentioned browsers, the eglInitialize(..) implementation crashes. * <p> * This can be overridden by explicitly enabling ANGLE on Windows by setting the property * <code>jogl.enable.ANGLE</code>. - * </p> + * </p> */ protected static final boolean enableANGLE = Debug.isPropertyDefined("jogl.enable.ANGLE", true); - /** + /** * In case no OpenGL ES implementation is required * and if the running platform may have a buggy implementation, - * setting the property <code>jogl.disable.opengles</code> disables querying a possible existing OpenGL ES implementation. + * setting the property <code>jogl.disable.opengles</code> disables querying a possible existing OpenGL ES implementation. */ protected static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true); @@ -117,11 +117,11 @@ public abstract class GLDrawableFactory { private static GLDrawableFactory nativeOSFactory; private static ArrayList<GLDrawableFactory> glDrawableFactories = new ArrayList<GLDrawableFactory>(); - + /** * Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones. */ - public static final void initSingleton() { + public static final void initSingleton() { if (!isInit) { // volatile: ok synchronized (GLDrawableFactory.class) { if (!isInit) { @@ -130,7 +130,7 @@ public abstract class GLDrawableFactory { } } } - } + } private static final void initSingletonImpl() { NativeWindowFactory.initSingleton(); NativeWindowFactory.addCustomShutdownHook(false /* head */, new Runnable() { @@ -138,7 +138,7 @@ public abstract class GLDrawableFactory { shutdown0(); } }); - + final String nwt = NativeWindowFactory.getNativeWindowType(true); GLDrawableFactory tmp = null; String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); @@ -163,7 +163,7 @@ public abstract class GLDrawableFactory { } try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl); - } catch (Exception jre) { + } catch (Exception jre) { if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName); jre.printStackTrace(); @@ -202,7 +202,7 @@ public abstract class GLDrawableFactory { } } } - + private static void shutdown0() { // Following code will _always_ remain in shutdown hook // due to special semantics of native utils, i.e. X11Utils. @@ -228,22 +228,22 @@ public abstract class GLDrawableFactory { } } glDrawableFactories.clear(); - - // both were members of glDrawableFactories and are shutdown already + + // both were members of glDrawableFactories and are shutdown already nativeOSFactory = null; eglFactory = null; } GLContext.shutdown(); } - + protected GLDrawableFactory() { synchronized(glDrawableFactories) { glDrawableFactories.add(this); } } - + protected static String getThreadName() { return Thread.currentThread().getName(); } - + /** Returns true if this factory is complete, i.e. ready to be used. Otherwise return false. */ protected abstract boolean isComplete(); @@ -253,14 +253,14 @@ public abstract class GLDrawableFactory { protected abstract void destroy(); public abstract void resetDisplayGamma(); - + /** * Retrieve the default <code>device</code> {@link AbstractGraphicsDevice#getConnection() connection}, * {@link AbstractGraphicsDevice#getUnitID() unit ID} and {@link AbstractGraphicsDevice#getUniqueID() unique ID name}. for this factory<br> * The implementation must return a non <code>null</code> default device, which must not be opened, ie. it's native handle is <code>null</code>. * <p> * This method shall return the default device if available - * even if the GLDrawableFactory is not functional and hence not compatible. + * even if the GLDrawableFactory is not functional and hence not compatible. * The latter situation may happen because no native OpenGL implementation is available for the specific implementation. * </p> * @return the default shared device for this factory, eg. :0.0 on X11 desktop. @@ -272,7 +272,7 @@ public abstract class GLDrawableFactory { * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. * @return true if the device is compatible with this factory, ie. if it can be used for GLDrawable creation. Otherwise false. * This implies validation whether the implementation is functional. - * + * * @see #getDefaultDevice() */ public abstract boolean getIsDeviceCompatible(AbstractGraphicsDevice device); @@ -287,8 +287,8 @@ public abstract class GLDrawableFactory { System.err.println("Info: "+getClass().getSimpleName()+".validateDevice: using default device : "+device); } } - - // Always validate the device, + + // Always validate the device, // since even the default device may not be used by this factory. if( !getIsDeviceCompatible(device) ) { if (GLProfile.DEBUG) { @@ -300,29 +300,29 @@ public abstract class GLDrawableFactory { } /** - * Validate and start the shared resource runner thread if necessary and + * Validate and start the shared resource runner thread if necessary and * if the implementation uses it. - * + * * @return the shared resource runner thread, if implementation uses it. */ protected abstract Thread getSharedResourceThread(); - + /** * Create the shared resource used internally as a reference for capabilities etc. * <p> - * Returns true if a shared resource could be created + * Returns true if a shared resource could be created * for the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}.<br> * This does not imply a shared resource is mapped (ie. made persistent), but is available in general<br>. * </p> * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. - * @return true if a shared resource could been created, otherwise false. + * @return true if a shared resource could been created, otherwise false. */ protected final boolean createSharedResource(AbstractGraphicsDevice device) { return createSharedResourceImpl(device); - } + } protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device); - + /** * Returns true if the <code>quirk</code> exist in the shared resource's context {@link GLRendererQuirks}. * <p> @@ -332,7 +332,7 @@ public abstract class GLDrawableFactory { return null != glrq ? glrq.exist(quirk) : false; * </pre> * </p> - * + * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. * @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}. * @throws IllegalArgumentException if the quirk is out of range @@ -343,7 +343,7 @@ public abstract class GLDrawableFactory { final GLRendererQuirks glrq = getRendererQuirks(device); return null != glrq ? glrq.exist(quirk) : false; } - + /** * Returns the shared resource's context {@link GLRendererQuirks}. * <p> @@ -358,12 +358,12 @@ public abstract class GLDrawableFactory { * @see GLRendererQuirks */ public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device); - + /** * Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null */ public static GLDrawableFactory getDesktopFactory() { - GLProfile.initSingleton(); + GLProfile.initSingleton(); return nativeOSFactory; } @@ -371,14 +371,14 @@ public abstract class GLDrawableFactory { * Returns the sole GLDrawableFactory instance for EGL if exist or null */ public static GLDrawableFactory getEGLFactory() { - GLProfile.initSingleton(); + GLProfile.initSingleton(); return eglFactory; } - /** - * Returns the sole GLDrawableFactory instance. - * - * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, + /** + * Returns the sole GLDrawableFactory instance. + * + * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException { @@ -387,7 +387,7 @@ public abstract class GLDrawableFactory { protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException { if ( GLProfile.usesNativeGLES(glProfileImplName) ) { - if(null!=eglFactory) { + if(null!=eglFactory) { return eglFactory; } } else if(null!=nativeOSFactory) { @@ -446,10 +446,10 @@ public abstract class GLDrawableFactory { * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true. * </p> * <p> - * If not onscreen and neither FBO nor Pbuffer is available, + * If not onscreen and neither FBO nor Pbuffer is available, * a simple pixmap/bitmap drawable/surface is created, which is unlikely to be hardware accelerated. * </p> - * + * * @throws IllegalArgumentException if the passed target is null * @throws GLException if any window system-specific errors caused * the creation of the GLDrawable to fail. @@ -463,12 +463,12 @@ public abstract class GLDrawableFactory { */ public abstract GLDrawable createGLDrawable(NativeSurface target) throws IllegalArgumentException, GLException; - + /** - * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable} + * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable} * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions. * <p> - * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized} + * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized} * and it's {@link GLContext} assigned but not yet made current. * </p> * <p> @@ -485,7 +485,7 @@ public abstract class GLDrawableFactory { * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true. * </p> * <p> - * If neither FBO nor Pbuffer is available, + * If neither FBO nor Pbuffer is available, * a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated. * </p> * @@ -498,7 +498,7 @@ public abstract class GLDrawableFactory { * * @throws GLException if any window system-specific errors caused * the creation of the Offscreen to fail. - * + * * @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) */ public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, @@ -507,7 +507,7 @@ public abstract class GLDrawableFactory { int width, int height, GLContext shareWith) throws GLException; /** - * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable} + * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable} * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions. * <p> * In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e. @@ -523,7 +523,7 @@ public abstract class GLDrawableFactory { * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true. * </p> * <p> - * If neither FBO nor Pbuffer is available, + * If neither FBO nor Pbuffer is available, * a simple pixmap/bitmap drawable is created, which is unlikely to be hardware accelerated. * </p> * @@ -537,7 +537,7 @@ public abstract class GLDrawableFactory { * * @throws GLException if any window system-specific errors caused * the creation of the Offscreen to fail. - * + * * @see #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) */ public abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device, @@ -546,7 +546,7 @@ public abstract class GLDrawableFactory { int width, int height) throws GLException; /** - * Creates an {@link GLDrawable#isRealized() unrealized} dummy {@link GLDrawable}. + * Creates an {@link GLDrawable#isRealized() unrealized} dummy {@link GLDrawable}. * A dummy drawable is not visible on screen and will not be used to render directly to, it maybe on- or offscreen. * <p> * It is used to allow the creation of a {@link GLContext} to query information. @@ -558,26 +558,26 @@ public abstract class GLDrawableFactory { * @return the created dummy {@link GLDrawable} */ public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp); - + /** - * Creates a proxy {@link NativeSurface} w/ defined surface handle, - * i.e. a {@link jogamp.nativewindow.WrappedSurface} or {@link jogamp.nativewindow.windows.GDISurface} instance. + * Creates a proxy {@link NativeSurface} w/ defined surface handle, + * i.e. a {@link jogamp.nativewindow.WrappedSurface} or {@link jogamp.nativewindow.windows.GDISurface} instance. * <p> - * It's {@link AbstractGraphicsConfiguration} is properly set according to the given + * It's {@link AbstractGraphicsConfiguration} is properly set according to the given * <code>windowHandle</code>'s native visualID if set or the given {@link GLCapabilitiesImmutable}. * </p> * <p> * Lifecycle (creation and destruction) of the given surface handle shall be handled by the caller - * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}. + * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}. * </p> * <p> * Such surface can be used to instantiate a GLDrawable. With the help of {@link GLAutoDrawableDelegate} - * you will be able to implement a new native windowing system binding almost on-the-fly, - * see {@link com.jogamp.opengl.swt.GLCanvas}. + * you will be able to implement a new native windowing system binding almost on-the-fly, + * see {@link com.jogamp.opengl.swt.GLCanvas}. * </p> - * + * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. - * Caller has to ensure it is compatible w/ the given <code>windowHandle</code> + * Caller has to ensure it is compatible w/ the given <code>windowHandle</code> * @param screenIdx matching screen index of given <code>windowHandle</code> * @param windowHandle the native window handle * @param caps the requested GLCapabilties @@ -586,15 +586,15 @@ public abstract class GLDrawableFactory { * @return the created {@link ProxySurface} instance w/ defined surface handle. */ public abstract ProxySurface createProxySurface(AbstractGraphicsDevice device, - int screenIdx, - long windowHandle, + int screenIdx, + long windowHandle, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream); - + /** * Returns true if it is possible to create an <i>framebuffer object</i> (FBO). * <p> * FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent. - * </p> + * </p> * <p> * FBO support is queried as described in {@link GLContext#hasBasicFBOSupport()}. * </p> @@ -607,9 +607,9 @@ public abstract class GLDrawableFactory { /** * Returns true if it is possible to create an <i>pbuffer surface</i>. - * <p> - * Some older graphics cards do not have this capability, - * as well as some new GL implementation, i.e. OpenGL 3 core on OSX. + * <p> + * Some older graphics cards do not have this capability, + * as well as some new GL implementation, i.e. OpenGL 3 core on OSX. * </p> * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. @@ -637,7 +637,7 @@ public abstract class GLDrawableFactory { * * @throws GLException if any window system-specific errors caused * the creation of the GLPbuffer to fail. - * + * * @deprecated {@link GLPbuffer} is deprecated, use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)} */ public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device, @@ -648,7 +648,7 @@ public abstract class GLDrawableFactory { GLContext shareWith) throws GLException; - + //---------------------------------------------------------------------- // Methods for interacting with third-party OpenGL libraries diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java index 15fae4a39..c8c3440b5 100644 --- a/src/jogl/classes/javax/media/opengl/GLEventListener.java +++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -49,7 +49,7 @@ import java.util.EventListener; public interface GLEventListener extends EventListener { /** Called by the drawable immediately after the OpenGL context is initialized. Can be used to perform one-time OpenGL - initialization per GLContext, such as setup of lights and display lists.<p> + initialization per GLContext, such as setup of lights and display lists.<p> Note that this method may be called more than once if the underlying OpenGL context for the GLAutoDrawable is destroyed and @@ -57,7 +57,7 @@ public interface GLEventListener extends EventListener { hierarchy and later added again. */ public void init(GLAutoDrawable drawable); - + /** Notifies the listener to perform the release of all OpenGL resources per GLContext, such as memory buffers and GLSL programs.<P> @@ -68,11 +68,11 @@ public interface GLEventListener extends EventListener { Note that this event does not imply the end of life of the application. It could be produced with a followup call to {@link #init(GLAutoDrawable)} - in case the GLContext has been recreated, + in case the GLContext has been recreated, e.g. due to a pixel configuration change in a multihead environment. */ public void dispose(GLAutoDrawable drawable); - + /** Called by the drawable to initiate OpenGL rendering by the client. After all GLEventListeners have been notified of a display event, the drawable will swap its buffers if {@link diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java index 644042e15..460f17be9 100644 --- a/src/jogl/classes/javax/media/opengl/GLException.java +++ b/src/jogl/classes/javax/media/opengl/GLException.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index df38745d5..052b08a4b 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.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. @@ -33,17 +33,17 @@ import javax.media.nativewindow.NativeWindowException; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.FBObject.TextureAttachment; -/** +/** * Platform-independent {@link GLDrawable} specialization, * exposing {@link FBObject} functionality. * * <p> - * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound + * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound * and made current the first time, hence only then it's capabilities <i>fully</i> reflect expectations, * i.e. color, depth, stencil and MSAA bits will be <i>valid</i> only after the first {@link GLContext#makeCurrent() makeCurrent()} call. * On-/offscreen bits are <i>valid</i> after {@link #setRealized(boolean) setRealized(true)}. * </p> - * + * * <p> * MSAA is used if {@link GLCapabilitiesImmutable#getNumSamples() requested}. * </p> @@ -51,7 +51,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment; * Double buffering is used if {@link GLCapabilitiesImmutable#getDoubleBuffered() requested}. * </p> * <p> - * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}. + * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}. * Hence double buffering is always the case w/ MSAA. * </p> * <p> @@ -61,7 +61,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment; * This method also allows usage of both textures seperately. * </p> * <p> - * It would be possible to implement double buffering simply using + * It would be possible to implement double buffering simply using * {@link TextureAttachment}s with one {@link FBObject framebuffer}. * This would require mode selection and hence complicate the API. Besides, it would * not support differentiation of read and write framebuffer and hence not be spec compliant. @@ -71,50 +71,50 @@ import com.jogamp.opengl.FBObject.TextureAttachment; * is performed either in the {@link jogamp.opengl.GLContextImpl#contextMadeCurrent(boolean) context current hook} * or when {@link jogamp.opengl.GLDrawableImpl#swapBuffersImpl(boolean) swapping buffers}, whatever comes first. * </p> - */ + */ public interface GLFBODrawable extends GLDrawable { // public enum DoubleBufferMode { NONE, TEXTURE, FBO }; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support - + /** * @return <code>true</code> if initialized, i.e. a {@link GLContext} is bound and made current once, otherwise <code>false</code>. */ public boolean isInitialized(); - + /** * Notify this instance about upstream size change * to reconfigure the {@link FBObject}. - * @param gl GL context object bound to this drawable, will be made current during operation. - * A prev. current context will be make current after operation. + * @param gl GL context object bound to this drawable, will be made current during operation. + * A prev. current context will be make current after operation. * @throws GLException if resize operation failed */ void resetSize(GL gl) throws GLException; - + /** * @return the used texture unit */ int getTextureUnit(); - + /** - * + * * @param unit the texture unit to be used */ void setTextureUnit(int unit); - + /** * Set the number of sample buffers if using MSAA - * - * @param gl GL context object bound to this drawable, will be made current during operation. - * A prev. current context will be make current after operation. + * + * @param gl GL context object bound to this drawable, will be made current during operation. + * A prev. current context will be make current after operation. * @param newSamples new sample size * @throws GLException if resetting the FBO failed */ void setNumSamples(GL gl, int newSamples) throws GLException; - + /** * @return the number of sample buffers if using MSAA, otherwise 0 */ int getNumSamples(); - + /** * Sets the number of buffers (FBO) being used if using {@link GLCapabilities#getDoubleBuffered() double buffering}. * <p> @@ -123,22 +123,22 @@ public interface GLFBODrawable extends GLDrawable { * <p> * Must be called before {@link #isInitialized() initialization}, otherwise an exception is thrown. * </p> - * @return the new number of buffers (FBO) used, maybe different than the requested <code>bufferCount</code> (see above) + * @return the new number of buffers (FBO) used, maybe different than the requested <code>bufferCount</code> (see above) * @throws GLException if already initialized, see {@link #isInitialized()}. */ int setNumBuffers(int bufferCount) throws GLException; - - /** + + /** * @return the number of buffers (FBO) being used. 1 if not using {@link GLCapabilities#getDoubleBuffered() double buffering}, - * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}. + * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}. */ int getNumBuffers(); - + /** - * @return the used {@link DoubleBufferMode} + * @return the used {@link DoubleBufferMode} */ // DoubleBufferMode getDoubleBufferMode(); // TODO: Add or remove TEXTURE (only) DoubleBufferMode support - + /** * Sets the {@link DoubleBufferMode}. Must be called before {@link #isInitialized() initialization}, * otherwise an exception is thrown. @@ -153,11 +153,11 @@ public interface GLFBODrawable extends GLDrawable { * @throws GLException if already initialized, see {@link #isInitialized()}. */ // void setDoubleBufferMode(DoubleBufferMode mode) throws GLException; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support - + /** * If MSAA is being used and {@link GL#GL_FRONT} is requested, - * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned. - * + * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned. + * * @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names * @return the named {@link FBObject} * @throws IllegalArgumentException if an illegal buffer name is being used @@ -167,7 +167,7 @@ public interface GLFBODrawable extends GLDrawable { /** * Returns the named texture buffer. * <p> - * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible + * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible * and an exception is being thrown if {@link GL#GL_BACK} is being requested. * </p> * @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names @@ -176,20 +176,20 @@ public interface GLFBODrawable extends GLDrawable { */ FBObject.TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException; - /** Resizeable {@link GLFBODrawable} specialization */ + /** Resizeable {@link GLFBODrawable} specialization */ public interface Resizeable extends GLFBODrawable { /** * Resize this drawable. * <p> * This drawable is being locked during operation. * </p> - * @param context the {@link GLContext} bound to this drawable, will be made current during operation - * A prev. current context will be make current after operation. + * @param context the {@link GLContext} bound to this drawable, will be made current during operation + * A prev. current context will be make current after operation. * @param newWidth * @param newHeight * @throws NativeWindowException in case the surface could no be locked * @throws GLException in case an error during the resize operation occurred */ - void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; + void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; } } diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java index 6fe76a3f4..be90d935f 100644 --- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.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. @@ -32,7 +32,7 @@ import javax.media.nativewindow.NativeWindowException; import com.jogamp.opengl.FBObject; -/** +/** * Platform-independent {@link GLAutoDrawable} specialization, * exposing offscreen functionality. * <p> @@ -41,7 +41,7 @@ import com.jogamp.opengl.FBObject; * </p> */ public interface GLOffscreenAutoDrawable extends GLAutoDrawable { - + /** * Resize this auto drawable. * @param newWidth @@ -56,8 +56,8 @@ public interface GLOffscreenAutoDrawable extends GLAutoDrawable { * @see #getUpstreamWidget() */ void setUpstreamWidget(Object newUpstreamWidget); - - /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */ - public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable { - } + + /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */ + public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable { + } } diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java index 12f57fcd8..f36a4bf29 100644 --- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java +++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java @@ -46,8 +46,8 @@ package javax.media.opengl; as a texture map and enabling rendering to floating-point frame buffers. These methods are not guaranteed to be supported on all platforms and may be deprecated in a future release. - - @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)} + + @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)} via {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) GLDrawableFactory.createOffscreenAutoDrawable(..)}. */ public interface GLPbuffer extends GLAutoDrawable { diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index c6bf26235..d947bada2 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -1,21 +1,21 @@ /* * 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 @@ -28,7 +28,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. @@ -49,7 +49,7 @@ import jogamp.opengl.*; public class GLPipelineFactory { public static final boolean DEBUG = Debug.debug("GLPipelineFactory"); - /** + /** * Creates a pipelined GL instance using the given downstream <code>downstream</code> * and optional arguments <code>additionalArgs</code> for the constructor. * @@ -66,7 +66,7 @@ public class GLPipelineFactory { * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); * </pre> * </p> - * + * * <p> * The upstream GL instance is determined as follows: * <ul> @@ -76,7 +76,7 @@ public class GLPipelineFactory { * <li> For all <code>downstream</code> class and superclass interfaces, do:</li> * <ul> * <li> If <code>reqInterface</code> is not null and the interface is unequal, continue loop.</li> - * <li> If <code>downstream</code> is not instance of interface, continue loop.</li> + * <li> If <code>downstream</code> is not instance of interface, continue loop.</li> * <li> If upstream class is available use it, end loop.</li> * </ul> * </ul> @@ -116,7 +116,7 @@ public class GLPipelineFactory { if(DEBUG) { System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " is _not_ instance of "+ clazzes[i].getName()); } - continue; // not a compatible one + continue; // not a compatible one } else { if(DEBUG) { System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " _is_ instance of "+ clazzes[i].getName()); @@ -153,7 +153,7 @@ public class GLPipelineFactory { // throws exception if cstr not found! Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); Object instance = null; - try { + try { Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 4a2edc56b..15300e397 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.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. @@ -66,48 +66,48 @@ import java.util.List; /** * Specifies the the OpenGL profile. - * + * * This class static singleton initialization queries the availability of all OpenGL Profiles * and instantiates singleton GLProfile objects for each available profile. * - * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()}, + * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()}, * or more specialized versions using the other static GetProfile methods. */ public class GLProfile { - + public static final boolean DEBUG = Debug.debug("GLProfile"); - + static { // Also initializes TempJarCache if shall be used. Platform.initSingleton(); } - + /** * Static initialization of JOGL. * * <p> * This method shall not need to be called for other reasons than having a defined initialization sequence. * </p> - * + * * <P> * In case this method is not invoked, GLProfile is initialized implicit by * the first call to {@link #getDefault()}, {@link #get(java.lang.String)}. * <P> - * + * * <p> - * To initialize JOGL at startup ASAP, this method may be invoked in the <i>main class</i>'s + * To initialize JOGL at startup ASAP, this method may be invoked in the <i>main class</i>'s * static initializer block, in the <i>static main() method</i> or in the <i>Applet init() method</i>. * </p> - * + * * <p> * Since JOGL's initialization is complex and involves multi threading, it is <b>not</b> recommended - * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed + * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed * on the AWT EDT, invoke this method outside the AWT EDT - see above. * </p> - * + * */ public static void initSingleton() { - final boolean justInitialized; + final boolean justInitialized; initLock.lock(); try { if(!initialized) { // volatile: ok @@ -117,13 +117,13 @@ public class GLProfile { System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName()); Thread.dumpStack(); } - + // run the whole static initialization privileged to speed up, // since this skips checking further access AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { Platform.initSingleton(); - + // Performance hack to trigger classloading of the GL classes impl, which makes up to 12%, 800ms down to 700ms new Thread(new Runnable() { public void run() { @@ -132,15 +132,15 @@ public class GLProfile { ReflectionUtil.createInstance(getGLImplBaseClassName(GL4bc)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl); } catch (Throwable t) {} try { - ReflectionUtil.createInstance(getGLImplBaseClassName(GLES3)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl); + ReflectionUtil.createInstance(getGLImplBaseClassName(GLES3)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl); } catch (Throwable t) {} try { - ReflectionUtil.createInstance(getGLImplBaseClassName(GLES1)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl); + ReflectionUtil.createInstance(getGLImplBaseClassName(GLES1)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl); } catch (Throwable t) {} } - }, "GLProfile-GL_Bootstrapping").start(); + }, "GLProfile-GL_Bootstrapping").start(); + - if(TempJarCache.isInitialized()) { final ClassLoader cl = GLProfile.class.getClassLoader(); final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; @@ -164,13 +164,13 @@ public class GLProfile { if( justInitialized && ( hasGL234Impl || hasGLES1Impl || hasGLES3Impl ) ) { System.err.println(JoglVersion.getDefaultOpenGLInfo(defaultDevice, null, true)); } - } + } } /** * Trigger eager initialization of GLProfiles for the given device, * in case it isn't done yet. - * + * * @throws GLException if no profile for the given device is available. */ public static void initProfiles(AbstractGraphicsDevice device) throws GLException { @@ -194,7 +194,7 @@ public class GLProfile { if(DEBUG) { System.err.println("GLProfile.shutdown() - thread "+Thread.currentThread().getName()); Thread.dumpStack(); - } + } GLDrawableFactory.shutdown(); } } finally { @@ -206,11 +206,11 @@ public class GLProfile { // Query platform available OpenGL implementation // - /** + /** * Returns the availability of a profile on a device. - * + * * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. - * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), * or <code>[ null, GL ]</code> for the default profile. * @return true if the profile is available for the device, otherwise false. */ @@ -221,31 +221,31 @@ public class GLProfile { private static boolean isAvailableImpl(HashMap<String /*GLProfile_name*/, GLProfile> map, String profile) { return null != map && null != map.get(profile); } - - /** + + /** * Returns the availability of a profile on the default device. - * - * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), * or <code>[ null, GL ]</code> for the default profile. * @return true if the profile is available for the default device, otherwise false. */ public static boolean isAvailable(String profile) { return isAvailable(null, profile); } - - /** + + /** * Returns the availability of any profile on the default device. - * + * * @return true if any profile is available for the default device, otherwise false. */ public static boolean isAnyAvailable() { return isAvailable(null, null); } - + public static String glAvailabilityToString(AbstractGraphicsDevice device) { return glAvailabilityToString(device, null).toString(); } - + public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb) { return glAvailabilityToString(device, sb, null, 0); } @@ -264,19 +264,19 @@ public class GLProfile { final boolean useIndent = null != indent; initSingleton(); - + if(null==device) { device = defaultDevice; } final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, false); - + if(useIndent) { doIndent(sb, indent, indentCount).append("Native"); indentCount++; doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4bc").append(indent); } else { sb.append("Native[GL4bc "); - } + } avail=isAvailableImpl(map, GL4bc); sb.append(avail); if(avail) { @@ -366,7 +366,7 @@ public class GLProfile { sb.append(", GL4ES3 "); } sb.append(isAvailableImpl(map, GL4ES3)); - + if(useIndent) { doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES2").append(indent); } else { @@ -388,7 +388,7 @@ public class GLProfile { } else { sb.append("], Profiles["); } - + if(null != map) { for(Iterator<GLProfile> i=map.values().iterator(); i.hasNext(); ) { if(useIndent) { @@ -418,7 +418,7 @@ public class GLProfile { return sb; } - + /** Uses the default device */ public static String glAvailabilityToString() { return glAvailabilityToString(null); @@ -465,11 +465,11 @@ public class GLProfile { /** The intersection of the desktop GL4 and ES3 profile */ public static final String GL4ES3 = "GL4ES3"; - + /** The default profile, used for the device default profile map */ private static final String GL_DEFAULT = "GL_DEFAULT"; - /** + /** * All GL Profiles in the order of default detection. * Desktop compatibility profiles (the one with fixed function pipeline) comes first * from highest to lowest version. @@ -492,7 +492,7 @@ public class GLProfile { * */ public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL4bc, GL3bc, GL2, GL4, GL3, GLES3, GL4ES3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1 }; - + /** * Order of maximum profiles. * @@ -526,7 +526,7 @@ public class GLProfile { * */ public static final String[] GL_PROFILE_LIST_MIN = new String[] { GLES1, GLES2, GL2, GLES3, GL3, GL3bc, GL4, GL4bc }; - + /** * Order of minimum original desktop profiles. * @@ -540,7 +540,7 @@ public class GLProfile { * */ public static final String[] GL_PROFILE_LIST_MIN_DESKTOP = new String[] { GL2, GL3bc, GL4bc, GL3, GL4 }; - + /** * Order of maximum fixed function profiles * @@ -582,7 +582,7 @@ public class GLProfile { * */ public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER_CORE = new String[] { GL4, GL3, GLES3, GLES2 }; - + /** Returns a default GLProfile object, reflecting the best for the running platform. * It selects the first of the set {@link GLProfile#GL_PROFILE_LIST_ALL} * and favors hardware acceleration. @@ -597,7 +597,7 @@ public class GLProfile { /** Returns a default GLProfile object, reflecting the best for the running platform. * It selects the first of the set {@link GLProfile#GL_PROFILE_LIST_ALL} * and favors hardware acceleration. - * <p>Uses the default device.</p> + * <p>Uses the default device.</p> * @throws GLException if no profile is available for the default device. */ public static GLProfile getDefault() { @@ -617,7 +617,7 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX, favorHardwareRasterizer); } - /** Uses the default device + /** Uses the default device * @throws GLException if no profile is available for the default device. * @see #GL_PROFILE_LIST_MAX */ @@ -640,7 +640,7 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MIN, favorHardwareRasterizer); } - /** Uses the default device + /** Uses the default device * @throws GLException if no desktop profile is available for the default device. * @see #GL_PROFILE_LIST_MIN */ @@ -664,7 +664,7 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer); } - /** Uses the default device + /** Uses the default device * @throws GLException if no fixed function profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ @@ -687,7 +687,7 @@ public class GLProfile { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer); } - /** Uses the default device + /** Uses the default device * @throws GLException if no programmable profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ @@ -706,11 +706,11 @@ public class GLProfile { */ public static GLProfile getMaxProgrammableCore(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException - { + { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); } - /** Uses the default device + /** Uses the default device * @throws GLException if no programmable core profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE */ @@ -719,8 +719,8 @@ public class GLProfile { { return get(GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); } - - /** + + /** * Returns the GL2ES1 profile implementation, hence compatible w/ GL2ES1.<br/> * It returns: * <pre> @@ -739,8 +739,8 @@ public class GLProfile { return get(device, GL2ES1).getImpl(); } - /** - * Calls {@link #getGL2ES1(AbstractGraphicsDevice)} using the default device. + /** + * Calls {@link #getGL2ES1(AbstractGraphicsDevice)} using the default device. * <p>Selection favors hardware rasterizer.</p> * @see #getGL2ES1(AbstractGraphicsDevice) */ @@ -750,7 +750,7 @@ public class GLProfile { return get(defaultDevice, GL2ES1).getImpl(); } - /** + /** * Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.<br/> * It returns: * <pre> @@ -769,8 +769,8 @@ public class GLProfile { return get(device, GL2ES2).getImpl(); } - /** - * Calls {@link #getGL2ES2(AbstractGraphicsDevice)} using the default device. + /** + * Calls {@link #getGL2ES2(AbstractGraphicsDevice)} using the default device. * <p>Selection favors hardware rasterizer.</p> * @see #getGL2ES2(AbstractGraphicsDevice) */ @@ -780,7 +780,7 @@ public class GLProfile { return get(defaultDevice, GL2ES2).getImpl(); } - /** + /** * Returns the GL4ES3 profile implementation, hence compatible w/ GL4ES3.<br/> * It returns: * <pre> @@ -799,8 +799,8 @@ public class GLProfile { return get(device, GL4ES3).getImpl(); } - /** - * Calls {@link #getGL4ES3(AbstractGraphicsDevice)} using the default device. + /** + * Calls {@link #getGL4ES3(AbstractGraphicsDevice)} using the default device. * <p>Selection favors hardware rasterizer.</p> * @see #getGL4ES3(AbstractGraphicsDevice) */ @@ -810,7 +810,7 @@ public class GLProfile { return get(defaultDevice, GL4ES3).getImpl(); } - /** + /** * Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.<br/> * It returns: * <pre> @@ -829,8 +829,8 @@ public class GLProfile { return get(device, GL2GL3).getImpl(); } - /** - * Calls {@link #getGL2GL3(AbstractGraphicsDevice)} using the default device. + /** + * Calls {@link #getGL2GL3(AbstractGraphicsDevice)} using the default device. * <p>Selection favors hardware rasterizer.</p> * @see #getGL2GL3(AbstractGraphicsDevice) */ @@ -846,7 +846,7 @@ public class GLProfile { * the default profile. * * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. - * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), * or <code>[ null, GL ]</code> for the default profile. * @throws GLException if the requested profile is not available for the device. */ @@ -864,8 +864,8 @@ public class GLProfile { return glp; } - /** Uses the default device - * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), + /** Uses the default device + * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), * or <code>[ null, GL ]</code> for the default profile. * @throws GLException if the requested profile is not available for the default device. */ @@ -881,14 +881,14 @@ public class GLProfile { * * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..) - * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. + * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. * @throws GLException if the non of the requested profiles is available for the device. */ public static GLProfile get(AbstractGraphicsDevice device, String[] profiles, boolean favorHardwareRasterizer) throws GLException { GLProfile glProfileAny = null; - + HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, true); for(int i=0; i<profiles.length; i++) { final GLProfile glProfile = map.get(profiles[i]); @@ -901,18 +901,18 @@ public class GLProfile { } if(null==glProfileAny) { glProfileAny = glProfile; - } + } } } if(null!=glProfileAny) { return glProfileAny; - } + } throw new GLException("Profiles "+array2String(profiles)+" not available on device "+device); } - /** Uses the default device - * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..) - * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. + /** Uses the default device + * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..) + * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. * @throws GLException if the non of the requested profiles is available for the default device. */ public static GLProfile get(String[] profiles, boolean favorHardwareRasterizer) @@ -920,28 +920,28 @@ public class GLProfile { { return get(defaultDevice, profiles, favorHardwareRasterizer); } - - /** Indicates whether the native OpenGL ES1 profile is in use. + + /** Indicates whether the native OpenGL ES1 profile is in use. * This requires an EGL interface. */ public static boolean usesNativeGLES1(String profileImpl) { return GLES1.equals(profileImpl); } - /** Indicates whether the native OpenGL ES3 or ES2 profile is in use. + /** Indicates whether the native OpenGL ES3 or ES2 profile is in use. * This requires an EGL, ES3 or ES2 compatible interface. */ public static boolean usesNativeGLES2(String profileImpl) { return GLES3.equals(profileImpl) || GLES2.equals(profileImpl); } - /** Indicates whether the native OpenGL ES2 profile is in use. + /** Indicates whether the native OpenGL ES2 profile is in use. * This requires an EGL, ES3 compatible interface. */ public static boolean usesNativeGLES3(String profileImpl) { return GLES3.equals(profileImpl); } - + /** Indicates whether either of the native OpenGL ES profiles are in use. */ public static boolean usesNativeGLES(String profileImpl) { return usesNativeGLES2(profileImpl) || usesNativeGLES1(profileImpl); @@ -1014,7 +1014,7 @@ public class GLProfile { throw new GLException("unsupported profile \"" + profileImpl + "\""); } } - + /** * @param o GLProfile object to compare with * @return true if given Object is a GLProfile and @@ -1035,7 +1035,7 @@ public class GLProfile { hash = 97 * hash + getName().hashCode(); return hash; } - + /** * @param glp GLProfile to compare with * @throws GLException if given GLProfile and this aren't equal @@ -1055,14 +1055,14 @@ public class GLProfile { public final GLProfile getImpl() { return null != profileImpl ? profileImpl : this; } - + /** return true if impl. is a hardware rasterizer, otherwise false. */ public final boolean isHardwareRasterizer() { return isHardwareRasterizer; } - - /** - * return this profiles implementation name, eg. GL2ES2 -> GL2, or GL3 -> GL3 + + /** + * return this profiles implementation name, eg. GL2ES2 -> GL2, or GL3 -> GL3 */ public final String getImplName() { return null != profileImpl ? profileImpl.getName() : getName(); @@ -1102,12 +1102,12 @@ public class GLProfile { public final boolean isGLES2() { return GLES2 == profile; } - + /** Indicates whether this profile is capable of GLES3. <p>Includes [ GLES3 ].</p> */ public final boolean isGLES3() { return GLES3 == profile; } - + /** Indicates whether this profile is capable of GLES. <p>Includes [ GLES3, GLES1, GLES2 ].</p> */ public final boolean isGLES() { return GLES3 == profile || GLES2 == profile || GLES1 == profile; @@ -1122,21 +1122,21 @@ public class GLProfile { public final boolean isGL2GL3() { return GL2GL3 == profile || isGL3() || isGL2(); } - + /** Indicates whether this profile is capable of GL2ES2. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].</p> */ public final boolean isGL2ES2() { return GL2ES2 == profile || isGLES2() || isGL2GL3(); } - /** + /** * Indicates whether this profile is capable of GL2ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].</p> - * @see #isGL3ES3() - * @see #isGL2GL3() + * @see #isGL3ES3() + * @see #isGL2GL3() */ public final boolean isGL2ES3() { return isGL3ES3() || isGL2GL3(); } - + /** Indicates whether this profile is capable of GL3ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].</p> */ public final boolean isGL3ES3() { return isGL4ES3() || isGL3(); @@ -1172,7 +1172,7 @@ public class GLProfile { return usesNativeGLES2() || usesNativeGLES1(); } - /** + /** * General validation if type is a valid GL data type * for the current profile */ @@ -1200,14 +1200,14 @@ public class GLProfile { if( isGL2() ) { return true; } - } + } if(throwException) { throw new GLException("Illegal data type on profile "+this+": "+type); } return false; } - - public boolean isValidArrayDataType(int index, int comps, int type, + + public boolean isValidArrayDataType(int index, int comps, int type, boolean isVertexAttribPointer, boolean throwException) { final String arrayName = getGLArrayName(index); if( isGLES1() ) { @@ -1226,7 +1226,7 @@ public class GLProfile { case GL.GL_FIXED: case GL.GL_FLOAT: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type); } @@ -1238,7 +1238,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps); } @@ -1252,7 +1252,7 @@ public class GLProfile { case GL.GL_FIXED: case GL.GL_FLOAT: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type); } @@ -1262,7 +1262,7 @@ public class GLProfile { case 0: case 3: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps); } @@ -1275,7 +1275,7 @@ public class GLProfile { case GL.GL_FIXED: case GL.GL_FLOAT: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type); } @@ -1285,7 +1285,7 @@ public class GLProfile { case 0: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps); } @@ -1303,7 +1303,7 @@ public class GLProfile { case GL.GL_FLOAT: case GL.GL_FIXED: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GLES2: "+type); } @@ -1317,7 +1317,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GLES2: "+comps); } @@ -1335,7 +1335,7 @@ public class GLProfile { case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: case javax.media.opengl.GL2.GL_DOUBLE: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type); } @@ -1348,7 +1348,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps); } @@ -1363,7 +1363,7 @@ public class GLProfile { case javax.media.opengl.GL2ES2.GL_INT: case javax.media.opengl.GL2.GL_DOUBLE: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type); } @@ -1375,7 +1375,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps); } @@ -1390,7 +1390,7 @@ public class GLProfile { case javax.media.opengl.GL2ES2.GL_INT: case javax.media.opengl.GL2.GL_DOUBLE: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type); } @@ -1400,7 +1400,7 @@ public class GLProfile { case 0: case 3: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps); } @@ -1418,7 +1418,7 @@ public class GLProfile { case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: case javax.media.opengl.GL2.GL_DOUBLE: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type); } @@ -1429,7 +1429,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps); } @@ -1443,7 +1443,7 @@ public class GLProfile { case javax.media.opengl.GL2ES2.GL_INT: case javax.media.opengl.GL2.GL_DOUBLE: break; - default: + default: if(throwException) { throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type); } @@ -1456,7 +1456,7 @@ public class GLProfile { case 3: case 4: break; - default: + default: if(throwException) { throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps); } @@ -1475,7 +1475,7 @@ public class GLProfile { private static /*final*/ boolean isAWTAvailable; - private static /*final*/ boolean hasDesktopGLFactory; + private static /*final*/ boolean hasDesktopGLFactory; private static /*final*/ boolean hasGL234Impl; private static /*final*/ boolean hasEGLFactory; private static /*final*/ boolean hasGLES3Impl; @@ -1508,11 +1508,11 @@ public class GLProfile { // depends on hasDesktopGLFactory hasGL234Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.gl4.GL4bcImpl", classloader); - + // depends on hasEGLFactory hasGLES1Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.es1.GLES1Impl", classloader); hasGLES3Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.es3.GLES3Impl", classloader); - + // // Iteration of desktop GL availability detection // utilizing the detected GL version in the shared context. @@ -1521,7 +1521,7 @@ public class GLProfile { // which will register at GLContext .. // GLDrawableFactory.initSingleton(); - + Throwable t=null; // if successfull it has a shared dummy drawable and context created try { @@ -1592,14 +1592,14 @@ public class GLProfile { System.err.println("Info: GLProfile.init - EGL GLDrawable factory not available"); } } else { - defaultEGLDevice = eglFactory.getDefaultDevice(); + defaultEGLDevice = eglFactory.getDefaultDevice(); } if( null != defaultDesktopDevice ) { defaultDevice = defaultDesktopDevice; if(DEBUG) { System.err.println("Info: GLProfile.init - Default device is desktop derived: "+defaultDevice); - } + } } else if ( null != defaultEGLDevice ) { defaultDevice = defaultEGLDevice; if(DEBUG) { @@ -1611,12 +1611,12 @@ public class GLProfile { } defaultDevice = null; } - + // we require to initialize the EGL device 1st, if available final boolean addedEGLProfile = null != defaultEGLDevice ? initProfilesForDevice(defaultEGLDevice) : false; - final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false; + final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false; final boolean addedAnyProfile = addedEGLProfile || addedDesktopProfile ; - + if(DEBUG) { System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", egl "+addedEGLProfile+")"); System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable); @@ -1672,8 +1672,8 @@ public class GLProfile { boolean addedDesktopProfile = false; boolean addedEGLProfile = false; - final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device); - + final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device); + if( deviceIsDesktopCompatible ) { // 1st pretend we have all Desktop and EGL profiles .. computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */); @@ -1698,9 +1698,9 @@ public class GLProfile { } addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */); } - + final boolean deviceIsEGLCompatible = hasEGLFactory && eglFactory.getIsDeviceCompatible(device); - + // also test GLES1, GLES2 and GLES3 on desktop, since we have implementations / emulations available. if( deviceIsEGLCompatible && ( hasGLES3Impl || hasGLES1Impl ) ) { // 1st pretend we have all EGL profiles .. @@ -1718,7 +1718,7 @@ public class GLProfile { } if(!eglSharedCtxAvail) { // Remark: On Windows there is a libEGL.dll delivered w/ Chrome 15.0.874.121m and Firefox 8.0.1 - // but it seems even EGL.eglInitialize(eglDisplay, null, null) + // but it seems even EGL.eglInitialize(eglDisplay, null, null) // fails in some scenarios (eg VirtualBox 4.1.6) w/ EGL error 0x3001 (EGL_NOT_INITIALIZED). hasEGLFactory = false; hasGLES3Impl = false; @@ -1993,7 +1993,7 @@ public class GLProfile { return null; } - private static /*final*/ HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>> deviceConn2ProfileMap = + private static /*final*/ HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>> deviceConn2ProfileMap = new HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>>(); /** @@ -2004,22 +2004,22 @@ public class GLProfile { * * @param device the key 'device -> GLProfiles-Map' * @param throwExceptionOnZeroProfile true if <code>GLException</code> shall be thrown in case of no mapped profile, otherwise false. - * @return the GLProfile HashMap if exists, otherwise null + * @return the GLProfile HashMap if exists, otherwise null * @throws GLException if no profile for the given device is available. */ - private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile) - throws GLException + private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile) + throws GLException { initSingleton(); if(null==defaultDevice) { // avoid NPE and notify of incomplete initialization throw new GLException("No default device available"); } - + if(null==device) { device = defaultDevice; } - + final String deviceKey = device.getUniqueID(); HashMap<String /*GLProfile_name*/, GLProfile> map = deviceConn2ProfileMap.get(deviceKey); if( null != map ) { diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable.java b/src/jogl/classes/javax/media/opengl/GLRunnable.java index 1ae1c9b22..ad68662ce 100644 --- a/src/jogl/classes/javax/media/opengl/GLRunnable.java +++ b/src/jogl/classes/javax/media/opengl/GLRunnable.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 javax.media.opengl; /** @@ -33,8 +33,8 @@ package javax.media.opengl; * Declares a one-shot OpenGL command usable for injection * via {@link GLAutoDrawable#invoke(boolean, javax.media.opengl.GLRunnable)}.<br> * {@link GLAutoDrawable} executes the GLRunnables within it's {@link GLAutoDrawable#display() display()} - * method after all registered {@link GLEventListener}s - * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} + * method after all registered {@link GLEventListener}s + * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} * methods has been called. * </p> * <p> @@ -44,13 +44,13 @@ package javax.media.opengl; * This might be useful to inject OpenGL commands from an I/O event listener. * </p> */ -public interface GLRunnable { +public interface GLRunnable { /** * @param drawable the associated drawable and current context for this call * @return true if the GL [back] framebuffer remains intact by this runnable, otherwise false. * If returning false {@link GLAutoDrawable} will call - * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} - * of all registered {@link GLEventListener}s once more. + * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} + * of all registered {@link GLEventListener}s once more. * @see GLRunnable */ boolean run(GLAutoDrawable drawable); diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable2.java b/src/jogl/classes/javax/media/opengl/GLRunnable2.java index 1598a6215..5f0393257 100644 --- a/src/jogl/classes/javax/media/opengl/GLRunnable2.java +++ b/src/jogl/classes/javax/media/opengl/GLRunnable2.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 javax.media.opengl; /** @@ -33,11 +33,11 @@ package javax.media.opengl; * Declares a one-shot OpenGL command. * </p> */ -public interface GLRunnable2<T,U> { +public interface GLRunnable2<T,U> { /** * @param gl a current GL object * @param args custom arguments - * @return the desired object + * @return the desired object */ T run(GL gl, U args); } diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java index 60d0c58bf..700bba2eb 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java @@ -77,16 +77,16 @@ public class GLUniformData { sb = new StringBuilder(); } sb.append("GLUniformData[name ").append(name). - append(", location ").append(location). + append(", location ").append(location). append(", size ").append(rows).append("x").append(columns). - append(", count ").append(count). - append(", data "); + append(", count ").append(count). + append(", data "); if(isMatrix() && data instanceof FloatBuffer) { sb.append("\n"); - final FloatBuffer fb = (FloatBuffer)getBuffer(); + final FloatBuffer fb = (FloatBuffer)getBuffer(); for(int i=0; i<count; i++) { FloatUtil.matrixToString(sb, i+": ", "%10.5f", fb, i*rows*columns, rows, columns, false); - sb.append(",\n"); + sb.append(",\n"); } } else if(isBuffer()) { Buffers.toString(sb, null, getBuffer()); @@ -96,7 +96,7 @@ public class GLUniformData { sb.append("]"); return sb; } - + public String toString() { return toString(null).toString(); } @@ -166,7 +166,7 @@ public class GLUniformData { location = gl.glGetUniformLocation(program, name); return location; } - + public Object getObject() { return data; } diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java index 4788f9cf6..7503e9cf7 100644 --- a/src/jogl/classes/javax/media/opengl/Threading.java +++ b/src/jogl/classes/javax/media/opengl/Threading.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. */ @@ -42,7 +42,7 @@ package javax.media.opengl; import jogamp.opengl.ThreadingImpl; -/** This API provides access to the threading model for the implementation of +/** This API provides access to the threading model for the implementation of the classes in this package. <P> @@ -59,12 +59,12 @@ import jogamp.opengl.ThreadingImpl; Due to these limitations, and due to the inherent multithreading in the Java platform (in particular, in the Abstract Window - Toolkit), it is often necessary to limit the multithreading - occurring in the typical application using the OpenGL API. + Toolkit), it is often necessary to limit the multithreading + occurring in the typical application using the OpenGL API. <P> - In the current reference implementation, for instance, multithreading + In the current reference implementation, for instance, multithreading has been limited by forcing all OpenGL-related work for GLAutoDrawables on to a single thread. In other words, if an application uses only the @@ -93,9 +93,9 @@ import jogamp.opengl.ThreadingImpl; This class also provides mechanisms for querying whether this internal serialization of OpenGL work is in effect, and a - programmatic way of disabling it. In the current reference - implementation it is enabled by default, although it could be - disabled in the future if OpenGL drivers become more robust on + programmatic way of disabling it. In the current reference + implementation it is enabled by default, although it could be + disabled in the future if OpenGL drivers become more robust on all platforms. <P> @@ -113,7 +113,7 @@ import jogamp.opengl.ThreadingImpl; platforms, and also the default behavior older releases) -Djogl.1thread=worker Enable single-threading of OpenGL work on newly-created worker thread (not suitable for Mac OS X or X11 platforms, and risky on Windows in applet environments) - </PRE> + </PRE> */ public class Threading { @@ -121,9 +121,9 @@ public class Threading { /** No reason to ever instantiate this class */ private 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 + /** 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 @@ -133,7 +133,7 @@ public class Threading { 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() { ThreadingImpl.disableSingleThreading(); } @@ -145,11 +145,11 @@ public class Threading { } /** Indicates whether the current thread is the designated toolkit thread, - if such semantics exists. */ + if such semantics exists. */ public static final boolean isToolkitThread() throws GLException { return ThreadingImpl.isToolkitThread(); } - + /** Indicates whether the current thread is the single thread on which this implementation of the javax.media.opengl APIs performs all of its OpenGL-related work. This method should only @@ -166,12 +166,12 @@ public class Threading { thread (i.e., if <code>isOpenGLThread()</code> returns false). It is up to the end user to check to see whether the current thread is the OpenGL thread and either execute the - Runnable directly or perform the work inside it. + Runnable directly or perform the work inside it. **/ public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { ThreadingImpl.invokeOnOpenGLThread(wait, r); } - + /** * If {@link #isSingleThreaded()} <b>and</b> not {@link #isOpenGLThread()} * <b>and</b> the <code>lock</code> is not being hold by this thread, @@ -179,14 +179,14 @@ public class Threading { * <p> * Otherwise invoke Runnable <code>r</code> on the current thread. * </p> - * - * @param wait set to true for waiting until Runnable <code>r</code> is finished, otherwise false. + * + * @param wait set to true for waiting until Runnable <code>r</code> is finished, otherwise false. * @param r the Runnable to be executed * @param lock optional lock object to be tested * @throws GLException */ public static final void invoke(boolean wait, Runnable r, Object lock) throws GLException { - if ( isSingleThreaded() && !isOpenGLThread() && + if ( isSingleThreaded() && !isOpenGLThread() && ( null == lock || !Thread.holdsLock(lock) ) ) { invokeOnOpenGLThread(wait, r); } else { diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/javax/media/opengl/TraceGL2.java index 58f5d9f99..c577332e9 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL2.java @@ -12,7 +12,7 @@ import java.io.PrintStream; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/javax/media/opengl/TraceGL3.java index 616b31f61..5fccf40c7 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3.java @@ -12,7 +12,7 @@ import java.io.PrintStream; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java index f3761d4d6..84f537f60 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java @@ -12,7 +12,7 @@ import java.io.PrintStream; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/javax/media/opengl/TraceGL4.java index a12bf0f47..afe2cd9a1 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL4.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL4.java @@ -12,7 +12,7 @@ import java.io.PrintStream; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/javax/media/opengl/TraceGLES2.java index 38d60e3ac..4740e2e72 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGLES2.java @@ -12,7 +12,7 @@ import java.io.PrintStream; * Sample code which installs this pipeline, manual: * <pre> * gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err)); - * </pre> + * </pre> * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. * </p> */ diff --git a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java b/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java index 0c4f63c2d..5feaa5760 100644 --- a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java +++ b/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 6828beb10..f08fbafe8 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -115,15 +115,15 @@ import jogamp.opengl.awt.AWTTilePainter; of Z-ordering or LayoutManager problems. * * <h5><A NAME="java2dgl">Offscreen Layer Remarks</A></h5> - * + * * {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)} - * maybe called to use an offscreen drawable (FBO or PBuffer) allowing + * maybe called to use an offscreen drawable (FBO or PBuffer) allowing * the underlying JAWT mechanism to composite the image, if supported. * <p> * {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)} * is being called if {@link GLCapabilitiesImmutable#isOnscreen()} is <code>false</code>. * </p> - * + * * <h5><A NAME="java2dgl">Java2D OpenGL Remarks</A></h5> * * To avoid any conflicts with a potential Java2D OpenGL context,<br> @@ -274,7 +274,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public final Object getUpstreamWidget() { return this; } - + @Override public void setShallUseOffscreenLayer(boolean v) { shallUseOffscreenLayer = v; @@ -315,11 +315,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * all platforms since the peer hasn't been created. */ final GraphicsConfiguration gc = super.getGraphicsConfiguration(); - + if( Beans.isDesignTime() ) { return gc; } - + /* * chosen is only non-null on platforms where the GLDrawableFactory * returns a non-null GraphicsConfiguration (in the GLCanvas @@ -431,11 +431,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing _lock.unlock(); } } - + private final void setRealizedImpl(boolean realized) { final RecursiveLock _lock = lock; _lock.lock(); - try { + try { final GLDrawable _drawable = drawable; if( null == _drawable || realized == _drawable.isRealized() || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) { @@ -448,10 +448,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } finally { _lock.unlock(); } - } + } private final Runnable realizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(true); } }; private final Runnable unrealizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(false); } }; - + @Override public final void setRealized(boolean realized) { // Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock! @@ -503,7 +503,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void destroy() { destroyImpl( false ); } - + protected void destroyImpl(boolean destroyJAWTWindowAndAWTDevice) { Threading.invoke(true, destroyOnEDTAction, getTreeLock()); if( destroyJAWTWindowAndAWTDevice ) { @@ -553,14 +553,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void addNotify() { final RecursiveLock _lock = lock; _lock.lock(); - try { + try { final boolean isBeansDesignTime = Beans.isDesignTime(); - + if(DEBUG) { System.err.println(getThreadName()+": Info: addNotify - start, bounds: "+this.getBounds()+", isBeansDesignTime "+isBeansDesignTime); // Thread.dumpStack(); } - + if( isBeansDesignTime ) { super.addNotify(); } else { @@ -576,21 +576,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if(null==awtConfig) { throw new GLException("Error: NULL AWTGraphicsConfiguration"); } - + // before native peer is valid: X11 disableBackgroundErase(); - + // issues getGraphicsConfiguration() and creates the native peer super.addNotify(); - + // after native peer is valid: Windows disableBackgroundErase(); - + createDrawableAndContext( true ); - + // init drawable by paint/display makes the init sequence more equal // for all launch flavors (applet/javaws/..) - // validateGLDrawable(); + // validateGLDrawable(); } awtWindowClosingProtocol.addClosingListener(); @@ -606,7 +606,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if ( !Beans.isDesignTime() ) { if( createJAWTWindow ) { jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig); - jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); + jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); } jawtWindow.lockSurface(); try { @@ -617,7 +617,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing jawtWindow.unlockSurface(); } } - } + } private boolean validateGLDrawable() { if( Beans.isDesignTime() || !isDisplayable() ) { @@ -641,7 +641,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } return false; } - + /** <p>Overridden to track when this component is removed from a container. Subclasses which override this method must call super.removeNotify() in their removeNotify() method in order to @@ -686,13 +686,13 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void reshape(int x, int y, int width, int height) { synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape super.reshape(x, y, width, height); - + if(DEBUG) { final NativeSurface ns = getNativeSurface(); final long nsH = null != ns ? ns.getSurfaceHandle() : 0; System.err.println("GLCanvas.sizeChanged: ("+getThreadName()+"): "+width+"x"+height+" - surfaceHandle 0x"+Long.toHexString(nsH)); // Thread.dumpStack(); - } + } if( validateGLDrawable() && !printActive ) { final GLDrawableImpl _drawable = drawable; if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) { @@ -701,7 +701,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing try { final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, width, height); if(_drawable != _drawableNew) { - // write back + // write back drawable = _drawableNew; } } finally { @@ -723,13 +723,13 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } private volatile boolean printActive = false; - private GLAnimatorControl printAnimator = null; + private GLAnimatorControl printAnimator = null; private GLAutoDrawable printGLAD = null; private AWTTilePainter printAWTTiles = null; - + @Override public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { - printActive = true; + printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG); @@ -742,14 +742,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if(DEBUG) { System.err.println(getThreadName()+": Info: GLCanvas setupPrint - skipped GL render, drawable not valid yet"); } - printActive = false; + printActive = false; return; // not yet available .. } if( !isVisible() ) { if(DEBUG) { System.err.println(getThreadName()+": Info: GLCanvas setupPrint - skipped GL render, drawable visible"); } - printActive = false; + printActive = false; return; // not yet available .. } sendReshape = false; // clear reshape flag @@ -757,7 +757,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if( null != printAnimator ) { printAnimator.remove(GLCanvas.this); } - printGLAD = GLCanvas.this; // _not_ default, shall be replaced by offscreen GLAD + printGLAD = GLCanvas.this; // _not_ default, shall be replaced by offscreen GLAD final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable(); final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); @@ -783,8 +783,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing caps.setNumSamples(printNumSamples); } final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, - printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, + printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, + printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE, null); GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD); @@ -801,7 +801,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } } }; - + @Override public void releasePrint() { if( !printActive || null == printGLAD ) { @@ -832,7 +832,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing display(); } }; - + @Override public void print(Graphics graphics) { if( !printActive || null == printGLAD ) { @@ -843,7 +843,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing // we cannot dispatch print on AWT-EDT due to printing internal locking .. } sendReshape = false; // clear reshape flag - + final Graphics2D g2d = (Graphics2D)graphics; try { printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight()); @@ -876,7 +876,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing System.err.println("AWT print.X: "+printAWTTiles); } } - + @Override public void addGLEventListener(GLEventListener listener) { helper.addGLEventListener(listener); @@ -906,14 +906,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } - + @Override public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); Threading.invoke(true, r, getTreeLock()); return r.listener; } - + @Override public GLEventListener removeGLEventListener(GLEventListener listener) { return helper.removeGLEventListener(listener); @@ -948,7 +948,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) { return helper.invoke(this, wait, glRunnables); } - + @Override public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { final RecursiveLock _lock = lock; @@ -967,7 +967,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public final GLDrawable getDelegatedDrawable() { return drawable; } - + @Override public GLContext getContext() { return context; @@ -1049,7 +1049,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.isGLOriented() : true; } - + @Override public NativeSurface getNativeSurface() { final GLDrawable _drawable = drawable; @@ -1093,7 +1093,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { final RecursiveLock _lock = lock; _lock.lock(); - try { + try { final GLAnimatorControl animator = getAnimator(); if(DEBUG) { @@ -1101,7 +1101,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing (null!=context) + ", hasDrawable " + (null!=drawable)+", "+animator); // Thread.dumpStack(); } - + final boolean animatorPaused; if(null!=animator) { // can't remove us from animator for recreational addNotify() @@ -1109,7 +1109,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } else { animatorPaused = false; } - + // OLS will be detached by disposeGL's context destruction below if( null != context ) { if( context.isCreated() ) { @@ -1137,11 +1137,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if(animatorPaused) { animator.resume(); } - + if(DEBUG) { System.err.println(getThreadName()+": dispose() - END, animator "+animator); } - + } finally { _lock.unlock(); } @@ -1170,7 +1170,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } jawtWindow=null; } - + if(null != awtConfig) { final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration(); final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice(); @@ -1188,7 +1188,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing awtConfig=null; } }; - + private final Runnable initAction = new Runnable() { @Override public void run() { @@ -1250,7 +1250,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing this.listener = listener; this.remove = remove; } - + @Override public void run() { final RecursiveLock _lock = lock; @@ -1262,7 +1262,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } } }; - + // Disables the AWT's erasing of this Canvas's background on Windows // in Java SE 6. This internal API is not available in previous // releases, but the system property diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 1ec0ad7bc..84db62515 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -129,7 +129,7 @@ import com.jogamp.opengl.util.texture.TextureState; </p> <p> In case the above mentioned GLSL vertical-flipping is not performed, - {@link System#arraycopy(Object, int, Object, int, int) System.arraycopy(..)} is used line by line. + {@link System#arraycopy(Object, int, Object, int, int) System.arraycopy(..)} is used line by line. This step causes more CPU load per frame and is not hardware-accelerated. </p> <p> @@ -139,8 +139,8 @@ import com.jogamp.opengl.util.texture.TextureState; <P> * Please read <a href="GLCanvas.html#java2dgl">Java2D OpenGL Remarks</a>. * </P> - * - <a name="fboGLSLVerticalFlip"><h5>FBO / GLSL Vertical Flip</h5></a> + * + <a name="fboGLSLVerticalFlip"><h5>FBO / GLSL Vertical Flip</h5></a> The FBO / GLSL code path uses one texture-unit and binds the FBO texture to it's active texture-target, see {@link #setTextureUnit(int)} and {@link #getTextureUnit()}. <p> @@ -154,7 +154,7 @@ import com.jogamp.opengl.util.texture.TextureState; <i>Warning (Bug 842)</i>: Certain GL states other than viewport and texture (see above) influencing rendering, will also influence the GLSL vertical flip, e.g. {@link GL#glFrontFace(int) glFrontFace}({@link GL#GL_CCW}). It is recommended to reset those states to default when leaving the {@link GLEventListener#display(GLAutoDrawable)} method! - We may change this behavior in the future, i.e. preserve all influencing states. + We may change this behavior in the future, i.e. preserve all influencing states. </p> */ @@ -162,23 +162,23 @@ import com.jogamp.opengl.util.texture.TextureState; public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosingProtocol, AWTPrintLifecycle { private static final boolean DEBUG; private static final boolean DEBUG_VIEWPORT; - private static final boolean USE_GLSL_TEXTURE_RASTERIZER; + private static final boolean USE_GLSL_TEXTURE_RASTERIZER; /** Indicates whether the Java 2D OpenGL pipeline is requested by user. */ private static final boolean java2dOGLEnabledByProp; - + /** Indicates whether the Java 2D OpenGL pipeline is enabled, resource-compatible and requested by user. */ private static final boolean useJava2DGLPipeline; - + /** Indicates whether the Java 2D OpenGL pipeline's usage is error free. */ private static boolean java2DGLPipelineOK; - + static { Debug.initSingleton(); DEBUG = Debug.debug("GLJPanel"); DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); - + boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false); java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true); @@ -201,7 +201,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println("GLJPanel: java2DGLPipelineOK "+java2DGLPipelineOK); } } - + private static SingleAWTGLPixelBufferProvider singleAWTGLPixelBufferProvider = null; private static synchronized SingleAWTGLPixelBufferProvider getSingleAWTGLPixelBufferProvider() { if( null == singleAWTGLPixelBufferProvider ) { @@ -209,7 +209,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } return singleAWTGLPixelBufferProvider; } - + private GLDrawableHelper helper = new GLDrawableHelper(); private volatile boolean isInitialized; @@ -236,14 +236,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // Width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width private int panelWidth = 0; private int panelHeight = 0; - + // These are always set to (0, 0) except when the Java2D / OpenGL // pipeline is active private int viewportX; private int viewportY; private int requestedTextureUnit = 0; // default - + // The backend in use private volatile Backend backend; @@ -316,7 +316,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing this.factory = GLDrawableFactoryImpl.getFactoryImpl(glProfile); this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser()); this.shareWith = shareWith; - + this.setFocusable(true); // allow keyboard input! } @@ -336,12 +336,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } customPixelBufferProvider = custom; } - + @Override public final Object getUpstreamWidget() { return this; } - + @Override public void display() { if( isVisible() ) { @@ -446,7 +446,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing handleReshape = false; sendReshape = handleReshape(); } - + if( isVisible() ) { updater.setGraphics(g); backend.doPaintComponent(g); @@ -489,7 +489,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing which override this method must call super.reshape() in their reshape() method in order to function properly. <P> * - * {@inheritDoc} + * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override @@ -500,7 +500,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.reshape resize"+(printActive?"WithinPrint":"")+" [ panel "+ panelWidth+"x"+panelHeight + ", reshape: " +reshapeWidth+"x"+reshapeHeight + - "] -> "+(printActive?"skipped":"") + width+"x"+height); + "] -> "+(printActive?"skipped":"") + width+"x"+height); } if( !printActive ) { reshapeWidth = width; @@ -510,13 +510,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } private volatile boolean printActive = false; - private GLAnimatorControl printAnimator = null; + private GLAnimatorControl printAnimator = null; private GLAutoDrawable printGLAD = null; private AWTTilePainter printAWTTiles = null; - + @Override public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { - printActive = true; + printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG); @@ -532,14 +532,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if(DEBUG) { System.err.println(getThreadName()+": Info: GLJPanel setupPrint - skipped GL render, drawable not valid yet"); } - printActive = false; + printActive = false; return; // not yet available .. } if( !isVisible() ) { if(DEBUG) { System.err.println(getThreadName()+": Info: GLJPanel setupPrint - skipped GL render, drawable visible"); } - printActive = false; + printActive = false; return; // not yet available .. } sendReshape = false; // clear reshape flag @@ -548,8 +548,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if( null != printAnimator ) { printAnimator.remove(GLJPanel.this); } - - printGLAD = GLJPanel.this; // default: re-use + + printGLAD = GLJPanel.this; // default: re-use final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable(); final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); @@ -570,8 +570,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing caps.setSampleBuffers(0 < printNumSamples); caps.setNumSamples(printNumSamples); final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, - printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, + printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, + printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE, null); GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD); @@ -588,7 +588,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } }; - + @Override public void releasePrint() { if( !printActive ) { @@ -598,7 +598,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing handleReshape = false; // ditto AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT); } - + private final Runnable releasePrintOnEDT = new Runnable() { @Override public void run() { @@ -616,7 +616,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing printAnimator.add(GLJPanel.this); printAnimator = null; } - + // trigger reshape, i.e. gl-viewport and -listener - this component might got resized! final int awtWidth = GLJPanel.this.getWidth(); final int awtHeight= GLJPanel.this.getHeight(); @@ -639,7 +639,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing display(); } }; - + @Override public void print(Graphics graphics) { if( !printActive ) { @@ -651,7 +651,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } sendReshape = false; // clear reshape flag handleReshape = false; // ditto - + final Graphics2D g2d = (Graphics2D)graphics; try { printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight()); @@ -691,7 +691,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } print(g); } - + @Override public void setOpaque(boolean opaque) { if (backend != null) { @@ -729,7 +729,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } - + @Override public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); @@ -746,7 +746,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } return r.listener; } - + @Override public GLEventListener removeGLEventListener(GLEventListener listener) { return helper.removeGLEventListener(listener); @@ -781,7 +781,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) { return helper.invoke(this, wait, glRunnables); } - + @Override public GLContext createContext(GLContext shareWith) { final Backend b = backend; @@ -821,7 +821,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } return b.getDrawable(); } - + @Override public GLContext getContext() { final Backend b = backend; @@ -918,7 +918,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } return b.getDrawable().isGLOriented(); } - + @Override public GLCapabilitiesImmutable getChosenGLCapabilities() { final Backend b = backend; @@ -956,11 +956,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing return factory; } - /** + /** * Returns the used texture unit, i.e. a value of [0..n], or -1 if non used. * <p> * If implementation uses a texture-unit, it will be known only after the first initialization, i.e. display call. - * </p> + * </p> * <p> * See <a href="#fboGLSLVerticalFlip">FBO / GLSL Vertical Flip</a>. * </p> @@ -970,9 +970,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if ( null == b ) { return -1; } - return b.getTextureUnit(); + return b.getTextureUnit(); } - + /** * Allows user to request a texture unit to be used, * must be called before the first initialization, i.e. {@link #display()} call. @@ -982,14 +982,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * <p> * See <a href="#fboGLSLVerticalFlip">FBO / GLSL Vertical Flip</a>. * </p> - * + * * @param v requested texture unit * @see #getTextureUnit() */ public final void setTextureUnit(int v) { requestedTextureUnit = v; } - + //---------------------------------------------------------------------- // Internals only below this point // @@ -1004,7 +1004,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (DEBUG) { System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight); - } + } // Pull down reshapeWidth and reshapeHeight into panelWidth and // panelHeight eagerly in order to complete initialization, and // force a reshape later @@ -1039,7 +1039,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean handleReshape() { if (DEBUG) { System.err.println(getThreadName()+": GLJPanel.handleReshape: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight); - } + } panelWidth = reshapeWidth; panelHeight = reshapeHeight; @@ -1089,7 +1089,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing public void plainPaint(GLAutoDrawable drawable) { helper.display(GLJPanel.this); } - + @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { // This is handled above and dispatched directly to the appropriate context @@ -1148,7 +1148,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing updater.plainPaint(GLJPanel.this); } }; - + private final Runnable paintImmediatelyAction = new Runnable() { @Override public void run() { @@ -1172,7 +1172,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } }; - + private int getGLInteger(GL gl, int which) { int[] tmp = new int[1]; gl.glGetIntegerv(which, tmp, 0); @@ -1203,7 +1203,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing /** Called when the opacity of the GLJPanel is changed */ public void setOpaque(boolean opaque); - /** + /** * Called to manually create an additional OpenGL context against * this GLJPanel */ @@ -1220,7 +1220,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing /** Returns the used texture unit, i.e. a value of [0..n], or -1 if non used. */ public int getTextureUnit(); - + /** Called to fetch the "real" GLCapabilities for the backend */ public GLCapabilitiesImmutable getChosenGLCapabilities(); @@ -1240,7 +1240,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing */ public boolean preGL(Graphics g); - /** + /** * Called after the OpenGL work is done in init() and display(). * The isDisplay argument indicates whether this was called on * behalf of a call to display() rather than init(). @@ -1262,7 +1262,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private final boolean useSingletonBuffer; private AWTGLPixelBuffer pixelBuffer; private BufferedImage alignedImage; - + // One of these is used to store the read back pixels before storing // in the BufferedImage protected IntBuffer readBackIntsForCPUVFlip; @@ -1272,10 +1272,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean offscreenIsFBO; private FBObject fboFlipped; private GLSLTextureRaster glslTextureRaster; - + private GLContextImpl offscreenContext; - private boolean flipVertical; - + private boolean flipVertical; + // For saving/restoring of OpenGL state during ReadPixels private final GLPixelStorageModes psm = new GLPixelStorageModes(); @@ -1291,7 +1291,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing useSingletonBuffer = false; } } - + @Override public boolean isUsingOwnLifecycle() { return false; } @@ -1351,11 +1351,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } else { fboFlipped = null; glslTextureRaster = null; - } + } offscreenContext.release(); } else { isInitialized = false; - } + } } finally { if( !isInitialized ) { if(null != offscreenContext) { @@ -1376,7 +1376,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": OffscreenBackend: destroy() - offscreenContext: "+(null!=offscreenContext)+" - offscreenDrawable: "+(null!=offscreenDrawable)); } if ( null != offscreenContext && offscreenContext.isCreated() ) { - if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) { + if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) { try { final GL gl = offscreenContext.getGL(); if(null != glslTextureRaster) { @@ -1394,7 +1394,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing glslTextureRaster = null; fboFlipped = null; offscreenContext = null; - + if (offscreenDrawable != null) { final AbstractGraphicsDevice adevice = offscreenDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); offscreenDrawable.setRealized(false); @@ -1404,8 +1404,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } offscreenIsFBO = false; - - if( null != readBackIntsForCPUVFlip ) { + + if( null != readBackIntsForCPUVFlip ) { readBackIntsForCPUVFlip.clear(); readBackIntsForCPUVFlip = null; } @@ -1449,10 +1449,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing componentCount = 4; alignment = 4; } - - final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount); - - if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer + + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount); + + if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(pixelAttribs); } if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) { @@ -1463,7 +1463,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if ( null == pixelBuffer ) { if (0 >= panelWidth || 0 >= panelHeight ) { return; - } + } pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, panelWidth, panelHeight, 1, true, 0); if(DEBUG) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName()); @@ -1482,7 +1482,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } final IntBuffer readBackInts; - + if( !flipVertical || null != glslTextureRaster ) { readBackInts = (IntBuffer) pixelBuffer.buffer; } else { @@ -1494,7 +1494,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final TextureState usrTexState, fboTexState; final int fboTexUnit = GL.GL_TEXTURE0 + ( offscreenIsFBO ? ((GLFBODrawable)offscreenDrawable).getTextureUnit() : 0 ); - + if( offscreenIsFBO ) { usrTexState = new TextureState(gl, GL.GL_TEXTURE_2D); if( fboTexUnit != usrTexState.getUnit() ) { @@ -1510,9 +1510,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing usrTexState = null; fboTexState = null; } - + // Must now copy pixels from offscreen context into surface - + // Save current modes psm.setAlignment(gl, alignment, alignment); if(gl.isGL2ES3()) { @@ -1520,14 +1520,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing gl2es3.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, panelWidth); gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer()); } - + offscreenDrawable.swapBuffers(); - + if(null != glslTextureRaster) { // implies flippedVertical final boolean viewportChange; final int[] usrViewport = new int[] { 0, 0, 0, 0 }; gl.glGetIntegerv(GL.GL_VIEWPORT, usrViewport, 0); - viewportChange = 0 != usrViewport[0] || 0 != usrViewport[1] || + viewportChange = 0 != usrViewport[0] || 0 != usrViewport[1] || offscreenDrawable.getWidth() != usrViewport[2] || offscreenDrawable.getHeight() != usrViewport[3]; if( DEBUG_VIEWPORT ) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: Viewport: change "+viewportChange+ @@ -1536,21 +1536,21 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } if( viewportChange ) { gl.glViewport(0, 0, offscreenDrawable.getWidth(), offscreenDrawable.getHeight()); - } - - // perform vert-flipping via OpenGL/FBO + } + + // perform vert-flipping via OpenGL/FBO final GLFBODrawable fboDrawable = (GLFBODrawable)offscreenDrawable; final FBObject.TextureAttachment fboTex = fboDrawable.getTextureBuffer(GL.GL_FRONT); - + fboFlipped.bind(gl); - + // gl.glActiveTexture(GL.GL_TEXTURE0 + fboDrawable.getTextureUnit()); // implicit by GLFBODrawableImpl: swapBuffers/contextMadeCurent -> swapFBOImpl - gl.glBindTexture(GL.GL_TEXTURE_2D, fboTex.getName()); + gl.glBindTexture(GL.GL_TEXTURE_2D, fboTex.getName()); // gl.glClear(GL.GL_DEPTH_BUFFER_BIT); // fboFlipped runs w/o DEPTH! - + glslTextureRaster.display(gl.getGL2ES2()); gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts); - + fboFlipped.unbind(gl); if( viewportChange ) { gl.glViewport(usrViewport[0], usrViewport[1], usrViewport[2], usrViewport[3]); @@ -1558,7 +1558,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing fboTexState.restore(gl); } else { gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts); - + if ( flipVertical ) { // Copy temporary data into raster of BufferedImage for faster // blitting Note that we could avoid this copy in the cases @@ -1586,7 +1586,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // correctness on all platforms } } - + @Override public int getTextureUnit() { if(null != glslTextureRaster && null != offscreenDrawable) { // implies flippedVertical @@ -1598,16 +1598,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public void doPaintComponent(Graphics g) { helper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction); - + if ( null != alignedImage ) { // Draw resulting image in one shot g.drawImage(alignedImage, 0, 0, alignedImage.getWidth(), alignedImage.getHeight(), null); // Null ImageObserver since image data is ready. } } - + @Override public void doPlainPaint() { - helper.invokeGL(offscreenDrawable, offscreenContext, updaterPlainDisplayAction, updaterInitAction); + helper.invokeGL(offscreenDrawable, offscreenContext, updaterPlainDisplayAction, updaterInitAction); } @Override @@ -1616,7 +1616,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing { final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, offscreenContext, panelWidth, panelHeight); if(_drawable != _drawableNew) { - // write back + // write back _drawable = _drawableNew; offscreenDrawable = _drawableNew; } @@ -1626,9 +1626,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } panelWidth = _drawable.getWidth(); panelHeight = _drawable.getHeight(); - + if( null != glslTextureRaster ) { - if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) { + if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) { try { final GL gl = offscreenContext.getGL(); fboFlipped.reset(gl, _drawable.getWidth(), _drawable.getHeight(), 0, false); @@ -1640,7 +1640,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } return _drawable.isRealized(); } - + @Override public GLContext createContext(GLContext shareWith) { return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null; @@ -1790,7 +1790,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public int getTextureUnit() { return -1; } - + @Override public GLCapabilitiesImmutable getChosenGLCapabilities() { // FIXME: should do better than this; is it possible to using only platform-independent code? @@ -2114,9 +2114,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing @Override public void doPlainPaint() { - helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction); + helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction); } - + private void captureJ2DState(GL gl, Graphics g) { gl.glGetIntegerv(GL2.GL_DRAW_BUFFER, drawBuffer, 0); gl.glGetIntegerv(GL2.GL_READ_BUFFER, readBuffer, 0); diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java index 9fee0a2e2..b4d788329 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java +++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java @@ -58,18 +58,18 @@ public interface GLMatrixFunc { * which is the same behavior than the native JOGL GL impl */ public void glGetFloatv(int pname, java.nio.FloatBuffer params); - + /** * Copy the named matrix to the given storage at offset. * @param pname {@link #GL_MODELVIEW_MATRIX}, {@link #GL_PROJECTION_MATRIX} or {@link #GL_TEXTURE_MATRIX} * @param params storage * @param params_offset storage offset - */ + */ public void glGetFloatv(int pname, float[] params, int params_offset); - + /** * glGetIntegerv - * @param pname {@link #GL_MATRIX_MODE} to receive the current matrix mode + * @param pname {@link #GL_MATRIX_MODE} to receive the current matrix mode * @param params the FloatBuffer's position remains unchanged * which is the same behavior than the native JOGL GL impl */ @@ -89,7 +89,7 @@ public interface GLMatrixFunc { * </p> */ public void glPushMatrix(); - + /** * Pop the current matrix from it's stack. * @see #glPushMatrix() @@ -97,19 +97,19 @@ public interface GLMatrixFunc { public void glPopMatrix(); /** - * Load the current matrix with the identity matrix + * Load the current matrix with the identity matrix */ public void glLoadIdentity() ; /** - * Load the current matrix w/ the provided one. + * Load the current matrix w/ the provided one. * @param params the FloatBuffer's position remains unchanged, * which is the same behavior than the native JOGL GL impl */ - public void glLoadMatrixf(java.nio.FloatBuffer m) ; + public void glLoadMatrixf(java.nio.FloatBuffer m) ; /** * Load the current matrix w/ the provided one. - */ + */ public void glLoadMatrixf(float[] m, int m_offset); /** diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java index 786835f4d..4aff24b36 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java +++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java @@ -31,7 +31,7 @@ package javax.media.opengl.fixedfunc; import javax.media.opengl.*; -public interface GLPointerFunc { +public interface GLPointerFunc { public static final int GL_VERTEX_ARRAY = 0x8074; public static final int GL_NORMAL_ARRAY = 0x8075; public static final int GL_COLOR_ARRAY = 0x8076; diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java index 79ec38e0c..9bd644223 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java +++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java @@ -28,7 +28,7 @@ package javax.media.opengl.fixedfunc; -public class GLPointerFuncUtil { +public class GLPointerFuncUtil { public static final String mgl_Vertex = "mgl_Vertex"; public static final String mgl_Normal = "mgl_Normal"; public static final String mgl_Color = "mgl_Color"; @@ -37,16 +37,16 @@ public class GLPointerFuncUtil { /** * @param glArrayIndex the fixed function array index - * @return default fixed function array name + * @return default fixed function array name */ public static String getPredefinedArrayIndexName(int glArrayIndex) { return getPredefinedArrayIndexName(glArrayIndex, -1); } - + /** * @param glArrayIndex the fixed function array index - * @param multiTexCoordIndex index for multiTexCoordIndex - * @return default fixed function array name + * @param multiTexCoordIndex index for multiTexCoordIndex + * @return default fixed function array name */ public static String getPredefinedArrayIndexName(int glArrayIndex, int multiTexCoordIndex) { switch(glArrayIndex) { diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java index 1f59b5805..515583b14 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java @@ -30,20 +30,20 @@ package jogamp.graph.curve.opengl; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; -/** RegionFactory to create a Context specific Region implementation. - * +/** RegionFactory to create a Context specific Region implementation. + * * @see GLRegion */ public class RegionFactory { - + /** * Create a Region using the passed render mode - * + * * <p> In case {@link Region#VBAA_RENDERING_BIT} is being requested the default texture unit * {@link Region#TWO_PASS_DEFAULT_TEXTURE_UNIT} is being used.</p> - * + * * @param rs the RenderState to be used - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} */ public static GLRegion create(int renderModes) { if( 0 != ( Region.VBAA_RENDERING_BIT & renderModes ) ){ @@ -53,18 +53,18 @@ public class RegionFactory { return new VBORegionSPES2(renderModes); } } - + /** Create a Single Pass Region using the passed render mode - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, * {@link Region#VBAA_RENDERING_BIT} * @return */ public static GLRegion createSinglePass(int renderModes) { return new VBORegionSPES2(renderModes); } - + /** Create a Two Pass (VBAA) Region using the passed render mode - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, * {@link Region#VBAA_RENDERING_BIT} * @return */ diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 7f5afcd02..22600cb89 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -43,12 +43,12 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class RegionRendererImpl01 extends RegionRenderer { public RegionRendererImpl01(RenderState rs, int renderModes) { super(rs, renderModes); - + } - + protected boolean initShaderProgram(GL2ES2 gl) { final ShaderState st = rs.getShaderState(); - + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader", "shader/bin", getVertexShaderName(), true); final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader", @@ -57,29 +57,29 @@ public class RegionRendererImpl01 extends RegionRenderer { // rsFp.defaultShaderCustomization(gl, true, true); int pos = rsFp.addGLSLVersion(gl); if( gl.isGLES2() ) { - pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable); + pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable); } final String rsFpDefPrecision = getFragmentShaderPrecision(gl); if( null != rsFpDefPrecision ) { rsFp.insertShaderSource(0, pos, rsFpDefPrecision); } - + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); - if( !sp.init(gl) ) { + if( !sp.init(gl) ) { throw new GLException("RegionRenderer: Couldn't init program: "+sp); } - st.attachShaderProgram(gl, sp, false); + st.attachShaderProgram(gl, sp, false); st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME); - st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); - + st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); + if(!sp.link(gl, System.err)) { throw new GLException("RegionRenderer: Couldn't link program: "+sp); - } + } st.useProgram(gl, true); - + if(DEBUG) { System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st); } @@ -94,5 +94,5 @@ public class RegionRendererImpl01 extends RegionRenderer { @Override protected void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texSize) { ((GLRegion)region).draw(gl, rs, vp_width, vp_height, texSize); - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java index 51356ca13..8ca29b9f0 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java @@ -38,9 +38,9 @@ import com.jogamp.graph.geom.Vertex; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; -public class RenderStateImpl extends RenderState { +public class RenderStateImpl extends RenderState { /** - * weight is equivalent to the + * weight is equivalent to the * global off-curve vertex weight. * TODO: change to per vertex */ @@ -50,7 +50,7 @@ public class RenderStateImpl extends RenderState { public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) { super(st, pointFactory, pmvMatrix); - + gcu_Weight = new GLUniformData(UniformNames.gcu_Weight, 1.0f); st.ownUniform(gcu_PMVMatrix); gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f); @@ -60,15 +60,15 @@ public class RenderStateImpl extends RenderState { // gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f); // st.ownUniform(gcu_Strength); } - + public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) { this(st, pointFactory, new PMVMatrix()); } - + public final GLUniformData getWeight() { return gcu_Weight; } public final GLUniformData getAlpha() { return gcu_Alpha; } public final GLUniformData getColorStatic() { return gcu_ColorStatic; } //public final GLUniformData getStrength() { return gcu_Strength; } - - + + } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java index 81c421371..60758b90b 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -40,11 +40,11 @@ import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; -public class TextRendererImpl01 extends TextRenderer { +public class TextRendererImpl01 extends TextRenderer { public TextRendererImpl01(RenderState rs, int type) { - super(rs, type); + super(rs, type); } - + @Override protected boolean initShaderProgram(GL2ES2 gl){ final ShaderState st = rs.getShaderState(); @@ -63,18 +63,18 @@ public class TextRendererImpl01 extends TextRenderer { if( null != rsFpDefPrecision ) { rsFp.insertShaderSource(0, pos, rsFpDefPrecision); } - + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); - - if( !sp.init(gl) ) { + + if( !sp.init(gl) ) { throw new GLException("RegionRenderer: Couldn't init program: "+sp); } - st.attachShaderProgram(gl, sp, false); + st.attachShaderProgram(gl, sp, false); st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME); - st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); - + st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME); + if(!sp.link(gl, System.err)) { throw new GLException("TextRendererImpl01: Couldn't link program: "+sp); } @@ -82,15 +82,15 @@ public class TextRendererImpl01 extends TextRenderer { if(DEBUG) { System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st); - } + } return true; } - + @Override protected void destroyImpl(GL2ES2 gl) { super.destroyImpl(gl); } - + @Override public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int[/*1*/] texSize) { if(!isInitialized()){ @@ -101,7 +101,7 @@ public class TextRendererImpl01 extends TextRenderer { glyphString = createString(gl, font, fontSize, str); addCachedGlyphString(gl, font, str, fontSize, glyphString); } - + glyphString.renderString3D(gl, rs, vp_width, vp_height, texSize); } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 85d3ad5a7..86c0db8c6 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -30,7 +30,7 @@ package jogamp.graph.curve.opengl; import java.nio.FloatBuffer; import javax.media.opengl.GL2ES2; -// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER ! +// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER ! import javax.media.opengl.GL; import javax.media.opengl.GLUniformData; import javax.media.opengl.fixedfunc.GLMatrixFunc; @@ -58,90 +58,90 @@ public class VBORegion2PES2 extends GLRegion { private GLArrayDataServer verticeFboAttr; private GLArrayDataServer texCoordFboAttr; private GLArrayDataServer indicesFbo; - - + + private FBObject fbo; private TextureAttachment texA; private PMVMatrix fboPMVMatrix; GLUniformData mgl_fboPMVMatrix; - + private int tex_width_c = 0; private int tex_height_c = 0; - GLUniformData mgl_ActiveTexture; + GLUniformData mgl_ActiveTexture; GLUniformData mgl_TextureSize; // if GLSL < 1.30 - + public VBORegion2PES2(int renderModes, int textureEngine) { super(renderModes); fboPMVMatrix = new PMVMatrix(); - mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf()); - mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine); + mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf()); + mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine); } - + public void update(GL2ES2 gl, RenderState rs) { if(!isDirty()) { - return; + return; } if(null == indicesFbo) { final int initialElementCount = 256; final ShaderState st = rs.getShaderState(); - - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + + indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - - texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + + texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordFboAttr, true); - texCoordFboAttr.putf(5); texCoordFboAttr.putf(5); - texCoordFboAttr.putf(5); texCoordFboAttr.putf(6); - texCoordFboAttr.putf(6); texCoordFboAttr.putf(6); - texCoordFboAttr.putf(6); texCoordFboAttr.putf(5); + texCoordFboAttr.putf(5); texCoordFboAttr.putf(5); + texCoordFboAttr.putf(5); texCoordFboAttr.putf(6); + texCoordFboAttr.putf(6); texCoordFboAttr.putf(6); + texCoordFboAttr.putf(6); texCoordFboAttr.putf(5); texCoordFboAttr.seal(true); - - verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, - false, initialElementCount, GL.GL_STATIC_DRAW); + + verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeFboAttr, true); - - - indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - - verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + + + indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + + verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeTxtAttr, true); - - texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + + texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordTxtAttr, true); - + if(DEBUG_INSTANCE) { System.err.println("VBORegion2PES2 Create: " + this); - } + } } // process triangles indicesTxt.seal(gl, false); - indicesTxt.rewind(); + indicesTxt.rewind(); for(int i=0; i<triangles.size(); i++) { final Triangle t = triangles.get(i); final Vertex[] t_vertices = t.getVertices(); - + if(t_vertices[0].getId() == Integer.MAX_VALUE){ t_vertices[0].setId(numVertices++); t_vertices[1].setId(numVertices++); t_vertices[2].setId(numVertices++); - + vertices.add(t_vertices[0]); vertices.add(t_vertices[1]); vertices.add(t_vertices[2]); - + indicesTxt.puts((short) t_vertices[0].getId()); indicesTxt.puts((short) t_vertices[1].getId()); indicesTxt.puts((short) t_vertices[2].getId()); } else { indicesTxt.puts((short) t_vertices[0].getId()); indicesTxt.puts((short) t_vertices[1].getId()); - indicesTxt.puts((short) t_vertices[2].getId()); + indicesTxt.puts((short) t_vertices[2].getId()); } } indicesTxt.seal(gl, true); @@ -157,43 +157,43 @@ public class VBORegion2PES2 extends GLRegion { final Vertex v = vertices.get(i); verticeTxtAttr.putf(v.getX()); verticeTxtAttr.putf(v.getY()); - verticeTxtAttr.putf(v.getZ()); - box.resize(v.getX(), v.getY(), v.getZ()); - + verticeTxtAttr.putf(v.getZ()); + box.resize(v.getX(), v.getY(), v.getZ()); + final float[] tex = v.getTexCoord(); texCoordTxtAttr.putf(tex[0]); - texCoordTxtAttr.putf(tex[1]); + texCoordTxtAttr.putf(tex[1]); } texCoordTxtAttr.seal(gl, true); texCoordTxtAttr.enableBuffer(gl, false); - verticeTxtAttr.seal(gl, true); + verticeTxtAttr.seal(gl, true); verticeTxtAttr.enableBuffer(gl, false); - + // update all bbox related data verticeFboAttr.seal(gl, false); - verticeFboAttr.rewind(); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); - verticeFboAttr.seal(gl, true); + verticeFboAttr.rewind(); + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]); + verticeFboAttr.seal(gl, true); verticeFboAttr.enableBuffer(gl, false); - + fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); fboPMVMatrix.glLoadIdentity(); fboPMVMatrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1); - + // push data 2 GPU .. indicesFbo.seal(gl, true); indicesFbo.enableBuffer(gl, false); - + setDirty(false); - + // the buffers were disabled, since due to real/fbo switching and other vbo usage } - + int[] maxTexSize = new int[] { -1 } ; - + protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){ renderRegion(gl); @@ -205,54 +205,54 @@ public class VBORegion2PES2 extends GLRegion { if(texWidth[0] > maxTexSize[0]) { texWidth[0] = maxTexSize[0]; // clip to max - write-back user value! } - renderRegion2FBO(gl, rs, texWidth); + renderRegion2FBO(gl, rs, texWidth); } // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); renderFBO(gl, rs, vp_width, vp_height); } } - + private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) { final ShaderState st = rs.getShaderState(); - - gl.glViewport(0, 0, width, hight); - st.uniform(gl, mgl_ActiveTexture); + + gl.glViewport(0, 0, width, hight); + st.uniform(gl, mgl_ActiveTexture); gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue()); - fbo.use(gl, texA); - verticeFboAttr.enableBuffer(gl, true); - texCoordFboAttr.enableBuffer(gl, true); + fbo.use(gl, texA); + verticeFboAttr.enableBuffer(gl, true); + texCoordFboAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - - indicesFbo.bindBuffer(gl, false); + + indicesFbo.bindBuffer(gl, false); texCoordFboAttr.enableBuffer(gl, false); - verticeFboAttr.enableBuffer(gl, false); + verticeFboAttr.enableBuffer(gl, false); fbo.unuse(gl); - + // setback: gl.glActiveTexture(currentActiveTextureEngine[0]); } - + private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) { final ShaderState st = rs.getShaderState(); - + if(0>=texWidth[0]) { throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]); } - + tex_width_c = texWidth[0]; tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f ); - + // System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c); // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5)); - + if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) { fbo.reset(gl, tex_width_c, tex_height_c); } - - if(null == fbo) { + + if(null == fbo) { fbo = new FBObject(); - fbo.reset(gl, tex_width_c, tex_height_c); + fbo.reset(gl, tex_width_c, tex_height_c); // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); // texA = fbo.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); @@ -260,18 +260,18 @@ public class VBORegion2PES2 extends GLRegion { } else { fbo.bind(gl); } - + //render texture gl.glViewport(0, 0, tex_width_c, tex_height_c); st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix - + gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); renderRegion(gl); fbo.unbind(gl); - + st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix - + // if( !gl.isGL3() ) { // GLSL < 1.30 if(null == mgl_TextureSize) { @@ -281,21 +281,21 @@ public class VBORegion2PES2 extends GLRegion { texSize.put(0, (float)fbo.getWidth()); texSize.put(1, (float)fbo.getHeight()); st.uniform(gl, mgl_TextureSize); - //} + //} } - + private void renderRegion(GL2ES2 gl) { - verticeTxtAttr.enableBuffer(gl, true); + verticeTxtAttr.enableBuffer(gl, true); texCoordTxtAttr.enableBuffer(gl, true); indicesTxt.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - - indicesTxt.bindBuffer(gl, false); + + indicesTxt.bindBuffer(gl, false); texCoordTxtAttr.enableBuffer(gl, false); - verticeTxtAttr.enableBuffer(gl, false); + verticeTxtAttr.enableBuffer(gl, false); } - + public void destroy(GL2ES2 gl, RenderState rs) { if(DEBUG_INSTANCE) { System.err.println("VBORegion2PES2 Destroy: " + this); @@ -305,7 +305,7 @@ public class VBORegion2PES2 extends GLRegion { fbo.destroy(gl); fbo = null; texA = null; - } + } if(null != verticeTxtAttr) { st.ownAttribute(verticeTxtAttr, false); verticeTxtAttr.destroy(gl); @@ -335,6 +335,6 @@ public class VBORegion2PES2 extends GLRegion { indicesFbo = null; } triangles.clear(); - vertices.clear(); - } + vertices.clear(); + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 0cba444ad..0a867b45c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -44,13 +44,13 @@ public class VBORegionSPES2 extends GLRegion { private GLArrayDataServer texCoordAttr = null; private GLArrayDataServer indices = null; - protected VBORegionSPES2(int renderModes) { + protected VBORegionSPES2(int renderModes) { super(renderModes); } protected void update(GL2ES2 gl, RenderState rs) { if(!isDirty()) { - return; + return; } if(null == indices) { @@ -59,11 +59,11 @@ public class VBORegionSPES2 extends GLRegion { indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, - false, initialElementCount, GL.GL_STATIC_DRAW); + verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(verticeAttr, true); - texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); st.ownAttribute(texCoordAttr, true); @@ -74,7 +74,7 @@ public class VBORegionSPES2 extends GLRegion { // process triangles indices.seal(gl, false); - indices.rewind(); + indices.rewind(); for(int i=0; i<triangles.size(); i++) { final Triangle t = triangles.get(i); final Vertex[] t_vertices = t.getVertices(); @@ -102,7 +102,7 @@ public class VBORegionSPES2 extends GLRegion { // process vertices and update bbox box.reset(); - verticeAttr.seal(gl, false); + verticeAttr.seal(gl, false); verticeAttr.rewind(); texCoordAttr.seal(gl, false); texCoordAttr.rewind(); @@ -110,14 +110,14 @@ public class VBORegionSPES2 extends GLRegion { final Vertex v = vertices.get(i); verticeAttr.putf(v.getX()); verticeAttr.putf(v.getY()); - verticeAttr.putf(v.getZ()); + verticeAttr.putf(v.getZ()); box.resize(v.getX(), v.getY(), v.getZ()); final float[] tex = v.getTexCoord(); texCoordAttr.putf(tex[0]); texCoordAttr.putf(tex[1]); } - verticeAttr.seal(gl, true); + verticeAttr.seal(gl, true); verticeAttr.enableBuffer(gl, false); texCoordAttr.seal(gl, true); texCoordAttr.enableBuffer(gl, false); @@ -126,21 +126,21 @@ public class VBORegionSPES2 extends GLRegion { } protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { - verticeAttr.enableBuffer(gl, true); - texCoordAttr.enableBuffer(gl, true); + verticeAttr.enableBuffer(gl, true); + texCoordAttr.enableBuffer(gl, true); indices.bindBuffer(gl, true); // keeps VBO binding - + gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); - + indices.bindBuffer(gl, false); texCoordAttr.enableBuffer(gl, false); - verticeAttr.enableBuffer(gl, false); - } + verticeAttr.enableBuffer(gl, false); + } public final void destroy(GL2ES2 gl, RenderState rs) { if(DEBUG_INSTANCE) { System.err.println("VBORegionSPES2 Destroy: " + this); - } + } final ShaderState st = rs.getShaderState(); if(null != verticeAttr) { st.ownAttribute(verticeAttr, false); @@ -156,5 +156,5 @@ public class VBORegionSPES2 extends GLRegion { indices.destroy(gl); indices = null; } - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java index 8a109c34a..b46661778 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.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. @@ -37,9 +37,9 @@ public class AttributeNames { */ public static final int TEXCOORD_ATTR_IDX = 1; public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords"; - + /** The color index in an OGL object */ public static final int COLOR_ATTR_IDX = 2; - public static final String COLOR_ATTR_NAME = "gca_Colors"; + public static final String COLOR_ATTR_NAME = "gca_Colors"; } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java index ab6e0dc6e..ce23aadac 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java @@ -3,7 +3,7 @@ package jogamp.graph.curve.opengl.shader; public class UniformNames { public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi public static final String gcu_ColorStatic = "gcu_ColorStatic"; - public static final String gcu_Alpha = "gcu_Alpha"; + public static final String gcu_Alpha = "gcu_Alpha"; public static final String gcu_Weight = "gcu_Weight"; public static final String gcu_TextureUnit = "gcu_TextureUnit"; public static final String gcu_TextureSize = "gcu_TextureSize"; diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index e96c559a2..4f48b2d20 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -39,29 +39,29 @@ import com.jogamp.opengl.math.VectorUtil; import jogamp.opengl.Debug; -/** Constrained Delaunay Triangulation +/** Constrained Delaunay Triangulation * implementation of a list of Outlines that define a set of * Closed Regions with optional n holes. - * + * */ public class CDTriangulator2D implements Triangulator{ protected static final boolean DEBUG = Debug.debug("Triangulation"); - + private float sharpness = 0.5f; private ArrayList<Loop> loops; private ArrayList<Vertex> vertices; - + private ArrayList<Triangle> triangles; private int maxTriID = 0; - + /** Constructor for a new Delaunay triangulator */ public CDTriangulator2D() { reset(); } - + /** Reset the triangulation to initial state * Clearing cached data */ @@ -71,14 +71,14 @@ public class CDTriangulator2D implements Triangulator{ triangles = new ArrayList<Triangle>(3); loops = new ArrayList<Loop>(); } - + public void addCurve(Outline polyline) { Loop loop = null; - + if(!loops.isEmpty()) { loop = getContainerLoop(polyline); } - + if(loop == null) { GraphOutline outline = new GraphOutline(polyline); GraphOutline innerPoly = extractBoundaryTriangles(outline, false); @@ -92,8 +92,8 @@ public class CDTriangulator2D implements Triangulator{ loop.addConstraintCurve(innerPoly); } } - - public ArrayList<Triangle> generate() { + + public ArrayList<Triangle> generate() { for(int i=0;i<loops.size();i++) { Loop loop = loops.get(i); int numTries = 0; @@ -140,16 +140,16 @@ public class CDTriangulator2D implements Triangulator{ GraphVertex gv0 = outVertices.get((i+size-1)%size); GraphVertex gv2 = outVertices.get((i+1)%size); GraphVertex gv1 = currentVertex; - + if(!currentVertex.getPoint().isOnCurve()) { Vertex v0 = gv0.getPoint().clone(); Vertex v2 = gv2.getPoint().clone(); Vertex v1 = gv1.getPoint().clone(); - + gv0.setBoundaryContained(true); gv1.setBoundaryContained(true); gv2.setBoundaryContained(true); - + final Triangle t; final boolean holeLike; if(VectorUtil.ccw(v0,v1,v2)) { @@ -184,7 +184,7 @@ public class CDTriangulator2D implements Triangulator{ } return innerOutline; } - + private Loop getContainerLoop(Outline polyline) { ArrayList<Vertex> vertices = polyline.getVertices(); for(int i=0; i < loops.size(); i++) { diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index c8251af15..2e8d4f58f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -35,13 +35,13 @@ import com.jogamp.graph.geom.Vertex; public class GraphOutline { final private Outline outline; final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3); - + public GraphOutline(){ this.outline = new Outline(); } - + /**Create a control polyline of control vertices - * the curve pieces can be identified by onCurve flag + * the curve pieces can be identified by onCurve flag * of each cp the control polyline is open by default */ public GraphOutline(Outline ol){ @@ -59,7 +59,7 @@ public class GraphOutline { public ArrayList<GraphVertex> getGraphPoint() { return controlpoints; } - + public ArrayList<Vertex> getVertices() { return outline.getVertices(); } @@ -68,5 +68,5 @@ public class GraphOutline { controlpoints.add(v); outline.addVertex(v.getPoint()); } - + } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java index 52d02baa5..1ef1d8c7f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -35,7 +35,7 @@ public class GraphVertex { private Vertex point; private ArrayList<HEdge> edges = null; private boolean boundaryContained = false; - + public GraphVertex(Vertex point) { this.point = point; } @@ -43,15 +43,15 @@ public class GraphVertex { public Vertex getPoint() { return point; } - + public float getX(){ return point.getX(); } - + public float getY(){ return point.getY(); } - + public float getZ(){ return point.getZ(); } @@ -70,7 +70,7 @@ public class GraphVertex { public void setEdges(ArrayList<HEdge> edges) { this.edges = edges; } - + public void addEdge(HEdge edge){ if(edges == null){ edges = new ArrayList<HEdge>(); @@ -112,7 +112,7 @@ public class GraphVertex { } return null; } - + public boolean isBoundaryContained() { return boundaryContained; } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java index 4d29a81f3..acaa3d708 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java @@ -35,14 +35,14 @@ public class HEdge { public static int BOUNDARY = 3; public static int INNER = 1; public static int HOLE = 2; - + private GraphVertex vert; private HEdge prev = null; private HEdge next = null; private HEdge sibling = null; private int type = BOUNDARY; private Triangle triangle = null; - + public HEdge(GraphVertex vert, int type) { this.vert = vert; this.type = type; @@ -112,19 +112,19 @@ public class HEdge { public void setTriangle(Triangle triangle) { this.triangle = triangle; } - + public static <T extends Vertex> void connect(HEdge first, HEdge next){ first.setNext(next); next.setPrev(first); } - + public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){ first.setSibling(second); second.setSibling(first); } - + public boolean vertexOnCurveVertex(){ return vert.getPoint().isOnCurve(); } - + } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 651179062..c1dafc0d1 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -51,7 +51,7 @@ public class Loop { public Triangle cut(boolean delaunay){ if(isSimplex()){ - Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), + Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), root.getNext().getNext().getGraphPoint().getPoint()); t.setVerticesBoundary(checkVerticesBoundary(root)); return t; @@ -103,20 +103,20 @@ public class Loop { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); } final VectorUtil.Winding hasWinding = VectorUtil.getWinding( - vertices.get(0).getPoint(), + vertices.get(0).getPoint(), vertices.get(1).getPoint(), vertices.get(2).getPoint()); //FIXME: handle case when vertices come inverted - Rami // skips inversion CW -> CCW final boolean invert = hasWinding != reqWinding && reqWinding == VectorUtil.Winding.CW; - + final int max; final int edgeType = reqWinding == VectorUtil.Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ; int index; HEdge firstEdge = null; HEdge lastEdge = null; - + if(!invert) { max = vertices.size(); index = 0; @@ -160,7 +160,7 @@ public class Loop { public void addConstraintCurve(GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ - initFromPolyline(polyline, VectorUtil.Winding.CW); + initFromPolyline(polyline, VectorUtil.Winding.CW); GraphVertex v3 = locateClosestVertex(polyline); HEdge v3Edge = v3.findBoundEdge(); @@ -180,9 +180,9 @@ public class Loop { HEdge.connect(crossEdgeSib, root); } - /** Locates the vertex and update the loops root - * to have (root + vertex) as closest pair - * @param polyline the control polyline + /** Locates the vertex and update the loops root + * to have (root + vertex) as closest pair + * @param polyline the control polyline * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ @@ -205,7 +205,7 @@ public class Loop { for (GraphVertex vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; - inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), + inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), cand.getPoint(), vert.getPoint()); if(inValid){ break; @@ -243,8 +243,8 @@ public class Loop { Vertex cand = candEdge.getGraphPoint().getPoint(); HEdge e = candEdge.getNext(); while (e != candEdge){ - if(e.getGraphPoint() == root.getGraphPoint() - || e.getGraphPoint() == next.getGraphPoint() + if(e.getGraphPoint() == root.getGraphPoint() + || e.getGraphPoint() == next.getGraphPoint() || e.getGraphPoint().getPoint() == cand){ e = e.getNext(); continue; @@ -311,15 +311,15 @@ public class Loop { (v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){ inside = !inside; } - + current = next; next = current.getNext(); - + } while(current != root); - + return inside; } - + public int computeLoopSize(){ int size = 0; HEdge e = root; diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java index 751a7e7ac..ff46c3338 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java @@ -37,17 +37,17 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.opengl.math.Quaternion; public class GlyphShape { - + private Quaternion quat= null; private OutlineShape shape = null; - + /** Create a new Glyph shape * based on Parametric curve control polyline */ public GlyphShape(Vertex.Factory<? extends Vertex> factory){ shape = new OutlineShape(factory); } - + /** Create a new GlyphShape from a {@link OutlineShape} * @param factory vertex impl factory {@link Factory} * @param shape {@link OutlineShape} representation of the Glyph @@ -57,24 +57,24 @@ public class GlyphShape { this.shape = shape; this.shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS); } - + public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); } - + public OutlineShape getShape() { return shape; } - + public int getNumVertices() { return shape.getVertices().size(); } - + /** Get the rotational Quaternion attached to this Shape * @return the Quaternion Object */ public Quaternion getQuat() { return quat; } - + /** Set the Quaternion that shall defien the rotation * of this shape. * @param quat @@ -82,7 +82,7 @@ public class GlyphShape { public void setQuat(Quaternion quat) { this.quat = quat; } - + /** Triangluate the glyph shape * @return ArrayList of triangles which define this shape */ @@ -95,5 +95,5 @@ public class GlyphShape { */ public ArrayList<Vertex> getVertices(){ return shape.getVertices(); - } + } } diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index cc850b823..2284ab669 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -52,51 +52,51 @@ public class GlyphString { * <p>The actual font size shall be accomplished by the GL PMV matrix.</p> */ public static final int STATIC_FONT_SIZE = 10; - + private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>(); private CharSequence str; private String fontname; private GLRegion region; - + private SVertex origin = new SVertex(); /** * <p>Uses {@link #STATIC_FONT_SIZE}.</p> * <p>No caching is performed.</p> - * + * * @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance. * @param vertexFactory vertex impl factory {@link Factory} - * @param font the target {@link Font} + * @param font the target {@link Font} * @param str string text * @return the created {@link GlyphString} instance */ public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, String str) { - return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str); + return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str); } - + /** * <p>No caching is performed.</p> - * + * * @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance. * @param vertexFactory vertex impl factory {@link Factory} - * @param font the target {@link Font} + * @param font the target {@link Font} * @param fontSize font size * @param str string text * @return the created {@link GlyphString} instance */ public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, int fontSize, String str) { ArrayList<OutlineShape> shapes = ((FontInt)font).getOutlineShapes(str, fontSize, vertexFactory); - + GlyphString glyphString = new GlyphString(font.getName(Font.NAME_UNIQUNAME), str); glyphString.createfromOutlineShapes(vertexFactory, shapes); if(null != shape) { for(int i=0; i<glyphString.glyphs.size(); i++) { shape.addOutlineShape(glyphString.glyphs.get(i).getShape()); - } + } } return glyphString; } - + /** Create a new GlyphString object * @param fontname the name of the font that this String is * associated with @@ -106,18 +106,18 @@ public class GlyphString { this.fontname = fontname; this.str = str; } - + public void addGlyphShape(GlyphShape glyph){ glyphs.add(glyph); } - + public CharSequence getString(){ return str; } - /**Creates the Curve based Glyphs from a list of {@link OutlineShape} + /**Creates the Curve based Glyphs from a list of {@link OutlineShape} * @param vertexFactory vertex impl factory {@link Factory} - * @param shapes list of {@link OutlineShape} + * @param shapes list of {@link OutlineShape} */ public void createfromOutlineShapes(Factory<? extends Vertex> vertexFactory, ArrayList<OutlineShape> shapes) { final int numGlyps = shapes.size(); @@ -126,31 +126,31 @@ public class GlyphString { continue; } GlyphShape glyphShape = new GlyphShape(vertexFactory, shapes.get(index)); - + if(glyphShape.getNumVertices() < 3) { continue; - } + } addGlyphShape(glyphShape); } } - - + + /** Generate a OGL Region to represent this Object. * @param gl the current gl object * @param rs the current attached RenderState - * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} + * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT} */ public GLRegion createRegion(GL2ES2 gl, int renderModes){ region = RegionFactory.create(renderModes); // region.setFlipped(true); - + int numVertices = region.getNumVertices(); - + for(int i=0; i< glyphs.size(); i++) { final GlyphShape glyph = glyphs.get(i); ArrayList<Triangle> gtris = glyph.triangulate(); region.addTriangles(gtris); - + final ArrayList<Vertex> gVertices = glyph.getVertices(); for(int j=0; j<gVertices.size(); j++) { final Vertex gVert = gVertices.get(j); @@ -160,8 +160,8 @@ public class GlyphString { } return region; } - - /** Generate a Hashcode for this object + + /** Generate a Hashcode for this object * @return a string defining the hashcode */ public String getTextHashCode(){ @@ -180,15 +180,15 @@ public class GlyphString { * @param rs the RenderState to be used * @param vp_width current screen width * @param vp_height current screen height - * @param texWidth desired texture width for multipass-rendering. + * @param texWidth desired texture width for multipass-rendering. * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. */ public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { region.draw(gl, rs, vp_width, vp_height, texWidth); } - + /** Get the Origin of this GlyphString - * @return + * @return */ public Vertex getOrigin() { return origin; @@ -206,7 +206,7 @@ public class GlyphString { } glyphs.clear(); } - + public AABBox getBounds(){ return region.getBounds(); } diff --git a/src/jogl/classes/jogamp/graph/font/FontInt.java b/src/jogl/classes/jogamp/graph/font/FontInt.java index 20e1ec028..4366724ad 100644 --- a/src/jogl/classes/jogamp/graph/font/FontInt.java +++ b/src/jogl/classes/jogamp/graph/font/FontInt.java @@ -40,7 +40,7 @@ public interface FontInt extends Font { public interface GlyphInt extends Font.Glyph { public Path2D getPath(); // unscaled path - public Path2D getPath(float pixelSize); + public Path2D getPath(float pixelSize); } public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory); diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index 3736c5f13..5978e937d 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -40,16 +40,16 @@ import com.jogamp.graph.font.FontSet; import com.jogamp.graph.font.FontFactory; public class JavaFontLoader implements FontSet { - - // FIXME: Add cache size to limit memory usage + + // FIXME: Add cache size to limit memory usage private static final IntObjectHashMap fontMap = new IntObjectHashMap(); - + private static final FontSet fontLoader = new JavaFontLoader(); public static FontSet get() { return fontLoader; } - + final static String availableFontFileNames[] = { /* 00 */ "LucidaBrightRegular.ttf", @@ -61,9 +61,9 @@ public class JavaFontLoader implements FontSet { /* 06 */ "LucidaTypewriterRegular.ttf", /* 07 */ "LucidaTypewriterBold.ttf", }; - + final String javaFontPath; - + private JavaFontLoader() { final String javaHome = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { @@ -80,11 +80,11 @@ public class JavaFontLoader implements FontSet { static boolean is(int bits, int bit) { return 0 != ( bits & bit ) ; } - + public Font getDefault() throws IOException { - return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular + return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - + public Font get(int family, int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { @@ -92,8 +92,8 @@ public class JavaFontLoader implements FontSet { } // 1st process Sans Serif (2 fonts) - if( is(style, STYLE_SERIF) ) { - if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_SERIF) ) { + if( is(style, STYLE_BOLD) ) { font = abspath(availableFontFileNames[5], family, style); } else { font = abspath(availableFontFileNames[4], family, style); @@ -103,53 +103,53 @@ public class JavaFontLoader implements FontSet { } return font; } - + // Serif Fonts .. switch (family) { case FAMILY_LIGHT: case FAMILY_MEDIUM: case FAMILY_CONDENSED: case FAMILY_REGULAR: - if( is(style, STYLE_BOLD) ) { - if( is(style, STYLE_ITALIC) ) { + if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[3], family, style); } else { font = abspath(availableFontFileNames[2], family, style); } - } else if( is(style, STYLE_ITALIC) ) { + } else if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[1], family, style); } else { font = abspath(availableFontFileNames[0], family, style); } break; - + case FAMILY_MONOSPACED: - if( is(style, STYLE_BOLD) ) { + if( is(style, STYLE_BOLD) ) { font = abspath(availableFontFileNames[7], family, style); } else { font = abspath(availableFontFileNames[6], family, style); } - break; + break; } return font; } - + Font abspath(String fname, int family, int style) throws IOException { if(null == javaFontPath) { throw new GLException("java font path undefined"); } final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ; - + try { final Font f = FontFactory.get( new File(javaFontPath+fname) ); if(null != f) { fontMap.put( ( family << 8 ) | style, f ); return f; } - throw new IOException (err); + throw new IOException (err); } catch (IOException ioe) { - throw new IOException(err, ioe); + throw new IOException(err, ioe); } - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index c4c580290..254583739 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -39,23 +39,23 @@ import com.jogamp.graph.font.FontFactory; import java.net.URLConnection; public class UbuntuFontLoader implements FontSet { - - // FIXME: Add cache size to limit memory usage + + // FIXME: Add cache size to limit memory usage private static final IntObjectHashMap fontMap = new IntObjectHashMap(); - - private static final String relPath = "fonts/ubuntu/" ; - + + private static final String relPath = "fonts/ubuntu/" ; + private static final FontSet fontLoader = new UbuntuFontLoader(); public static final FontSet get() { return fontLoader; } - + final static String availableFontFileNames[] = { /* 00 */ "Ubuntu-R.ttf", // regular /* 01 */ "Ubuntu-RI.ttf", // regular italic - /* 02 */ "Ubuntu-B.ttf", // bold + /* 02 */ "Ubuntu-B.ttf", // bold /* 03 */ "Ubuntu-BI.ttf", // bold italic /* 04 */ "Ubuntu-L.ttf", // light /* 05 */ "Ubuntu-LI.ttf", // light italic @@ -63,18 +63,18 @@ public class UbuntuFontLoader implements FontSet { /* 07 */ "Ubuntu-MI.ttf", // medium italic }; - + private UbuntuFontLoader() { } static boolean is(int bits, int bit) { return 0 != ( bits & bit ) ; } - + public Font getDefault() throws IOException { - return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular + return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular } - + public Font get(int family, int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { @@ -97,7 +97,7 @@ public class UbuntuFontLoader implements FontSet { font = abspath(availableFontFileNames[0], family, style); } break; - + case FAMILY_LIGHT: if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[5], family, style); @@ -105,19 +105,19 @@ public class UbuntuFontLoader implements FontSet { font = abspath(availableFontFileNames[4], family, style); } break; - + case FAMILY_MEDIUM: if( is(style, STYLE_ITALIC) ) { font = abspath(availableFontFileNames[6], family, style); } else { font = abspath(availableFontFileNames[7], family, style); } - break; + break; } return font; } - + Font abspath(String fname, int family, int style) throws IOException { final String err = "Problem loading font "+fname+", stream "+relPath+fname; try { @@ -129,10 +129,10 @@ public class UbuntuFontLoader implements FontSet { if(null != f) { fontMap.put( ( family << 8 ) | style, f ); return f; - } + } throw new IOException(err); } catch(IOException ioe) { - throw new IOException(err, ioe); + throw new IOException(err, ioe); } - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 0441bf836..ba6c72650 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -51,20 +51,20 @@ import com.jogamp.opengl.math.geom.AABBox; class TypecastFont implements FontInt { static final boolean DEBUG = false; - + final OTFontCollection fontset; final OTFont font; TypecastHMetrics metrics; final CmapFormat cmapFormat; int cmapentries; - - // FIXME: Add cache size to limit memory usage ?? - IntObjectHashMap char2Glyph; + + // FIXME: Add cache size to limit memory usage ?? + IntObjectHashMap char2Glyph; public TypecastFont(OTFontCollection fontset) { this.fontset = fontset; this.font = fontset.getFont(0); - + // FIXME: Generic attempt to find the best CmapTable, // which is assumed to be the one with the most entries (stupid 'eh?) CmapTable cmapTable = font.getCmapTable(); @@ -77,14 +77,14 @@ class TypecastFont implements FontInt { int pidx = cmapIdxEntry.getPlatformId(); CmapFormat cf = cmapIdxEntry.getFormat(); if(DEBUG) { - System.err.println("CmapFormat["+i+"]: platform " + pidx + + System.err.println("CmapFormat["+i+"]: platform " + pidx + ", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf); } - if( _cmapFormatP[pidx] == null || + if( _cmapFormatP[pidx] == null || _cmapFormatP[pidx].getLength() < cf.getLength() ) { _cmapFormatP[pidx] = cf; if( cf.getLength() > platformLength ) { - platformLength = cf.getLength() ; + platformLength = cf.getLength() ; platform = pidx; encoding = cmapIdxEntry.getEncodingId(); } @@ -93,10 +93,10 @@ class TypecastFont implements FontInt { if(0 <= platform) { cmapFormat = _cmapFormatP[platform]; if(DEBUG) { - System.err.println("Selected CmapFormat: platform " + platform + + System.err.println("Selected CmapFormat: platform " + platform + ", encoding "+encoding + ": "+cmapFormat); } - } else { + } else { CmapFormat _cmapFormat = null; /*if(null == _cmapFormat) { platform = ID.platformMacintosh; @@ -127,14 +127,14 @@ class TypecastFont implements FontInt { cmapentries = 0; for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); - cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included - } + cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included + } if(DEBUG) { System.err.println("font direction hint: "+font.getHeadTable().getFontDirectionHint()); System.err.println("num glyphs: "+font.getNumGlyphs()); System.err.println("num cmap entries: "+cmapentries); System.err.println("num cmap ranges: "+cmapFormat.getRangeCount()); - + for (int i = 0; i < cmapFormat.getRangeCount(); ++i) { CmapFormat.Range range = cmapFormat.getRange(i); for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) { @@ -147,7 +147,7 @@ class TypecastFont implements FontInt { } char2Glyph = new IntObjectHashMap(cmapentries + cmapentries/4); } - + public StringBuilder getName(StringBuilder sb, int nameIndex) { return font.getName(nameIndex, sb); } @@ -161,12 +161,12 @@ class TypecastFont implements FontInt { sb = getName(sb, Font.NAME_FAMILY).append("-"); getName(sb, Font.NAME_SUBFAMILY); return sb; - } + } public float getAdvanceWidth(int i, float pixelSize) { - return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize); + return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize); } - + public Metrics getMetrics() { if (metrics == null) { metrics = new TypecastHMetrics(this); @@ -175,7 +175,7 @@ class TypecastFont implements FontInt { } public Glyph getGlyph(char symbol) { - TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); + TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol); if (null == result) { // final short code = (short) char2Code.get(symbol); short code = (short) cmapFormat.mapCharCode(symbol); @@ -187,7 +187,7 @@ class TypecastFont implements FontInt { default: code = Glyph.ID_UNKNOWN; } } - + jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code); if(null == glyph) { glyph = font.getGlyph(Glyph.ID_UNKNOWN); @@ -200,25 +200,25 @@ class TypecastFont implements FontInt { if(DEBUG) { System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path); } - final HdmxTable hdmx = font.getHdmxTable(); + final HdmxTable hdmx = font.getHdmxTable(); if (null!= result && null != hdmx) { /*if(DEBUG) { System.err.println("hdmx "+hdmx); }*/ for (int i=0; i<hdmx.getNumberOfRecords(); i++) { - final HdmxTable.DeviceRecord dr = hdmx.getRecord(i); + final HdmxTable.DeviceRecord dr = hdmx.getRecord(i); result.addAdvance(dr.getWidth(code), dr.getPixelSize()); /* if(DEBUG) { System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize()); } */ } - } + } char2Glyph.put(symbol, result); } return result; } - + public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory) { AffineTransform transform = new AffineTransform(vertexFactory); return TypecastRenderer.getOutlineShapes(this, string, pixelSize, transform, vertexFactory); @@ -238,7 +238,7 @@ class TypecastFont implements FontInt { } } - return (int)(width + 0.5f); + return (int)(width + 0.5f); } public float getStringHeight(CharSequence string, float pixelSize) { @@ -254,7 +254,7 @@ class TypecastFont implements FontInt { height = (int)Math.ceil(Math.max(bbox.getHeight(), height)); } } - return height; + return height; } public AABBox getStringBounds(CharSequence string, float pixelSize) { @@ -284,17 +284,17 @@ class TypecastFont implements FontInt { totalHeight -= advanceY; totalWidth = Math.max(curLineWidth, totalWidth); } - return new AABBox(0, 0, 0, totalWidth, totalHeight,0); + return new AABBox(0, 0, 0, totalWidth, totalHeight,0); } final public int getNumGlyphs() { return font.getNumGlyphs(); } - + public boolean isPrintableChar( char c ) { return FontFactory.isPrintableChar(c); } - + public String toString() { return getFullFamilyName(null).toString(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java index 8479c08ca..77b5a9aa9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java @@ -46,7 +46,7 @@ public class TypecastFontConstructor implements FontConstructor { public Font create(final File ffile) throws IOException { Object o = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - OTFontCollection fontset; + OTFontCollection fontset; try { fontset = OTFontCollection.create(ffile); return new TypecastFont(fontset); @@ -63,14 +63,14 @@ public class TypecastFontConstructor implements FontConstructor { } throw new InternalError("Unexpected Object: "+o); } - + public Font create(final URLConnection fconn) throws IOException { return AccessController.doPrivileged(new PrivilegedAction<Font>() { public Font run() { File tf = null; int len=0; Font f = null; - try { + try { tf = IOUtil.createTempFile( "jogl.font", ".ttf", false); len = IOUtil.copyURLConn2File(fconn, tf); if(len==0) { @@ -84,7 +84,7 @@ public class TypecastFontConstructor implements FontConstructor { } return f; } - }); + }); } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 1205c6539..476b3fd4e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -40,45 +40,45 @@ public class TypecastGlyph implements FontInt.GlyphInt { public class Advance { final Font font; - final float advance; - HashMap<Float, Float> size2advance = new HashMap<Float, Float>(); - + final float advance; + HashMap<Float, Float> size2advance = new HashMap<Float, Float>(); + public Advance(Font font, float advance) { this.font = font; this.advance = advance; } - + public void reset() { size2advance.clear(); } - + public float getScale(float pixelSize) { return this.font.getMetrics().getScale(pixelSize); } - + public void add(float advance, float size) { size2advance.put(size, advance); } - + public float get(float size, boolean useFrationalMetrics) { Float fo = size2advance.get(size); - if(null == fo) { + if(null == fo) { float value = (this.advance * getScale(size)); if (useFrationalMetrics == false) { //value = (float)Math.ceil(value); // value = (int)value; - value = (int) ( value + 0.5f ) ; // TODO: check + value = (int) ( value + 0.5f ) ; // TODO: check } size2advance.put(size, value); return value; } return fo.floatValue(); } - + public String toString() { return "\nAdvance:"+ @@ -86,147 +86,147 @@ public class TypecastGlyph implements FontInt.GlyphInt { "\n advances: \n"+size2advance; } } - + public class Metrics { AABBox bbox; Advance advance; - + public Metrics(Font font, AABBox bbox, float advance) { this.bbox = bbox; this.advance = new Advance(font, advance); } - + public void reset() { advance.reset(); } - + public float getScale(float pixelSize) { return this.advance.getScale(pixelSize); } - + public AABBox getBBox() { return this.bbox; } - + public void addAdvance(float advance, float size) { this.advance.add(advance, size); } - + public float getAdvance(float size, boolean useFrationalMetrics) { return this.advance.get(size, useFrationalMetrics); } - + public String toString() { return "\nMetrics:"+ "\n bbox: "+this.bbox+ this.advance; } - } + } public static final short INVALID_ID = (short)((1 << 16) - 1); public static final short MAX_ID = (short)((1 << 16) - 2); - + private final Font font; - + char symbol; short id; int advance; Metrics metrics; - + protected Path2D path; // in EM units protected Path2D pathSized; protected float numberSized; - + protected TypecastGlyph(Font font, char symbol) { this.font = font; this.symbol = symbol; } - + protected TypecastGlyph(Font font, char symbol, short id, AABBox bbox, int advance, Path2D path) { this.font = font; this.symbol = symbol; this.advance = advance; - + init(id, bbox, advance); - + this.path = path; this.pathSized = null; this.numberSized = 0.0f; } - + void init(short id, AABBox bbox, int advance) { this.id = id; this.advance = advance; this.metrics = new Metrics(this.font, bbox, this.advance); } - + public void reset(Path2D path) { this.path = path; this.metrics.reset(); } - + public Font getFont() { return this.font; } - + public char getSymbol() { return this.symbol; } - + AABBox getBBoxUnsized() { return this.metrics.getBBox(); } - + public AABBox getBBox() { return this.metrics.getBBox(); } - + public Metrics getMetrics() { return this.metrics; } - + public short getID() { return this.id; } - + public float getScale(float pixelSize) { return this.metrics.getScale(pixelSize); } - + public AABBox getBBox(float pixelSize) { final float size = getScale(pixelSize); AABBox newBox = getBBox().clone(); newBox.scale(size); - return newBox; + return newBox; } - + protected void addAdvance(float advance, float size) { this.metrics.addAdvance(advance, size); } - + public float getAdvance(float pixelSize, boolean useFrationalMetrics) { return this.metrics.getAdvance(pixelSize, useFrationalMetrics); } - + public Path2D getPath() { return this.path; } - + public Path2D getPath(float pixelSize) { final float size = getScale(pixelSize); - + if (this.numberSized != size) { this.numberSized = size; this.pathSized = AffineTransform.getScaleInstance(null, size, size).createTransformedShape(getPath()); - } + } return this.pathSized; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index f170f5819..a6ce58ae2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -35,7 +35,7 @@ import com.jogamp.opengl.math.geom.AABBox; class TypecastHMetrics implements Metrics { private final TypecastFont fontImpl; - + // HeadTable private final HeadTable headTable; private final float unitsPerEM_Inv; @@ -44,23 +44,23 @@ class TypecastHMetrics implements Metrics { private final HheaTable hheaTable; // VheaTable (for horizontal fonts) // private final VheaTable vheaTable; - + public TypecastHMetrics(TypecastFont fontImpl) { this.fontImpl = fontImpl; headTable = this.fontImpl.font.getHeadTable(); - hheaTable = this.fontImpl.font.getHheaTable(); + hheaTable = this.fontImpl.font.getHheaTable(); // vheaTable = this.fontImpl.font.getVheaTable(); unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() ); - + int maxWidth = headTable.getXMax() - headTable.getXMin(); - int maxHeight = headTable.getYMax() - headTable.getYMin(); + int maxHeight = headTable.getYMax() - headTable.getYMin(); float lowx= headTable.getXMin(); float lowy = -(headTable.getYMin()+maxHeight); float highx = lowx + maxWidth; float highy = lowy + maxHeight; bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert } - + public final float getAscent(float pixelSize) { return getScale(pixelSize) * -hheaTable.getAscender(); // invert } @@ -78,7 +78,7 @@ class TypecastHMetrics implements Metrics { } public final AABBox getBBox(float pixelSize) { AABBox res = new AABBox(bbox.getLow(), bbox.getHigh()); - res.scale(getScale(pixelSize)); + res.scale(getScale(pixelSize)); return res; } }
\ No newline at end of file diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index f155345aa..127e260ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -43,14 +43,14 @@ import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Vertex.Factory; /** - * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from - * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s. + * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from + * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s. */ public class TypecastRenderer { - private static void getPaths(TypecastFont font, + private static void getPaths(TypecastFont font, CharSequence string, float pixelSize, AffineTransform transform, Path2D[] p) - { + { if (string == null) { return; } @@ -79,14 +79,14 @@ public class TypecastRenderer { } else if (character == ' ') { advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, pixelSize); continue; - } + } Glyph glyph = font.getGlyph(character); Path2D gp = ((GlyphInt)glyph).getPath(); float scale = metrics.getScale(pixelSize); t.translate(advanceTotal, y); t.scale(scale, scale); p[i].append(gp.iterator(t), false); - advanceTotal += glyph.getAdvance(pixelSize, true); + advanceTotal += glyph.getAdvance(pixelSize, true); } } @@ -119,19 +119,19 @@ public class TypecastRenderer { case PathIterator.SEG_MOVETO: shape.closeLastOutline(); shape.addEmptyOutline(); - shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); break; case PathIterator.SEG_LINETO: - shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 0, 2, true)); break; case PathIterator.SEG_QUADTO: shape.addVertex(0, vertexFactory.create(coords, 0, 2, false)); - shape.addVertex(0, vertexFactory.create(coords, 2, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 2, 2, true)); break; case PathIterator.SEG_CUBICTO: shape.addVertex(0, vertexFactory.create(coords, 0, 2, false)); shape.addVertex(0, vertexFactory.create(coords, 2, 2, false)); - shape.addVertex(0, vertexFactory.create(coords, 4, 2, true)); + shape.addVertex(0, vertexFactory.create(coords, 4, 2, true)); break; case PathIterator.SEG_CLOSE: shape.closeLastOutline(); @@ -184,12 +184,12 @@ public class TypecastRenderer { if (point_plus1.onCurve) { // s = new Line2D.Float(point.x, point.y, point_plus1.x, point_plus1.y); gp.lineTo( point_plus1.x, point_plus1.y ); - offset++; + offset++; } else { if (point_plus2.onCurve) { // s = new QuadCurve2D.Float( point.x, point.y, point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y); gp.quadTo(point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y); - offset+=2; + offset+=2; } else { // s = new QuadCurve2D.Float(point.x,point.y,point_plus1.x,point_plus1.y, // midValue(point_plus1.x, point_plus2.x), midValue(point_plus1.y, point_plus2.y)); @@ -210,7 +210,7 @@ public class TypecastRenderer { // midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y)); //gp.curve3(midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y), point.x, point.y); gp.quadTo(point.x, point.y, midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y)); - offset++; + offset++; } } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java index b5535758d..8b685659e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java index ece0aae4b..0a4786f82 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java @@ -840,11 +840,11 @@ public class Fixed { } return n; } - + public static float floatValue(long fixed) { return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000; } - + public static float roundedFloatValue(long fixed, int decimalPlaces) { int factor = 10 * decimalPlaces; return (float)((int)(floatValue(fixed) * factor)) / factor; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java index 6b3dc1f6f..d6c9da268 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 8c14b7302..8fc4be92d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -104,10 +104,10 @@ public class OTFont { public StringBuilder getName(int nameIndex, StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); - } + } return _name.getRecordsRecordString(sb, nameIndex); } - + public StringBuilder getAllNames(StringBuilder sb, String separator) { if(null != _name) { if(null == sb) { @@ -117,9 +117,9 @@ public class OTFont { _name.getRecord(i).getRecordString(sb).append(separator); } } - return sb; + return sb; } - + public Table getTable(int tableType) { for (int i = 0; i < _tables.length; i++) { if ((_tables[i] != null) && (_tables[i].getType() == tableType)) { @@ -132,31 +132,31 @@ public class OTFont { public Os2Table getOS2Table() { return _os2; } - + public CmapTable getCmapTable() { return _cmap; } - + public HeadTable getHeadTable() { return _head; } - + public HheaTable getHheaTable() { return _hhea; } - + public HdmxTable getHdmxTable() { return _hdmx; } - + public HmtxTable getHmtxTable() { return _hmtx; } - + public LocaTable getLocaTable() { return _loca; } - + public MaxpTable getMaxpTable() { return _maxp; } @@ -186,8 +186,8 @@ public class OTFont { } public OTGlyph getGlyph(int i) { - - final GlyfDescript _glyfDescr = _glyf.getDescription(i); + + final GlyfDescript _glyfDescr = _glyf.getDescription(i); return (null != _glyfDescr) ? new OTGlyph( _glyfDescr, @@ -195,11 +195,11 @@ public class OTFont { _hmtx.getAdvanceWidth(i)) : null; } - + public TableDirectory getTableDirectory() { return _tableDirectory; } - + private Table readTable( DataInputStream dis, int tablesOrigin, @@ -228,13 +228,13 @@ public class OTFont { DataInputStream dis, int directoryOffset, int tablesOrigin) throws IOException { - + // Load the table directory dis.reset(); dis.skip(directoryOffset); _tableDirectory = new TableDirectory(dis); _tables = new Table[_tableDirectory.getNumTables()]; - + // Load some prerequisite tables _head = (HeadTable) readTable(dis, tablesOrigin, Table.head); _hhea = (HheaTable) readTable(dis, tablesOrigin, Table.hhea); @@ -252,7 +252,7 @@ public class OTFont { if (_vhea != null) { _tables[index++] = _vhea; } - + // Load all other tables for (int i = 0; i < _tableDirectory.getNumTables(); i++) { DirectoryEntry entry = _tableDirectory.getEntry(i); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java index 4a041604d..c79380f16 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java @@ -75,11 +75,11 @@ public class OTFontCollection { public OTFont getFont(int i) { return _fonts[i]; } - + public int getFontCount() { return _fonts.length; } - + public TTCHeader getTtcHeader() { return _ttcHeader; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java index 244ab400a..e0d652bd4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java @@ -102,10 +102,10 @@ public class OTGlyph { } } - public AABBox getBBox() { - return _bbox; + public AABBox getBBox() { + return _bbox; } - + public int getAdvanceWidth() { return _advanceWidth; } @@ -163,7 +163,7 @@ public class OTGlyph { // Append the origin and advanceWidth points (n & n+1) // _points[gd.getPointCount()] = new Point(0, 0, true, true); // _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true); - + _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java index 433ff6051..7a5b0c4d2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java @@ -31,7 +31,7 @@ import java.io.IOException; public class ResourceData { private byte[] data; - + /** Creates new ResourceData */ public ResourceData(DataInput di) throws IOException { int dataLen = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java index 2ada22c82..468ab2e1c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java @@ -33,14 +33,14 @@ public class ResourceFile { private ResourceHeader header; private ResourceMap map; - + /** Creates new Resource */ public ResourceFile(RandomAccessFile raf) throws IOException { // Read header at the beginning of the file raf.seek(0); header = new ResourceHeader(raf); - + // Seek to the map offset and read the map raf.seek(header.getMapOffset()); map = new ResourceMap(raf); @@ -53,18 +53,18 @@ public class ResourceFile { public static void main(String[] args) { try { //RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/GillSans.dfont", "r"); - + // Tests loading a font from a resource fork on Mac OS X RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); ResourceFile resource = new ResourceFile(raf); for (int i = 0; i < resource.getResourceMap().getResourceTypeCount(); i++) { System.out.println(resource.getResourceMap().getResourceType(i).getTypeAsString()); } - + // Get the first 'sfnt' resource ResourceType type = resource.getResourceMap().getResourceType("sfnt"); ResourceReference reference = type.getReference(0); - + type = resource.getResourceMap().getResourceType("FOND"); for (int i = 0; i < type.getCount(); ++i) { reference = type.getReference(i); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java index 8f5224632..de13b116f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java @@ -46,15 +46,15 @@ public class ResourceHeader { public int getDataOffset() { return dataOffset; } - + public int getMapOffset() { return mapOffset; } - + public int getDataLength() { return dataLen; } - + public int getMapLength() { return mapLen; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java index 96ba06087..d348c645e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java @@ -35,7 +35,7 @@ public class ResourceMap { private int fileReferenceNumber; private int attributes; private ResourceType[] types; - + /** Creates new ResourceMap */ public ResourceMap(DataInput di) throws IOException { di.readFully(headerCopy); @@ -45,18 +45,18 @@ public class ResourceMap { int typeOffset = di.readUnsignedShort(); int nameOffset = di.readUnsignedShort(); int typeCount = di.readUnsignedShort() + 1; - + // Read types types = new ResourceType[typeCount]; for (int i = 0; i < typeCount; i++) { types[i] = new ResourceType(di); } - + // Read the references for (int i = 0; i < typeCount; i++) { types[i].readRefs(di); } - + // Read the names for (int i = 0; i < typeCount; i++) { types[i].readNames(di); @@ -76,7 +76,7 @@ public class ResourceMap { public ResourceType getResourceType(int i) { return types[i]; } - + public int getResourceTypeCount() { return types.length; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java index fd7ec46b2..9d1534821 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java @@ -36,7 +36,7 @@ public class ResourceReference { private int dataOffset; private int handle; private String name; - + /** Creates new ResourceReference */ protected ResourceReference(DataInput di) throws IOException { id = di.readUnsignedShort(); @@ -58,23 +58,23 @@ public class ResourceReference { public int getId() { return id; } - + public short getNameOffset() { return nameOffset; } - + public short getAttributes() { return attributes; } - + public int getDataOffset() { return dataOffset; } - + public int getHandle() { return handle; } - + public String getName() { return name; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java index 1c7e24c0f..2ad002e6a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java @@ -34,7 +34,7 @@ public class ResourceType { private int count; private int offset; private ResourceReference[] references; - + /** Creates new ResourceType */ protected ResourceType(DataInput di) throws IOException { type = di.readInt(); @@ -42,7 +42,7 @@ public class ResourceType { offset = di.readUnsignedShort(); references = new ResourceReference[count]; } - + protected void readRefs(DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i] = new ResourceReference(di); @@ -58,7 +58,7 @@ public class ResourceType { public int getType() { return type; } - + public String getTypeAsString() { return new StringBuilder() .append((char)((type>>24)&0xff)) @@ -67,11 +67,11 @@ public class ResourceType { .append((char)((type)&0xff)) .toString(); } - + public int getCount() { return count; } - + public int getOffset() { return offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java index ed615eb72..b6626a9cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java @@ -31,18 +31,18 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class BaseTable implements Table { - + private abstract class BaseCoord { public abstract int getBaseCoordFormat(); - + public abstract short getCoordinate(); } - + private class BaseCoordFormat1 extends BaseCoord { private short _coordinate; - + protected BaseCoordFormat1(DataInput di) throws IOException { _coordinate = di.readShort(); } @@ -50,19 +50,19 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 1; } - + public short getCoordinate() { return _coordinate; } - + } - + private class BaseCoordFormat2 extends BaseCoord { private short _coordinate; private int _referenceGlyph; private int _baseCoordPoint; - + protected BaseCoordFormat2(DataInput di) throws IOException { _coordinate = di.readShort(); _referenceGlyph = di.readUnsignedShort(); @@ -72,18 +72,18 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 2; } - + public short getCoordinate() { return _coordinate; } - + } - + private class BaseCoordFormat3 extends BaseCoord { private short _coordinate; private int _deviceTableOffset; - + protected BaseCoordFormat3(DataInput di) throws IOException { _coordinate = di.readShort(); _deviceTableOffset = di.readUnsignedShort(); @@ -92,33 +92,33 @@ public class BaseTable implements Table { public int getBaseCoordFormat() { return 2; } - + public short getCoordinate() { return _coordinate; } - + } - + private class FeatMinMaxRecord { - + private int _tag; private int _minCoordOffset; private int _maxCoordOffset; - + protected FeatMinMaxRecord(DataInput di) throws IOException { _tag = di.readInt(); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); } } - + private class MinMax { - + private int _minCoordOffset; private int _maxCoordOffset; private int _featMinMaxCount; private FeatMinMaxRecord[] _featMinMaxRecord; - + protected MinMax(int minMaxOffset) throws IOException { DataInput di = getDataInputForOffset(minMaxOffset); _minCoordOffset = di.readUnsignedShort(); @@ -130,14 +130,14 @@ public class BaseTable implements Table { } } } - + private class BaseValues { - + private int _defaultIndex; private int _baseCoordCount; private int[] _baseCoordOffset; private BaseCoord[] _baseCoords; - + protected BaseValues(int baseValuesOffset) throws IOException { DataInput di = getDataInputForOffset(baseValuesOffset); _defaultIndex = di.readUnsignedShort(); @@ -163,12 +163,12 @@ public class BaseTable implements Table { } } } - + private class BaseLangSysRecord { - + private int _baseLangSysTag; private int _minMaxOffset; - + protected BaseLangSysRecord(DataInput di) throws IOException { _baseLangSysTag = di.readInt(); _minMaxOffset = di.readUnsignedShort(); @@ -177,14 +177,14 @@ public class BaseTable implements Table { public int getBaseLangSysTag() { return _baseLangSysTag; } - + public int getMinMaxOffset() { return _minMaxOffset; } } - + private class BaseScript { - + private int _thisOffset; private int _baseValuesOffset; private int _defaultMinMaxOffset; @@ -192,7 +192,7 @@ public class BaseTable implements Table { private BaseLangSysRecord[] _baseLangSysRecord; private BaseValues _baseValues; private MinMax[] _minMax; - + protected BaseScript(int baseScriptOffset) throws IOException { _thisOffset = baseScriptOffset; DataInput di = getDataInputForOffset(baseScriptOffset); @@ -231,9 +231,9 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class BaseScriptRecord { - + private int _baseScriptTag; private int _baseScriptOffset; @@ -245,19 +245,19 @@ public class BaseTable implements Table { public int getBaseScriptTag() { return _baseScriptTag; } - + public int getBaseScriptOffset() { return _baseScriptOffset; } } - + private class BaseScriptList { - + private int _thisOffset; private int _baseScriptCount; private BaseScriptRecord[] _baseScriptRecord; private BaseScript[] _baseScripts; - + protected BaseScriptList(int baseScriptListOffset) throws IOException { _thisOffset = baseScriptListOffset; DataInput di = getDataInputForOffset(baseScriptListOffset); @@ -288,13 +288,13 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class BaseTagList { - + private int _thisOffset; private int _baseTagCount; private int[] _baselineTag; - + protected BaseTagList(int baseTagListOffset) throws IOException { _thisOffset = baseTagListOffset; DataInput di = getDataInputForOffset(baseTagListOffset); @@ -315,9 +315,9 @@ public class BaseTable implements Table { return sb.toString(); } } - + private class Axis { - + private int _thisOffset; private int _baseTagListOffset; private int _baseScriptListOffset; @@ -348,7 +348,7 @@ public class BaseTable implements Table { .toString(); } } - + private DirectoryEntry _de; private int _version; private int _horizAxisOffset; @@ -375,25 +375,25 @@ public class BaseTable implements Table { if (_vertAxisOffset != 0) { _vertAxis = new Axis(_vertAxisOffset); } - + // Let go of the buffer _buf = null; } - + private DataInput getDataInputForOffset(int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); } - + // private String valueAsShortHex(int value) { // return String.format("%1$4x", value); // } -// +// // private String valueAsLongHex(int value) { // return String.format("%1$8x", value); // } - + static protected String tagAsString(int tag) { char[] c = new char[4]; c[0] = (char)((tag >> 24) & 0xff); @@ -402,7 +402,7 @@ public class BaseTable implements Table { c[3] = (char)(tag & 0xff); return String.valueOf(c); } - + public int getType() { return BASE; } @@ -422,7 +422,7 @@ public class BaseTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java index 966f6e17b..62486fb7f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java @@ -36,13 +36,13 @@ import java.util.Hashtable; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class CffTable implements Table { - + public class Dict { - + private Dictionary<Integer, Object> _entries = new Hashtable<Integer, Object>(); private int[] _data; private int _index; - + protected Dict(int[] data, int offset, int length) { _data = data; _index = offset; @@ -50,11 +50,11 @@ public class CffTable implements Table { addKeyAndValueEntry(); } } - + public Object getValue(int key) { return _entries.get(key); } - + private boolean addKeyAndValueEntry() { ArrayList<Object> operands = new ArrayList<Object>(); Object operand = null; @@ -74,7 +74,7 @@ public class CffTable implements Table { } return true; } - + private boolean isOperandAtIndex() { int b0 = _data[_index]; if ((32 <= b0 && b0 <= 254) @@ -97,31 +97,31 @@ public class CffTable implements Table { private Object nextOperand() { int b0 = _data[_index]; if (32 <= b0 && b0 <= 246) { - + // 1 byte integer ++_index; return new Integer(b0 - 139); } else if (247 <= b0 && b0 <= 250) { - + // 2 byte integer int b1 = _data[_index + 1]; _index += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { - + // 2 byte integer int b1 = _data[_index + 1]; _index += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { - + // 3 byte integer int b1 = _data[_index + 1]; int b2 = _data[_index + 2]; _index += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 29) { - + // 5 byte integer int b1 = _data[_index + 1]; int b2 = _data[_index + 2]; @@ -130,7 +130,7 @@ public class CffTable implements Table { _index += 5; return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4); } else if (b0 == 30) { - + // Real number StringBuilder fString = new StringBuilder(); int nibble1 = 0; @@ -142,13 +142,13 @@ public class CffTable implements Table { ++_index; fString.append(decodeRealNibble(nibble1)); fString.append(decodeRealNibble(nibble2)); - } + } return new Float(fString.toString()); } else { return null; } } - + private String decodeRealNibble(int nibble) { if (nibble < 0xa) { return Integer.toString(nibble); @@ -163,7 +163,7 @@ public class CffTable implements Table { } return ""; } - + public String toString() { StringBuilder sb = new StringBuilder(); Enumeration<Integer> keys = _entries.keys(); @@ -179,14 +179,14 @@ public class CffTable implements Table { return sb.toString(); } } - + public class Index { - + private int _count; private int _offSize; private int[] _offset; private int[] _data; - + protected Index(DataInput di) throws IOException { _count = di.readUnsignedShort(); _offset = new int[_count + 1]; @@ -203,19 +203,19 @@ public class CffTable implements Table { _data[i] = di.readUnsignedByte(); } } - + public int getCount() { return _count; } - + public int getOffset(int index) { return _offset[index]; } - + public int getDataLength() { return _offset[_offset.length - 1] - 1; } - + public int[] getData() { return _data; } @@ -241,13 +241,13 @@ public class CffTable implements Table { return sb.toString(); } } - + public class TopDictIndex extends Index { protected TopDictIndex(DataInput di) throws IOException { super(di); } - + public Dict getTopDict(int index) { int offset = getOffset(index) - 1; int len = getOffset(index + 1) - offset - 1; @@ -262,13 +262,13 @@ public class CffTable implements Table { return sb.toString(); } } - + public class NameIndex extends Index { protected NameIndex(DataInput di) throws IOException { super(di); } - + public String getName(int index) { String name = null; int offset = getOffset(index) - 1; @@ -286,7 +286,7 @@ public class CffTable implements Table { } return name; } - + public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { @@ -301,7 +301,7 @@ public class CffTable implements Table { protected StringIndex(DataInput di) throws IOException { super(di); } - + public String getString(int index) { if (index < CffStandardStrings.standardStrings.length) { return CffStandardStrings.standardStrings[index]; @@ -320,7 +320,7 @@ public class CffTable implements Table { return sb.toString(); } } - + public String toString() { int nonStandardBase = CffStandardStrings.standardStrings.length; StringBuilder sb = new StringBuilder(); @@ -331,12 +331,12 @@ public class CffTable implements Table { return sb.toString(); } } - + private class CharsetRange { - + private int _first; private int _left; - + public int getFirst() { return _first; } @@ -344,7 +344,7 @@ public class CffTable implements Table { protected void setFirst(int first) { _first = first; } - + public int getLeft() { return _left; } @@ -355,39 +355,39 @@ public class CffTable implements Table { } private class CharsetRange1 extends CharsetRange { - + protected CharsetRange1(DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedByte()); } } - + private class CharsetRange2 extends CharsetRange { - + protected CharsetRange2(DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedShort()); } } - + private abstract class Charset { - + public abstract int getFormat(); - + public abstract int getSID(int gid); } - + private class CharsetFormat0 extends Charset { - + private int[] _glyph; - + protected CharsetFormat0(DataInput di, int glyphCount) throws IOException { _glyph = new int[glyphCount - 1]; // minus 1 because .notdef is omitted for (int i = 0; i < glyphCount - 1; ++i) { _glyph[i] = di.readUnsignedShort(); } } - + public int getFormat() { return 0; } @@ -399,11 +399,11 @@ public class CffTable implements Table { return _glyph[gid - 1]; } } - + private class CharsetFormat1 extends Charset { - + private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - + protected CharsetFormat1(DataInput di, int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { @@ -421,7 +421,7 @@ public class CffTable implements Table { if (gid == 0) { return 0; } - + // Count through the ranges to find the one of interest int count = 0; for (CharsetRange range : _charsetRanges) { @@ -436,9 +436,9 @@ public class CffTable implements Table { } private class CharsetFormat2 extends Charset { - + private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>(); - + protected CharsetFormat2(DataInput di, int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { @@ -456,7 +456,7 @@ public class CffTable implements Table { if (gid == 0) { return 0; } - + // Count through the ranges to find the one of interest int count = 0; for (CharsetRange range : _charsetRanges) { @@ -469,7 +469,7 @@ public class CffTable implements Table { return 0; } } - + private DirectoryEntry _de; private int _major; private int _minor; @@ -499,24 +499,24 @@ public class CffTable implements Table { _minor = di2.readUnsignedByte(); _hdrSize = di2.readUnsignedByte(); _offSize = di2.readUnsignedByte(); - + // Name INDEX di2 = getDataInputForOffset(_hdrSize); _nameIndex = new NameIndex(di2); - + // Top DICT INDEX _topDictIndex = new TopDictIndex(di2); // String INDEX _stringIndex = new StringIndex(di2); - + // Global Subr INDEX _globalSubrIndex = new Index(di2); - + // Encodings go here -- but since this is an OpenType font will this // not always be a CIDFont? In which case there are no encodings // within the CFF data. - + // Load each of the fonts _charStringsIndexArray = new Index[_topDictIndex.getCount()]; _charsets = new Charset[_topDictIndex.getCount()]; @@ -530,7 +530,7 @@ public class CffTable implements Table { di2 = getDataInputForOffset(charStringsOffset); _charStringsIndexArray[i] = new Index(di2); int glyphCount = _charStringsIndexArray[i].getCount(); - + // Charsets Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); di2 = getDataInputForOffset(charsetOffset); @@ -563,7 +563,7 @@ public class CffTable implements Table { } } } - + private DataInput getDataInputForOffset(int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, @@ -573,7 +573,7 @@ public class CffTable implements Table { public NameIndex getNameIndex() { return _nameIndex; } - + public Charset getCharset(int fontIndex) { return _charsets[fontIndex]; } @@ -581,7 +581,7 @@ public class CffTable implements Table { public Charstring getCharstring(int fontIndex, int gid) { return _charstringsArray[fontIndex][gid]; } - + public int getCharstringCount(int fontIndex) { return _charstringsArray[fontIndex].length; } @@ -607,7 +607,7 @@ public class CffTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java index d411d1e00..01e2d4934 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java @@ -28,6 +28,6 @@ package jogamp.graph.font.typecast.ot.table; public abstract class Charstring { public abstract int getIndex(); - + public abstract String getName(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java index 9c40a0e5e..93ff60988 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java @@ -28,7 +28,7 @@ import jogamp.graph.font.typecast.ot.table.CffTable; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class CharstringType2 extends Charstring { - + private static final String[] _oneByteOperators = { "-Reserved-", "hstem", @@ -105,7 +105,7 @@ public class CharstringType2 extends Charstring { "flex1", "-Reserved-" }; - + private int _index; private String _name; private int[] _data; @@ -132,7 +132,7 @@ public class CharstringType2 extends Charstring { _localSubrIndex = localSubrIndex; _globalSubrIndex = globalSubrIndex; } - + public int getIndex() { return _index; } @@ -140,7 +140,7 @@ public class CharstringType2 extends Charstring { public String getName() { return _name; } - + private void disassemble(StringBuilder sb) { Number operand = null; while (isOperandAtIndex()) { @@ -151,7 +151,7 @@ public class CharstringType2 extends Charstring { String mnemonic; if (operator == 12) { operator = nextByte(); - + // Check we're not exceeding the upper limit of our mnemonics if (operator > 38) { operator = 38; @@ -162,7 +162,7 @@ public class CharstringType2 extends Charstring { } sb.append(mnemonic); } - + public void resetIP() { _ip = _offset; } @@ -214,15 +214,15 @@ public class CharstringType2 extends Charstring { return null; } } - + public int nextByte() { return _data[_ip++]; } - + public boolean moreBytes() { return _ip < _offset + _length; } - + public String toString() { StringBuilder sb = new StringBuilder(); resetIP(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java index 4c2f3decb..21698c76b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java index 0c99ad66a..1079aeed4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java index 5b7c4d655..59bc7b329 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java index 7ce531cd9..62ce5ae4c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java @@ -58,21 +58,21 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public abstract class CmapFormat { - + public class Range { - + private int _startCode; private int _endCode; - + protected Range(int startCode, int endCode) { _startCode = startCode; _endCode = endCode; } - + public int getStartCode() { return _startCode; } - + public int getEndCode() { return _endCode; } @@ -116,12 +116,12 @@ public abstract class CmapFormat { } public abstract int getRangeCount(); - + public abstract Range getRange(int index) throws ArrayIndexOutOfBoundsException; public abstract int mapCharCode(int charCode); - + public String toString() { return new StringBuilder() .append("format: ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java index e374f82d2..2093158bd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java @@ -74,7 +74,7 @@ public class CmapFormat0 extends CmapFormat { public int getRangeCount() { return 1; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index != 0) { throw new ArrayIndexOutOfBoundsException(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java index 319d8c0d0..222c93852 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java @@ -67,7 +67,7 @@ public class CmapFormat2 extends CmapFormat { int _idRangeOffset; int _arrayIndex; } - + private int[] _subHeaderKeys = new int[256]; private SubHeader[] _subHeaders; private int[] _glyphIndexArray; @@ -75,9 +75,9 @@ public class CmapFormat2 extends CmapFormat { protected CmapFormat2(DataInput di) throws IOException { super(di); _format = 2; - + int pos = 6; - + // Read the subheader keys, noting the highest value, as this will // determine the number of subheaders to read. int highest = 0; @@ -88,7 +88,7 @@ public class CmapFormat2 extends CmapFormat { } int subHeaderCount = highest / 8 + 1; _subHeaders = new SubHeader[subHeaderCount]; - + // Read the subheaders, once again noting the highest glyphIndexArray // index range. int indexArrayOffset = 8 * subHeaderCount + 518; @@ -99,18 +99,18 @@ public class CmapFormat2 extends CmapFormat { sh._entryCount = di.readUnsignedShort(); sh._idDelta = di.readShort(); sh._idRangeOffset = di.readUnsignedShort(); - + // Calculate the offset into the _glyphIndexArray pos += 8; sh._arrayIndex = (pos - 2 + sh._idRangeOffset - indexArrayOffset) / 2; - + // What is the highest range within the glyphIndexArray? highest = Math.max(highest, sh._arrayIndex + sh._entryCount); - + _subHeaders[i] = sh; } - + // Read the glyphIndexArray _glyphIndexArray = new int[highest]; for (int i = 0; i < _glyphIndexArray.length; ++i) { @@ -121,12 +121,12 @@ public class CmapFormat2 extends CmapFormat { public int getRangeCount() { return _subHeaders.length; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _subHeaders.length) { throw new ArrayIndexOutOfBoundsException(); } - + // Find the high-byte (if any) int highByte = 0; if (index != 0) { @@ -137,7 +137,7 @@ public class CmapFormat2 extends CmapFormat { } } } - + return new Range( highByte | _subHeaders[index]._firstCode, highByte | (_subHeaders[index]._firstCode + @@ -145,7 +145,7 @@ public class CmapFormat2 extends CmapFormat { } public int mapCharCode(int charCode) { - + // Get the appropriate subheader int index = 0; int highByte = charCode >> 8; @@ -153,14 +153,14 @@ public class CmapFormat2 extends CmapFormat { index = _subHeaderKeys[highByte] / 8; } SubHeader sh = _subHeaders[index]; - + // Is the charCode out-of-range? int lowByte = charCode & 0xff; if (lowByte < sh._firstCode || lowByte >= (sh._firstCode + sh._entryCount)) { return 0; } - + // Now calculate the glyph index int glyphIndex = _glyphIndexArray[sh._arrayIndex + (lowByte - sh._firstCode)]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java index c09bdc8c3..ef65867af 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java @@ -102,7 +102,7 @@ public class CmapFormat4 extends CmapFormat { for (int i = 0; i < count; i++) { _glyphIdArray[i] = di.readUnsignedShort(); } // + 2*count (8*segCount + 2*count + 18) - + // Are there any padding bytes we need to consume? // int leftover = length - (8*segCount + 2*count + 18); // if (leftover > 0) { @@ -113,7 +113,7 @@ public class CmapFormat4 extends CmapFormat { public int getRangeCount() { return _segCount; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _segCount) { throw new ArrayIndexOutOfBoundsException(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java index a58531d11..a22e33244 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java @@ -67,7 +67,7 @@ public class CmapFormat6 extends CmapFormat { protected CmapFormat6(DataInput di) throws IOException { super(di); _format = 6; - + // HACK: As this is not yet implemented, we need to skip over the bytes // we should be consuming //di.skipBytes(_length - 4); @@ -76,7 +76,7 @@ public class CmapFormat6 extends CmapFormat { public int getRangeCount() { return 0; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java index 83366b593..3544b6f62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java @@ -30,12 +30,12 @@ import java.io.IOException; * @version $Id: CmapFormatUnknown.java,v 1.1 2004-12-21 10:21:23 davidsch Exp $ */ public class CmapFormatUnknown extends CmapFormat { - + /** Creates a new instance of CmapFormatUnknown */ protected CmapFormatUnknown(int format, DataInput di) throws IOException { super(di); _format = format; - + // We don't know how to handle this data, so we'll just skip over it di.skipBytes(_length - 4); } @@ -43,7 +43,7 @@ public class CmapFormatUnknown extends CmapFormat { public int getRangeCount() { return 0; } - + public Range getRange(int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java index 85fdf7225..47f6c470d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java @@ -85,7 +85,7 @@ public class CmapIndexEntry implements Comparable { public CmapFormat getFormat() { return _format; } - + public void setFormat(CmapFormat format) { _format = format; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java index 0050fdd8e..016efa093 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java @@ -94,7 +94,7 @@ public class CmapTable implements Table { } else if (_entries[i].getOffset() > bytesRead) { di.skipBytes(_entries[i].getOffset() - (int) bytesRead); } else if (_entries[i].getOffset() != bytesRead) { - + // Something is amiss throw new IOException(); } @@ -109,15 +109,15 @@ public class CmapTable implements Table { public int getVersion() { return _version; } - + public int getNumTables() { return _numTables; } - + public CmapIndexEntry getCmapIndexEntry(int i) { return _entries[i]; } - + public CmapFormat getCmapFormat(short platformId, short encodingId) { // Find the requested format @@ -148,7 +148,7 @@ public class CmapTable implements Table { // } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java index e85fadb5e..4f526f51d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java @@ -68,7 +68,7 @@ public abstract class Coverage { * can't be found. */ public abstract int findGlyph(int glyphId); - + protected static Coverage read(DataInput di) throws IOException { Coverage c = null; int format = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java index 963163584..867ef1823 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -47,7 +47,7 @@ public class CvtTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -57,5 +57,5 @@ public class CvtTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java index 6b4af6908..5451f4502 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java index c98f03fe9..7abcec0ce 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java @@ -70,7 +70,7 @@ public class DirectoryEntry implements Cloneable { _offset = di.readInt(); _length = di.readInt(); } - + public Object clone() { try { return super.clone(); @@ -103,7 +103,7 @@ public class DirectoryEntry implements Cloneable { .append((char)((_tag)&0xff)) .toString(); } - + public String toString() { return new StringBuilder() .append("'").append(getTagAsString()) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java index 4b41f451d..4a09a4c34 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -21,7 +21,7 @@ public class DsigEntry { private int format; private int length; private int offset; - + /** Creates new DsigEntry */ protected DsigEntry(DataInput di) throws IOException { format = di.readInt(); @@ -32,11 +32,11 @@ public class DsigEntry { public int getFormat() { return format; } - + public int getLength() { return length; } - + public int getOffset() { return offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java index e2784f9e6..f25c595d0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -48,7 +48,7 @@ public class DsigTable implements Table { public int getType() { return DSIG; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -58,7 +58,7 @@ public class DsigTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + public String toString() { StringBuilder sb = new StringBuilder().append("DSIG\n"); for (int i = 0; i < numSigs; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java index 3cfb54a38..fdedca94a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java @@ -66,11 +66,11 @@ public class FeatureList { /** Creates new FeatureList */ public FeatureList(DataInputStream dis, int offset) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _featureCount = dis.readUnsignedShort(); _featureRecords = new FeatureRecord[_featureCount]; @@ -88,11 +88,11 @@ public class FeatureList { public int getFeatureCount() { return _featureCount; } - + public FeatureRecord getFeatureRecord(int i) { return _featureRecords[i]; } - + public Feature getFeature(int i) { return _features[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java index eb610814b..1da74f4d5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java @@ -72,7 +72,7 @@ public class FeatureRecord { public int getTag() { return _tag; } - + public int getOffset() { return _offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java index 9a6000156..b662265d9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -33,7 +33,7 @@ public class FpgmTable extends Program implements Table { public String toString() { return Disassembler.disassemble(getInstructions(), 0); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -43,5 +43,5 @@ public class FpgmTable extends Program implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java index 2748406df..cf4afa88e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -20,10 +20,10 @@ public class GaspRange { public static final int GASP_GRIDFIT = 1; public static final int GASP_DOGRAY = 2; - + private int rangeMaxPPEM; private int rangeGaspBehavior; - + /** Creates new GaspRange */ protected GaspRange(DataInput di) throws IOException { rangeMaxPPEM = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java index a83db5bff..45498eda1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class GaspTable implements Table { private int version; private int numRanges; private GaspRange[] gaspRange; - + /** Creates new GaspTable */ protected GaspTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); @@ -49,7 +49,7 @@ public class GaspTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -59,5 +59,5 @@ public class GaspTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java index 4cf254198..50f62ed62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java @@ -73,7 +73,7 @@ public class GlyfCompositeDescript extends GlyfDescript { int glyphIndex, DataInput di) throws IOException { super(parentTable, glyphIndex, (short) -1, di); - + // Get all of the composite components GlyfCompositeComp comp; int firstIndex = 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java index a9342a434..a7e2e7b69 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java @@ -111,7 +111,7 @@ public abstract class GlyfDescript extends Program implements GlyphDescription { public short getYMinimum() { return _yMin; } - + public String toString() { return new StringBuilder() .append(" numberOfContours: ").append(_numberOfContours) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java index c11d2d8ff..f67162cff 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java @@ -73,7 +73,7 @@ public class GlyfSimpleDescript extends GlyfDescript { short numberOfContours, DataInput di) throws IOException { super(parentTable, glyphIndex, numberOfContours, di); - + // Simple glyph description _endPtsOfContours = new int[numberOfContours]; for (int i = 0; i < numberOfContours; i++) { @@ -184,7 +184,7 @@ public class GlyfSimpleDescript extends GlyfDescript { System.out.println("error: array index out of bounds"); } } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java index 22fdd8886..34a8218d9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java @@ -71,12 +71,12 @@ public class GlyfTable implements Table { LocaTable loca) throws IOException { _de = (DirectoryEntry) de.clone(); _descript = new GlyfDescript[maxp.getNumGlyphs()]; - + // Buffer the whole table so we can randomly access it byte[] buf = new byte[de.getLength()]; di.readFully(buf); ByteArrayInputStream bais = new ByteArrayInputStream(buf); - + // Process all the simple glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { int len = loca.getOffset(i + 1) - loca.getOffset(i); @@ -119,7 +119,7 @@ public class GlyfTable implements Table { public int getType() { return glyf; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java index 106e17917..025778dfc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java @@ -56,29 +56,29 @@ package jogamp.graph.font.typecast.ot.table; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public interface GlyphDescription { - + public int getGlyphIndex(); - + public int getEndPtOfContours(int i); - + public byte getFlags(int i); - + public short getXCoordinate(int i); - + public short getYCoordinate(int i); - + public short getXMaximum(); - + public short getXMinimum(); - + public short getYMaximum(); - + public short getYMinimum(); - + public boolean isComposite(); - + public int getPointCount(); - + public int getContourCount(); // public int getComponentIndex(int c); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java index 91a62362a..9a367412d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java @@ -48,7 +48,7 @@ public class GposTable implements Table { public int getType() { return GPOS; } - + public String toString() { return "GPOS"; } @@ -62,5 +62,5 @@ public class GposTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java index c002de374..0351c903d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java @@ -66,10 +66,10 @@ public class GsubTable implements Table, LookupSubtableFactory { private ScriptList _scriptList; private FeatureList _featureList; private LookupList _lookupList; - + protected GsubTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); - + // Load into a temporary buffer, and create another input stream byte[] buf = new byte[de.getLength()]; di.readFully(buf); @@ -86,17 +86,17 @@ public class GsubTable implements Table, LookupSubtableFactory { // Feature List _featureList = new FeatureList(dis, featureListOffset); - + // Lookup List _lookupList = new LookupList(dis, lookupListOffset, this); } /** - * 1 - Single - Replace one glyph with one glyph - * 2 - Multiple - Replace one glyph with more than one glyph - * 3 - Alternate - Replace one glyph with one of many glyphs - * 4 - Ligature - Replace multiple glyphs with one glyph - * 5 - Context - Replace one or more glyphs in context + * 1 - Single - Replace one glyph with one glyph + * 2 - Multiple - Replace one glyph with more than one glyph + * 3 - Alternate - Replace one glyph with one of many glyphs + * 4 - Ligature - Replace multiple glyphs with one glyph + * 5 - Context - Replace one or more glyphs in context * 6 - Chaining - Context Replace one or more glyphs in chained context */ public LookupSubtable read( @@ -167,7 +167,7 @@ public class GsubTable implements Table, LookupSubtableFactory { } return "Unknown"; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -177,5 +177,5 @@ public class GsubTable implements Table, LookupSubtableFactory { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java index 5b1fa2020..42f9bf0d0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java @@ -30,9 +30,9 @@ import java.io.IOException; * @version $Id: HdmxTable.java,v 1.2 2007-07-26 11:12:30 davidsch Exp $ */ public class HdmxTable implements Table { - + public class DeviceRecord { - + private short _pixelSize; private short _maxWidth; private short[] _widths; @@ -49,11 +49,11 @@ public class HdmxTable implements Table { public short getPixelSize() { return _pixelSize; } - + public short getMaxWidth() { return _maxWidth; } - + public short[] getWidths() { return _widths; } @@ -61,9 +61,9 @@ public class HdmxTable implements Table { public short getWidth(int glyphidx) { return _widths[glyphidx]; } - + } - + private DirectoryEntry _de; private int _version; private short _numRecords; @@ -78,7 +78,7 @@ public class HdmxTable implements Table { _numRecords = di.readShort(); _sizeDeviceRecords = di.readInt(); _records = new DeviceRecord[_numRecords]; - + // Read the device records for (int i = 0; i < _numRecords; ++i) { _records[i] = new DeviceRecord(maxp.getNumGlyphs(), di); @@ -88,15 +88,15 @@ public class HdmxTable implements Table { public int getNumberOfRecords() { return _numRecords; } - + public DeviceRecord getRecord(int i) { return _records[i]; } - + public int getType() { return hdmx; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java index 9d7fe4251..cf7c58449 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java @@ -192,7 +192,7 @@ public class HeadTable implements Table { .append("\n glyphDataFormat: ").append(_glyphDataFormat) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -202,5 +202,5 @@ public class HeadTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java index 20a21e4d9..0278929f1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -122,7 +122,7 @@ public class HheaTable implements Table { .append("\n numOf_LongHorMetrics: ").append(numberOfHMetrics) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -132,5 +132,5 @@ public class HheaTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java index 9fd66e728..eed8c1841 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java @@ -38,7 +38,7 @@ public abstract class ID { public static final short encodingUnicode11Semantics = 1; public static final short encodingISO10646Semantics = 2; public static final short encodingUnicode20Semantics = 3; - + // Microsoft Encoding IDs // public static final short encodingUndefined = 0; // public static final short encodingUGL = 1; @@ -203,7 +203,7 @@ public abstract class ID { public static String getEncodingName(short platformId, short encodingId) { if (platformId == platformUnicode) { - + // Unicode specific encodings switch (encodingId) { case encodingUnicode10Semantics: return "Unicode 1.0 semantics"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java index 7a4cccba2..04fd646a7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -21,7 +21,7 @@ public abstract class KernSubtable { /** Creates new KernSubtable */ protected KernSubtable() { } - + public abstract int getKerningPairCount(); public abstract KerningPair getKerningPair(int i); @@ -32,7 +32,7 @@ public abstract class KernSubtable { int length = di.readUnsignedShort(); int coverage = di.readUnsignedShort(); int format = coverage >> 8; - + switch (format) { case 0: table = new KernSubtableFormat0(di); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java index b55bef6d5..89e6f9f11 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @version $Id: KernSubtableFormat0.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $ */ public class KernSubtableFormat0 extends KernSubtable { - + private int nPairs; private int searchRange; private int entrySelector; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java index 60d584ca6..6f5e1f5e8 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java index 70aee70d2..1d526865a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @version $Id: KernTable.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $ */ public class KernTable implements Table { - + private DirectoryEntry de; private int version; private int nTables; @@ -37,7 +37,7 @@ public class KernTable implements Table { public int getSubtableCount() { return nTables; } - + public KernSubtable getSubtable(int i) { return tables[i]; } @@ -58,5 +58,5 @@ public class KernTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java index ce7cebc97..52f82cc85 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java index 6759208f5..1ab112a78 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java @@ -64,7 +64,7 @@ public class LangSys { private int _reqFeatureIndex; private int _featureCount; private int[] _featureIndex; - + /** Creates new LangSys */ protected LangSys(DataInput di) throws IOException { _lookupOrder = di.readUnsignedShort(); @@ -75,19 +75,19 @@ public class LangSys { _featureIndex[i] = di.readUnsignedShort(); } } - + public int getLookupOrder() { return _lookupOrder; } - + public int getReqFeatureIndex() { return _reqFeatureIndex; } - + public int getFeatureCount() { return _featureCount; } - + public int getFeatureIndex(int i) { return _featureIndex[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java index 9511f66ba..f3befe3b6 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java @@ -62,7 +62,7 @@ public class LangSysRecord { private int _tag; private int _offset; - + /** Creates new LangSysRecord */ public LangSysRecord(DataInput di) throws IOException { _tag = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java index d3e2ad5cd..de862a983 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java @@ -73,11 +73,11 @@ public class Ligature { _components[i] = di.readUnsignedShort(); } } - + public int getGlyphCount() { return _compCount; } - + public int getGlyphId(int i) { return (i == 0) ? _ligGlyph : _components[i-1]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java index a0f42662c..cad5e106a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java @@ -91,5 +91,5 @@ public class LigatureSubstFormat1 extends LigatureSubst { public String getTypeAsString() { return "LigatureSubstFormat1"; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java index 5eb7c5856..ce0862eea 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -64,7 +64,7 @@ public class LocaTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java index 2899c24d9..6496c3791 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java @@ -79,7 +79,7 @@ public class Lookup { // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _type = dis.readUnsignedShort(); _flag = dis.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java index a3b71b639..e70a932e4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java @@ -67,11 +67,11 @@ public class LookupList { /** Creates new LookupList */ public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _lookupCount = dis.readUnsignedShort(); _lookupOffsets = new int[_lookupCount]; @@ -87,11 +87,11 @@ public class LookupList { public int getLookupCount() { return _lookupCount; } - + public int getLookupOffset(int i) { return _lookupOffsets[i]; } - + public Lookup getLookup(int i) { return _lookups[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java index cb4d28d2c..ca67df7fb 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java @@ -47,13 +47,13 @@ Apache Software Foundation, please see <http://www.apache.org/>. */ - + package jogamp.graph.font.typecast.ot.table; import java.io.DataInputStream; import java.io.IOException; -/** +/** * * @author <a href="mailto:[email protected]">David Schweinsberg</a> * @version $Id: LookupSubtableFactory.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $ diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java index ace3d38b5..9b0c8e6b4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class LtshTable implements Table { private int version; private int numGlyphs; private int[] yPels; - + /** Creates new LtshTable */ protected LtshTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); @@ -41,7 +41,7 @@ public class LtshTable implements Table { public int getType() { return LTSH; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------") @@ -54,7 +54,7 @@ public class LtshTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -64,5 +64,5 @@ public class LtshTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java index 0e8ec44c7..5ab6b51ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -39,7 +39,7 @@ public class MaxpTable implements Table { protected MaxpTable(DirectoryEntry de, DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); versionNumber = di.readInt(); - + // CFF fonts use version 0.5, TrueType fonts use version 1.0 if (versionNumber == 0x00005000) { numGlyphs = di.readUnsignedShort(); @@ -149,7 +149,7 @@ public class MaxpTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -159,5 +159,5 @@ public class MaxpTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java index 268d6cfca..9f9822986 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java @@ -75,19 +75,19 @@ public class NameRecord { _stringLength = di.readShort(); _stringOffset = di.readShort(); } - + public short getEncodingId() { return _encodingId; } - + public short getLanguageId() { return _languageId; } - + public short getNameId() { return _nameId; } - + public short getPlatformId() { return _platformId; } @@ -101,7 +101,7 @@ public class NameRecord { StringBuilder sb = new StringBuilder(); di.skipBytes(_stringOffset); if (_platformId == ID.platformUnicode) { - + // Unicode (big-endian) for (int i = 0; i < _stringLength/2; i++) { sb.append(di.readChar()); @@ -113,13 +113,13 @@ public class NameRecord { sb.append((char) di.readByte()); } } else if (_platformId == ID.platformISO) { - + // ISO encoding, ASCII for (int i = 0; i < _stringLength; i++) { sb.append((char) di.readByte()); } } else if (_platformId == ID.platformMicrosoft) { - + // Microsoft encoding, Unicode char c; for (int i = 0; i < _stringLength/2; i++) { @@ -132,7 +132,7 @@ public class NameRecord { public String toString() { StringBuilder sb = new StringBuilder(); - + sb.append(" Platform ID: ").append(_platformId) .append("\n Specific ID: ").append(_encodingId) .append("\n Language ID: ").append(_languageId) @@ -140,7 +140,7 @@ public class NameRecord { .append("\n Length: ").append(_stringLength) .append("\n Offset: ").append(_stringOffset) .append("\n\n").append(_record); - + return sb.toString(); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java index 6daf2ad60..5b7a17d3b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java @@ -68,25 +68,25 @@ public class NameTable implements Table { private short _numberOfNameRecords; private short _stringStorageOffset; private NameRecord[] _records; - + protected NameTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _formatSelector = di.readShort(); _numberOfNameRecords = di.readShort(); _stringStorageOffset = di.readShort(); _records = new NameRecord[_numberOfNameRecords]; - + // Load the records, which contain the encoding information and string // offsets for (int i = 0; i < _numberOfNameRecords; i++) { _records[i] = new NameRecord(di); } - + // Load the string data into a buffer so the records can copy out the // bits they are interested in byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; di.readFully(buffer); - + // Now let the records get their hands on them for (int i = 0; i < _numberOfNameRecords; i++) { _records[i].loadString( @@ -98,7 +98,7 @@ public class NameTable implements Table { return _numberOfNameRecords; } - + public NameRecord getRecord(int i) { if(_numberOfNameRecords > i) { return _records[i]; @@ -133,7 +133,7 @@ public class NameTable implements Table { public int getType() { return name; } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -143,5 +143,5 @@ public class NameTable implements Table { public DirectoryEntry getDirectoryEntry() { return _de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java index f4fa76e81..9dfbceb99 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java @@ -134,7 +134,7 @@ public class Os2Table implements Table { _usWinDescent = di.readUnsignedShort(); _ulCodePageRange1 = di.readInt(); _ulCodePageRange2 = di.readInt(); - + // OpenType 1.3 if (_version == 2) { _sxHeight = di.readShort(); @@ -276,19 +276,19 @@ public class Os2Table implements Table { public short getXHeight() { return _sxHeight; } - + public short getCapHeight() { return _sCapHeight; } - + public int getDefaultChar() { return _usDefaultChar; } - + public int getBreakChar() { return _usBreakChar; } - + public int getMaxContext() { return _usMaxContext; } @@ -335,7 +335,7 @@ public class Os2Table implements Table { .append("\n CodePage Range 2( Bits 32- 63 ): ").append(Integer.toHexString(_ulCodePageRange2).toUpperCase()) .toString(); } - + private String getVendorIDAsString() { return new StringBuilder() .append((char)((_achVendorID>>24)&0xff)) @@ -344,7 +344,7 @@ public class Os2Table implements Table { .append((char)((_achVendorID)&0xff)) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java index 6127140d1..1f6c5a1dd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -42,11 +42,11 @@ public class Panose { public byte getFamilyType() { return bFamilyType; } - + public byte getSerifStyle() { return bSerifStyle; } - + public byte getWeight() { return bWeight; } @@ -54,31 +54,31 @@ public class Panose { public byte getProportion() { return bProportion; } - + public byte getContrast() { return bContrast; } - + public byte getStrokeVariation() { return bStrokeVariation; } - + public byte getArmStyle() { return bArmStyle; } - + public byte getLetterForm() { return bLetterform; } - + public byte getMidline() { return bMidline; } - + public byte getXHeight() { return bXHeight; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(bFamilyType)).append(" ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java index f9dcf2ce7..6ed9b2b9c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -68,7 +68,7 @@ public class PcltTable implements Table { public int getType() { return PCLT; } - + public String toString() { return new StringBuilder() .append("'PCLT' Table - Printer Command Language Table\n---------------------------------------------") @@ -91,7 +91,7 @@ public class PcltTable implements Table { .append("\n reserved: ").append(reserved) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -101,5 +101,5 @@ public class PcltTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java index c913b4c71..46f1ac088 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -294,7 +294,7 @@ public class PostTable implements Table { private int maxMemType42; private int minMemType1; private int maxMemType1; - + // v2 private int numGlyphs; private int[] glyphNameIndex; @@ -312,7 +312,7 @@ public class PostTable implements Table { maxMemType42 = di.readInt(); minMemType1 = di.readInt(); maxMemType1 = di.readInt(); - + if (version == 0x00020000) { numGlyphs = di.readUnsignedShort(); glyphNameIndex = new int[numGlyphs]; @@ -366,7 +366,7 @@ public class PostTable implements Table { return false; } } - + /** Get the table type, as a table directory value. * @return The table type */ @@ -409,7 +409,7 @@ public class PostTable implements Table { } return sb.toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -419,5 +419,5 @@ public class PostTable implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java index aac10c539..2046d7fe4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -33,7 +33,7 @@ public class PrepTable extends Program implements Table { public String toString() { return Disassembler.disassemble(getInstructions(), 0); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a @@ -43,5 +43,5 @@ public class PrepTable extends Program implements Table { public DirectoryEntry getDirectoryEntry() { return de; } - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java index 28c148c2b..e3beabef8 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java index 72d703bb4..40ddf4215 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java @@ -75,7 +75,7 @@ public class RangeRecord { public boolean isInRange(int glyphId) { return (_start <= glyphId && glyphId <= _end); } - + public int getCoverageIndex(int glyphId) { if (isInRange(glyphId)) { return _startCoverageIndex + glyphId - _start; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java index eb534b5dd..04781a8f9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java @@ -65,14 +65,14 @@ public class Script { private LangSysRecord[] _langSysRecords; private LangSys _defaultLangSys; private LangSys[] _langSys; - + /** Creates new ScriptTable */ protected Script(DataInputStream dis, int offset) throws IOException { // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _defaultLangSysOffset = dis.readUnsignedShort(); _langSysCount = dis.readUnsignedShort(); @@ -102,7 +102,7 @@ public class Script { public int getLangSysCount() { return _langSysCount; } - + public LangSysRecord getLangSysRecord(int i) { return _langSysRecords[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java index 4af62b0ee..18589b712 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java @@ -63,14 +63,14 @@ public class ScriptList { private int _scriptCount = 0; private ScriptRecord[] _scriptRecords; private Script[] _scripts; - + /** Creates new ScriptList */ protected ScriptList(DataInputStream dis, int offset) throws IOException { - + // Ensure we're in the right place dis.reset(); dis.skipBytes(offset); - + // Start reading _scriptCount = dis.readUnsignedShort(); _scriptRecords = new ScriptRecord[_scriptCount]; @@ -86,15 +86,15 @@ public class ScriptList { public int getScriptCount() { return _scriptCount; } - + public ScriptRecord getScriptRecord(int i) { return _scriptRecords[i]; } - + public Script getScript(int i) { return _scripts[i]; } - + public Script findScript(String tag) { if (tag.length() != 4) { return null; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java index 5da0608dd..183ca2ffd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java @@ -62,7 +62,7 @@ public class ScriptRecord { private int _tag; private int _offset; - + /** Creates new ScriptRecord */ protected ScriptRecord(DataInput di) throws IOException { _tag = di.readInt(); @@ -72,7 +72,7 @@ public class ScriptRecord { public int getTag() { return _tag; } - + public int getOffset() { return _offset; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java index 5a5de119f..15f0cd04f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -22,7 +22,7 @@ public class SignatureBlock { private int reserved2; private int signatureLen; private byte[] signature; - + /** Creates new SignatureBlock */ protected SignatureBlock(DataInput di) throws IOException { reserved1 = di.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java index 8c56a740f..e31281f2e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java @@ -63,7 +63,7 @@ public abstract class SingleSubst extends LookupSubtable { public abstract int getFormat(); public abstract int substitute(int glyphId); - + public static SingleSubst read(DataInputStream dis, int offset) throws IOException { SingleSubst s = null; dis.reset(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java index 99b85f35c..a8df78504 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java @@ -84,7 +84,7 @@ public class SingleSubstFormat1 extends SingleSubst { } return glyphId; } - + public String getTypeAsString() { return "SingleSubstFormat1"; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java index cd3b6d147..2e47b2924 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java @@ -92,6 +92,6 @@ public class SingleSubstFormat2 extends SingleSubst { public String getTypeAsString() { return "SingleSubstFormat2"; - } + } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java index b801517f8..f7c7d99b5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -17,7 +17,7 @@ import java.io.IOException; * @author <a href="mailto:[email protected]">David Schweinsberg</a> */ public class TTCHeader { - + public static final int ttcf = 0x74746366; private int ttcTag; @@ -47,7 +47,7 @@ public class TTCHeader { public int getDirectoryCount() { return directoryCount; } - + public int getTableDirectory(int i) { return tableDirectory[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java index 624f47bef..30fd2f457 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java @@ -1,9 +1,9 @@ /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * - * ------------------------------------------------------------------------- * - * This software is published under the terms of the Apache Software License * - * version 1.1, a copy of which has been included with this distribution in * - * the LICENSE file. * + * ------------------------------------------------------------------------- * + * This software is published under the terms of the Apache Software License * + * version 1.1, a copy of which has been included with this distribution in * + * the LICENSE file. * *****************************************************************************/ package jogamp.graph.font.typecast.ot.table; @@ -51,7 +51,7 @@ public interface Table { public static final int vmtx = 0x766d7478; // Vertical Metrics public static final String notAvailable = "n/a"; - + /** * Get the table type, as a table directory value. * @return The table type @@ -65,5 +65,5 @@ public interface Table { * @return A directory entry */ public DirectoryEntry getDirectoryEntry(); - + } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java index bacc26d30..8c5678088 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java @@ -112,7 +112,7 @@ public class TableDirectory { public int getVersion() { return _version; } - + public String toString() { StringBuilder sb = new StringBuilder() .append("Offset Table\n------ -----") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java index 7749ea856..65aa84bff 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java @@ -26,7 +26,7 @@ package jogamp.graph.font.typecast.ot.table; * @version $Id: TableException.java,v 1.1.1.1 2004-12-05 23:15:00 davidsch Exp $ */ public class TableException extends java.lang.Exception { - + private static final long serialVersionUID = 1L; /** @@ -34,8 +34,8 @@ public class TableException extends java.lang.Exception { */ public TableException() { } - - + + /** * Constructs an instance of <code>TableException</code> with the specified detail message. * @param msg the detail message. diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java index 998ce08e3..956d1aecd 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java @@ -47,7 +47,7 @@ Apache Software Foundation, please see <http://www.apache.org/>. */ - + package jogamp.graph.font.typecast.ot.table; import java.io.DataInputStream; @@ -56,7 +56,7 @@ import java.io.IOException; import jogamp.graph.font.typecast.ot.OTFont; import jogamp.graph.font.typecast.ot.OTFontCollection; -/** +/** * * @version $Id: TableFactory.java,v 1.7 2007-02-05 12:39:51 davidsch Exp $ * @author <a href="mailto:[email protected]">David Schweinsberg</a> @@ -69,7 +69,7 @@ public class TableFactory { DirectoryEntry de, DataInputStream dis) throws IOException { Table t = null; - + // First, if we have a font collection, look for the table there if (fc != null) { t = fc.getTable(de); @@ -77,7 +77,7 @@ public class TableFactory { return t; } } - + // Create the table switch (de.getTag()) { case Table.BASE: @@ -175,7 +175,7 @@ public class TableFactory { t = new VmtxTable(de, dis, font.getVheaTable(), font.getMaxpTable()); break; } - + // If we have a font collection, add this table to it if ((fc != null) && (t != null)) { fc.addTable(t); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java index 80579f5cd..28f9aa6e3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java @@ -31,12 +31,12 @@ import java.io.IOException; public class VdmxTable implements Table { private class Ratio { - + private byte _bCharSet; private byte _xRatio; private byte _yStartRatio; private byte _yEndRatio; - + protected Ratio(DataInput di) throws IOException { _bCharSet = di.readByte(); _xRatio = di.readByte(); @@ -47,26 +47,26 @@ public class VdmxTable implements Table { public byte getBCharSet() { return _bCharSet; } - + public byte getXRatio() { return _xRatio; } - + public byte getYStartRatio() { return _yStartRatio; } - + public byte getYEndRatio() { return _yEndRatio; } } - + private class VTableRecord { - + private int _yPelHeight; private short _yMax; private short _yMin; - + protected VTableRecord(DataInput di) throws IOException { _yPelHeight = di.readUnsignedShort(); _yMax = di.readShort(); @@ -76,23 +76,23 @@ public class VdmxTable implements Table { public int getYPelHeight() { return _yPelHeight; } - + public short getYMax() { return _yMax; } - + public short getYMin() { return _yMin; } } - + private class Group { - + private int _recs; private int _startsz; private int _endsz; private VTableRecord[] _entry; - + protected Group(DataInput di) throws IOException { _recs = di.readUnsignedShort(); _startsz = di.readUnsignedByte(); @@ -106,20 +106,20 @@ public class VdmxTable implements Table { public int getRecs() { return _recs; } - + public int getStartSZ() { return _startsz; } - + public int getEndSZ() { return _endsz; } - + public VTableRecord[] getEntry() { return _entry; } } - + private DirectoryEntry _de; private int _version; private int _numRecs; @@ -127,7 +127,7 @@ public class VdmxTable implements Table { private Ratio[] _ratRange; private int _offset[]; private Group[] _groups; - + /** Creates a new instance of VdmxTable */ protected VdmxTable(DirectoryEntry de, DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); @@ -147,11 +147,11 @@ public class VdmxTable implements Table { _groups[i] = new Group(di); } } - + public int getType() { return VDMX; } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java index 19c91765b..f42da119b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java @@ -135,7 +135,7 @@ public class VheaTable implements Table { .append("\n numOf_LongVerMetrics: ").append(_numberOfLongVerMetrics) .toString(); } - + /** * Get a directory entry for this table. This uniquely identifies the * table in collections where there may be more than one instance of a diff --git a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java index 887f8c34f..181ec7e10 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java @@ -34,23 +34,23 @@ import jogamp.graph.font.typecast.ot.table.CharstringType2; * @version $Id: T2Interpreter.java,v 1.2 2007-07-26 11:10:18 davidsch Exp $ */ public class T2Interpreter { - + private static final int ARGUMENT_STACK_LIMIT = 48; private static final int SUBR_STACK_LIMIT = 10; private static final int TRANSIENT_ARRAY_ELEMENT_COUNT = 32; - + private Number[] _argStack = new Number[ARGUMENT_STACK_LIMIT]; private int _argStackIndex = 0; private int[] _subrStack = new int[SUBR_STACK_LIMIT]; private int _subrStackIndex = 0; private Number[] _transientArray = new Number[TRANSIENT_ARRAY_ELEMENT_COUNT]; - + private ArrayList<Point> _points; /** Creates a new instance of T2Interpreter */ public T2Interpreter() { } - + /** * Moves the current point to a position at the relative coordinates * (dx1, dy1). @@ -72,7 +72,7 @@ public class T2Interpreter { Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y); } - + /** * Moves the current point dy1 units in the vertical direction. */ @@ -82,7 +82,7 @@ public class T2Interpreter { Point lastPoint = getLastPoint(); moveTo(lastPoint.x, lastPoint.y + dy1); } - + /** * Appends a line from the current point to a position at the * relative coordinates dxa, dya. Additional rlineto operations are @@ -103,7 +103,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a horizontal line of length dx1 to the current point. * With an odd number of arguments, subsequent argument pairs @@ -130,7 +130,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a vertical line of length dy1 to the current point. With * an odd number of arguments, subsequent argument pairs are @@ -157,7 +157,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends a Bezier curve, defined by dxa...dyc, to the current * point. For each subsequent set of six arguments, an additional @@ -194,7 +194,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more Bezier curves, as described by the * dxa...dxc set of arguments, to the current point. For each curve, @@ -230,7 +230,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more Bezier curves to the current point. The * tangent for the first Bezier must be horizontal, and the second @@ -327,13 +327,13 @@ public class T2Interpreter { int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); - + // What on earth do we do with dx1, dx2, dy2 and dy3? } } clearArg(); } - + /** * Is equivalent to one rrcurveto for each set of six arguments * dxa...dyc, followed by exactly one rlineto using the dxd, dyd @@ -373,7 +373,7 @@ public class T2Interpreter { lineTo(xc + dxd, yc + dyd); clearArg(); } - + /** * Is equivalent to one rlineto for each pair of arguments beyond * the six arguments dxb...dyd needed for the one rrcurveto @@ -411,7 +411,7 @@ public class T2Interpreter { curveTo(xb, yb, xc, yc, xd, yd); clearArg(); } - + /** * Appends one or more Bezier curves to the current point, where * the first tangent is vertical and the second tangent is horizontal. @@ -465,7 +465,7 @@ public class T2Interpreter { } clearArg(); } - + /** * Appends one or more curves to the current point. If the argument * count is a multiple of four, the curve starts and ends vertical. If @@ -473,10 +473,10 @@ public class T2Interpreter { * vertical tangent. */ private void _vvcurveto() { - + clearArg(); } - + /** * Causes two Bezier curves, as described by the arguments (as * shown in Figure 2 below), to be rendered as a straight line when @@ -485,10 +485,10 @@ public class T2Interpreter { * pixels. */ private void _flex() { - + clearArg(); } - + /** * Causes the two curves described by the arguments dx1...dx6 to * be rendered as a straight line when the flex depth is less than @@ -496,10 +496,10 @@ public class T2Interpreter { * flex depth is greater than or equal to 0.5 device pixels. */ private void _hflex() { - + clearArg(); } - + /** * Causes the two curves described by the arguments to be * rendered as a straight line when the flex depth is less than 0.5 @@ -507,10 +507,10 @@ public class T2Interpreter { * than or equal to 0.5 device pixels. */ private void _hflex1() { - + clearArg(); } - + /** * Causes the two curves described by the arguments to be * rendered as a straight line when the flex depth is less than 0.5 @@ -518,10 +518,10 @@ public class T2Interpreter { * than or equal to 0.5 device pixels. */ private void _flex1() { - + clearArg(); } - + /** * Finishes a charstring outline definition, and must be the * last operator in a character's outline. @@ -530,37 +530,37 @@ public class T2Interpreter { endContour(); clearArg(); } - + private void _hstem() { - + clearArg(); } - + private void _vstem() { - + clearArg(); } - + private void _hstemhm() { - + clearArg(); } - + private void _vstemhm() { - + clearArg(); } - + private void _hintmask() { - + clearArg(); } - + private void _cntrmask() { - + clearArg(); } - + /** * Returns the absolute value of num. */ @@ -568,7 +568,7 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(Math.abs(num)); } - + /** * Returns the sum of the two numbers num1 and num2. */ @@ -577,7 +577,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 + num2); } - + /** * Returns the result of subtracting num2 from num1. */ @@ -586,7 +586,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 - num2); } - + /** * Returns the quotient of num1 divided by num2. The result is * undefined if overflow occurs and is zero for underflow. @@ -596,7 +596,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 / num2); } - + /** * Returns the negative of num. */ @@ -604,7 +604,7 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(-num); } - + /** * Returns a pseudo random number num2 in the range (0,1], that * is, greater than zero and less than or equal to one. @@ -612,7 +612,7 @@ public class T2Interpreter { private void _random() { pushArg(1.0 - Math.random()); } - + /** * Returns the product of num1 and num2. If overflow occurs, the * result is undefined, and zero is returned for underflow. @@ -622,7 +622,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 * num2); } - + /** * Returns the square root of num. If num is negative, the result is * undefined. @@ -631,14 +631,14 @@ public class T2Interpreter { double num = popArg().doubleValue(); pushArg(Math.sqrt(num)); } - + /** * Removes the top element num from the Type 2 argument stack. */ private void _drop() { popArg(); } - + /** * Exchanges the top two elements on the argument stack. */ @@ -648,7 +648,7 @@ public class T2Interpreter { pushArg(num2); pushArg(num1); } - + /** * Retrieves the element i from the top of the argument stack and * pushes a copy of that element onto that stack. If i is negative, @@ -666,7 +666,7 @@ public class T2Interpreter { } pushArg(nums[i]); } - + /** * Performs a circular shift of the elements num(Nx1) ... num0 on * the argument stack by the amount J. Positive J indicates upward @@ -685,7 +685,7 @@ public class T2Interpreter { pushArg(nums[(n + i + j) % n]); } } - + /** * Duplicates the top element on the argument stack. */ @@ -694,7 +694,7 @@ public class T2Interpreter { pushArg(any); pushArg(any); } - + /** * Stores val into the transient array at the location given by i. */ @@ -703,7 +703,7 @@ public class T2Interpreter { Number val = popArg(); _transientArray[i] = val; } - + /** * Retrieves the value stored in the transient array at the location * given by i and pushes the value onto the argument stack. If get @@ -714,7 +714,7 @@ public class T2Interpreter { int i = popArg().intValue(); pushArg(_transientArray[i]); } - + /** * Puts a 1 on the stack if num1 and num2 are both non-zero, and * puts a 0 on the stack if either argument is zero. @@ -724,7 +724,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) && (num2!=0.0) ? 1 : 0); } - + /** * Puts a 1 on the stack if either num1 or num2 are non-zero, and * puts a 0 on the stack if both arguments are zero. @@ -734,7 +734,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) || (num2!=0.0) ? 1 : 0); } - + /** * Returns a 0 if num1 is non-zero; returns a 1 if num1 is zero. */ @@ -742,7 +742,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg((num1!=0.0) ? 0 : 1); } - + /** * Puts a 1 on the stack if num1 equals num2, otherwise a 0 (zero) * is put on the stack. @@ -752,7 +752,7 @@ public class T2Interpreter { double num1 = popArg().doubleValue(); pushArg(num1 == num2 ? 1 : 0); } - + /** * Leaves the value s1 on the stack if v1 ? v2, or leaves s2 on the * stack if v1 > v2. The value of s1 and s2 is usually the biased @@ -765,7 +765,7 @@ public class T2Interpreter { Number s1 = popArg(); pushArg(v1 <= v2 ? s1 : s2); } - + /** * Calls a charstring subroutine with index subr# (actually the subr * number plus the subroutine bias number, as described in section @@ -777,25 +777,25 @@ public class T2Interpreter { * Calling an undefined subr (gsubr) has undefined results. */ private void _callsubr() { - + } - + /** * Operates in the same manner as callsubr except that it calls a * global subroutine. */ private void _callgsubr() { - + } - + /** * Returns from either a local or global charstring subroutine, and * continues execution after the corresponding call(g)subr. */ private void _return() { - + } - + public Point[] execute(CharstringType2 cs) { _points = new ArrayList<Point>(); cs.resetIP(); @@ -975,7 +975,7 @@ public class T2Interpreter { private int getArgCount() { return _argStackIndex; } - + /** * Pop a value off the argument stack */ @@ -989,7 +989,7 @@ public class T2Interpreter { private void pushArg(Number n) { _argStack[_argStackIndex++] = n; } - + /** * Pop a value off the subroutine stack */ @@ -1003,14 +1003,14 @@ public class T2Interpreter { private void pushSubr(int n) { _subrStack[_subrStackIndex++] = n; } - + /** * Clear the argument stack */ private void clearArg() { _argStackIndex = 0; } - + private Point getLastPoint() { int size = _points.size(); if (size > 0) { @@ -1019,22 +1019,22 @@ public class T2Interpreter { return new Point(0, 0, true, false); } } - + private void moveTo(int x, int y) { endContour(); _points.add(new Point(x, y, true, false)); } - + private void lineTo(int x, int y) { _points.add(new Point(x, y, true, false)); } - + private void curveTo(int cx1, int cy1, int cx2, int cy2, int x, int y) { _points.add(new Point(cx1, cy1, false, false)); _points.add(new Point(cx2, cy2, false, false)); _points.add(new Point(x, y, true, false)); } - + private void endContour() { Point lastPoint = getLastPoint(); if (lastPoint != null) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java index a659a7003..2bb5cec0c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java @@ -570,7 +570,7 @@ public class Interpreter { private void _mps() { push(0); } - + private void _msirp(short param) { pop(); pop(); @@ -1190,7 +1190,7 @@ public class Interpreter { while (ip < ((ip & 0xffff0000) | parser.getISLength(ip >> 16))) { short opcode = parser.getOpcode(ip); if (inFuncDef) { - + // We're within a function definition, so don't execute the code if (opcode == Mnemonic.ENDF) { inFuncDef = false; diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java index 0fd174cda..32e2b6a39 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java @@ -33,7 +33,7 @@ public class AffineTransform implements Cloneable, Serializable { private static final long serialVersionUID = 1330973210523860834L; static final String determinantIsZero = "Determinant is zero"; - + public static final int TYPE_IDENTITY = 0; public static final int TYPE_TRANSLATION = 1; public static final int TYPE_UNIFORM_SCALE = 2; @@ -49,14 +49,14 @@ public class AffineTransform implements Cloneable, Serializable { * The <code>TYPE_UNKNOWN</code> is an initial type value */ static final int TYPE_UNKNOWN = -1; - + /** - * The min value equivalent to zero. If absolute value less then ZERO it considered as zero. + * The min value equivalent to zero. If absolute value less then ZERO it considered as zero. */ static final float ZERO = (float) 1E-10; - + private final Vertex.Factory<? extends Vertex> pointFactory; - + /** * The values of transformation matrix */ @@ -68,7 +68,7 @@ public class AffineTransform implements Cloneable, Serializable { float m12; /** - * The transformation <code>type</code> + * The transformation <code>type</code> */ transient int type; @@ -123,20 +123,20 @@ public class AffineTransform implements Cloneable, Serializable { /* * Method returns type of affine transformation. - * + * * Transform matrix is * m00 m01 m02 * m10 m11 m12 - * - * According analytic geometry new basis vectors are (m00, m01) and (m10, m11), - * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1). - * Type transformations classification: + * + * According analytic geometry new basis vectors are (m00, m01) and (m10, m11), + * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1). + * Type transformations classification: * TYPE_IDENTITY - new basis equals original one and zero translation - * TYPE_TRANSLATION - translation vector isn't zero + * TYPE_TRANSLATION - translation vector isn't zero * TYPE_UNIFORM_SCALE - vectors length of new basis equals - * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal + * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal * TYPE_FLIP - new basis vector orientation differ from original one - * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees + * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees * TYPE_GENERAL_ROTATION - new basis is rotated by arbitrary angle * TYPE_GENERAL_TRANSFORM - transformation can't be inversed */ @@ -322,7 +322,7 @@ public class AffineTransform implements Cloneable, Serializable { } public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) { - AffineTransform t = new AffineTransform(factory); + AffineTransform t = new AffineTransform(factory); t.setToShear(shx, shy); return t; } @@ -359,13 +359,13 @@ public class AffineTransform implements Cloneable, Serializable { concatenate(AffineTransform.getRotateInstance(pointFactory, angle, px, py)); } - /** + /** * Multiply matrix of two AffineTransform objects. * The first argument's {@link Vertex.Factory} is being used. - * + * * @param t1 - the AffineTransform object is a multiplicand * @param t2 - the AffineTransform object is a multiplier - * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. + * @return an AffineTransform object that is a result of t1 multiplied by matrix t2. */ AffineTransform multiply(AffineTransform t1, AffineTransform t2) { return new AffineTransform(t1.pointFactory, @@ -415,7 +415,7 @@ public class AffineTransform implements Cloneable, Serializable { public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) { while (--length >= 0) { - Vertex srcPoint = src[srcOff++]; + Vertex srcPoint = src[srcOff++]; float x = srcPoint.getX(); float y = srcPoint.getY(); Vertex dstPoint = dst[dstOff]; @@ -426,7 +426,7 @@ public class AffineTransform implements Cloneable, Serializable { dst[dstOff++] = dstPoint; } } - + public void transform(float[] src, int srcOff, float[] dst, int dstOff, int length) { int step = 2; if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) { @@ -443,7 +443,7 @@ public class AffineTransform implements Cloneable, Serializable { dstOff += step; } } - + public Vertex deltaTransform(Vertex src, Vertex dst) { if (dst == null) { dst = pointFactory.create(); @@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable { { float det = getDeterminant(); if (FloatUtil.abs(det) < ZERO) { - throw new NoninvertibleTransformException(determinantIsZero); + throw new NoninvertibleTransformException(determinantIsZero); } while (--length >= 0) { @@ -554,7 +554,7 @@ public class AffineTransform implements Cloneable, Serializable { return false; } - + /** * Write AffineTrasform object to the output steam. * @param stream - the output stream @@ -564,12 +564,12 @@ public class AffineTransform implements Cloneable, Serializable { stream.defaultWriteObject(); } - + /** * Read AffineTransform object from the input stream * @param stream - the input steam * @throws IOException - if there are I/O errors while reading from the input strem - * @throws ClassNotFoundException - if class could not be found + * @throws ClassNotFoundException - if class could not be found */ private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java index cd4ee2a91..4ee0c250d 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java @@ -29,17 +29,17 @@ public class Crossing { * Allowable tolerance for bounds comparison */ static final float DELTA = (float) 1E-5; - + /** * If roots have distance less then <code>ROOT_DELTA</code> they are double */ static final float ROOT_DELTA = (float) 1E-10; - + /** * Rectangle cross segment */ public static final int CROSSING = 255; - + /** * Unknown crossing result */ @@ -130,8 +130,8 @@ public class Crossing { } /** - * Excludes float roots. Roots are float if they lies enough close with each other. - * @param res - the roots + * Excludes float roots. Roots are float if they lies enough close with each other. + * @param res - the roots * @param rc - the roots count * @return new roots count */ @@ -384,12 +384,12 @@ public class Crossing { // START if (x == x1) { - return x1 < x2 ? 0 : -1; + return x1 < x2 ? 0 : -1; } - + // END if (x == x2) { - return x1 < x2 ? 1 : 0; + return x1 < x2 ? 1 : 0; } // INSIDE-DOWN @@ -493,10 +493,10 @@ public class Crossing { } break; default: - throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); + throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); } - - // checks if the point (x,y) is the vertex of shape with PathIterator p + + // checks if the point (x,y) is the vertex of shape with PathIterator p if (x == cx && y == cy) { cross = 0; cy = my; @@ -554,9 +554,9 @@ public class Crossing { } } } - + /** - * Returns are bounds intersect or not intersect rectangle + * Returns are bounds intersect or not intersect rectangle */ static int crossBound(float bound[], int bc, float py1, float py2) { diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java index 945eeceeb..c1ee17a4b 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java @@ -33,12 +33,12 @@ public final class Path2D implements Cloneable { static final String invalidWindingRuleValue = "Invalid winding rule value"; static final String iteratorOutOfBounds = "Iterator out of bounds"; - + /** * The buffers size */ private static final int BUFFER_SIZE = 10; - + /** * The buffers capacity */ @@ -48,24 +48,24 @@ public final class Path2D implements Cloneable { * The point's types buffer */ byte[] types; - + /** * The points buffer */ float[] points; - + /** * The point's type buffer size */ int typeSize; - + /** * The points buffer size */ int pointSize; - + /** - * The path rule + * The path rule */ int rule; @@ -80,7 +80,7 @@ public final class Path2D implements Cloneable { 0}; // CLOSE /* - * GeneralPath path iterator + * GeneralPath path iterator */ class Iterator implements PathIterator { @@ -88,17 +88,17 @@ public final class Path2D implements Cloneable { * The current cursor position in types buffer */ int typeIndex; - + /** * The current cursor position in points buffer */ int pointIndex; - + /** * The source GeneralPath object */ Path2D p; - + /** * The path iterator transformation */ @@ -183,7 +183,7 @@ public final class Path2D implements Cloneable { } /** - * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. + * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. * @param pointCount - the point count to be added in buffer */ void checkBuf(int pointCount, boolean checkMove) { @@ -244,18 +244,18 @@ public final class Path2D implements Cloneable { final public int size() { return typeSize; } - + final public boolean isClosed() { return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ; } - + public void closePath() { if (!isClosed()) { checkBuf(0, true); types[typeSize++] = PathIterator.SEG_CLOSE; } } - + public String toString() { return "[size "+size()+", closed "+isClosed()+"]"; } @@ -295,7 +295,7 @@ public final class Path2D implements Cloneable { closePath(); break; default: - throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); + throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType); } path.next(); connect = false; @@ -366,9 +366,9 @@ public final class Path2D implements Cloneable { } /** - * Checks cross count according to path rule to define is it point inside shape or not. + * Checks cross count according to path rule to define is it point inside shape or not. * @param cross - the point cross count - * @return true if point is inside path, or false otherwise + * @return true if point is inside path, or false otherwise */ boolean isInside(int cross) { if (rule == WIND_NON_ZERO) { @@ -396,7 +396,7 @@ public final class Path2D implements Cloneable { } public boolean contains(AABBox r) { - return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); + return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } public boolean intersects(AABBox r) { @@ -404,9 +404,9 @@ public final class Path2D implements Cloneable { } public PathIterator iterator() { - return new Iterator(this); + return new Iterator(this); } - + public PathIterator iterator(AffineTransform t) { return new Iterator(this, t); } 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) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java index 22c95f3dd..c98bf5436 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java @@ -29,11 +29,11 @@ public class DelegatedUpstreamSurfaceHookMutableSize extends UpstreamSurfaceHook upstream.destroy(s); } } - + @Override public String toString() { - return getClass().getSimpleName()+"[ "+ width + "x" + height + ", " + upstream + "]"; + return getClass().getSimpleName()+"[ "+ width + "x" + height + ", " + upstream + "]"; } - + } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java index 85e24582c..1557f4e51 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java @@ -42,13 +42,13 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf @Override public final int getHeight(ProxySurface s) { return surface.getHeight(); - } - + } + @Override public String toString() { - final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getWidth() + "x" + surface.getHeight() ) : "nil"; + final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getWidth() + "x" + surface.getHeight() ) : "nil"; return getClass().getSimpleName()+"["+upstream+", "+us_s+"]"; } - + } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java index eaad513aa..8b8ccb191 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java @@ -41,10 +41,10 @@ public class MutableGraphicsConfiguration extends DefaultGraphicsConfiguration { public void setChosenCapabilities(CapabilitiesImmutable caps) { super.setChosenCapabilities(caps); } - + @Override public void setScreen(AbstractGraphicsScreen screen) { super.setScreen(screen); } - + } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java index 29f4964c0..a8dd9165c 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.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 com.jogamp.nativewindow; import com.jogamp.common.GlueGenVersion; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java index 29c540ac4..5838c7a56 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java @@ -18,9 +18,9 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab @Override public final void setSize(int width, int height) { this.width = width; - this.height = height; + this.height = height; } - + @Override public final int getWidth(ProxySurface s) { return width; @@ -35,11 +35,11 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab @Override public void destroy(ProxySurface s) { /* nop */ } - + @Override public String toString() { - return getClass().getSimpleName()+"[ "+ width + "x" + height + "]"; + return getClass().getSimpleName()+"[ "+ width + "x" + height + "]"; } - + } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java index 7e3d30a47..15f3355d0 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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 AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple private GraphicsConfiguration config; AbstractGraphicsConfiguration encapsulated; - public AWTGraphicsConfiguration(AWTGraphicsScreen screen, + public AWTGraphicsConfiguration(AWTGraphicsScreen screen, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, GraphicsConfiguration config, AbstractGraphicsConfiguration encapsulated) { super(screen, capsChosen, capsRequested); @@ -71,9 +71,9 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple this.config = config; this.encapsulated=null; } - + /** - * @param capsChosen if null, <code>capsRequested</code> is copied and aligned + * @param capsChosen if null, <code>capsRequested</code> is copied and aligned * with the graphics {@link Capabilities} of the AWT Component to produce the chosen {@link Capabilities}. * Otherwise the <code>capsChosen</code> is used. * @param capsRequested if null, default {@link Capabilities} are used, otherwise the given values. @@ -81,7 +81,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple public static AWTGraphicsConfiguration create(Component awtComp, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { final GraphicsConfiguration awtGfxConfig = awtComp.getGraphicsConfiguration(); if(null==awtGfxConfig) { - throw new NativeWindowException("AWTGraphicsConfiguration.create: Null AWT GraphicsConfiguration @ "+awtComp); + throw new NativeWindowException("AWTGraphicsConfiguration.create: Null AWT GraphicsConfiguration @ "+awtComp); } final GraphicsDevice awtGraphicsDevice = awtGfxConfig.getDevice(); if(null==awtGraphicsDevice) { @@ -112,7 +112,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple public void setChosenCapabilities(CapabilitiesImmutable capsChosen) { super.setChosenCapabilities(capsChosen); } - + @Override public Object clone() { return super.clone(); @@ -171,7 +171,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple public String toString() { return getClass().getSimpleName()+"[" + getScreen() + ",\n\tchosen " + capabilitiesChosen+ - ",\n\trequested " + capabilitiesRequested+ + ",\n\trequested " + capabilitiesRequested+ ",\n\t" + config + ",\n\tencapsulated "+encapsulated+"]"; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java index 635e6d263..a7fa53577 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. */ diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java index f4ee06e28..d3cf5bff6 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. */ diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java index e5290aee1..44163fc73 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.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. @@ -69,15 +69,15 @@ import jogamp.nativewindow.awt.AWTMisc; } finally { ctx.releasePrint(); } - * + * * </pre> * </p> */ public interface AWTPrintLifecycle { public static final int DEFAULT_PRINT_TILE_SIZE = 1024; - - + + /** * Shall be called before {@link PrinterJob#print()}. * <p> @@ -85,12 +85,12 @@ public interface AWTPrintLifecycle { * </p> * @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 multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link com.jogamp.opengl.util.TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link com.jogamp.opengl.util.TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. */ void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight); - + /** * Shall be called after {@link PrinterJob#print()}. * <p> @@ -111,11 +111,11 @@ public interface AWTPrintLifecycle { * <p> * See <a href="#usage">Usage</a>. * </p> - * + * * @param c container to be traversed through to perform {@link AWTPrintLifecycle#setupPrint(double, double, int, int, int) setupPrint(..)} on all {@link AWTPrintLifecycle} elements. * @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 multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples 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. * @return the context @@ -139,7 +139,7 @@ public interface AWTPrintLifecycle { * @return count of performed actions of last {@link #setupPrint(Container, double, double, int, int, int) setupPrint(..)} or {@link #releasePrint()}. */ public int getCount() { return count; } - + private final Container cont; private final double scaleMatX; private final double scaleMatY; @@ -147,7 +147,7 @@ public interface AWTPrintLifecycle { private final int tileWidth; private final int tileHeight; private int count; - + private final AWTMisc.ComponentAction setupAction = new AWTMisc.ComponentAction() { @Override public void run(Component c) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java index e499ff705..e350aaff4 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java @@ -78,7 +78,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol { /** * Adds this closing listener to the components Window if exist and only one time. * <p> - * If the closing listener is already added, and {@link IllegalStateException} is thrown. + * If the closing listener is already added, and {@link IllegalStateException} is thrown. * </p> * * @return true if added, otherwise false. diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java index 7a7a771d6..e4d3884a7 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.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,29 +45,29 @@ import com.jogamp.common.nio.Buffers; * {@link DataBuffer} specialization using NIO direct buffer of type {@link DataBuffer#TYPE_INT} as storage. */ public final class DirectDataBufferInt extends DataBuffer { - + public static class DirectWritableRaster extends WritableRaster { protected DirectWritableRaster(SampleModel sampleModel, DirectDataBufferInt dataBuffer, Point origin) { super(sampleModel, dataBuffer, origin); } } - + public static class BufferedImageInt extends BufferedImage { final int customImageType; public BufferedImageInt (int customImageType, ColorModel cm, WritableRaster raster, Hashtable<?,?> properties) { super(cm, raster, false /* isRasterPremultiplied */, properties); - this.customImageType = customImageType; + this.customImageType = customImageType; } - + /** - * @return one of the custom image-type values {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}, - * {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE}, + * @return one of the custom image-type values {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}, + * {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE}, * {@link BufferedImage#TYPE_INT_RGB TYPE_INT_RGB} or {@link BufferedImage#TYPE_INT_BGR TYPE_INT_BGR}. */ public int getCustomType() { return customImageType; } - + @Override public String toString() { return new String("BufferedImageInt@"+Integer.toHexString(hashCode()) @@ -75,26 +75,26 @@ public final class DirectDataBufferInt extends DataBuffer { +" "+getColorModel()+" "+getRaster()); } } - + /** - * Creates a {@link BufferedImageInt} using a {@link DirectColorModel direct color model} in {@link ColorSpace#CS_sRGB sRGB color space}.<br> + * Creates a {@link BufferedImageInt} using a {@link DirectColorModel direct color model} in {@link ColorSpace#CS_sRGB sRGB color space}.<br> * It uses a {@link DirectWritableRaster} utilizing {@link DirectDataBufferInt} storage. * <p> - * Note that due to using the custom storage type {@link DirectDataBufferInt}, the resulting + * Note that due to using the custom storage type {@link DirectDataBufferInt}, the resulting * {@link BufferedImage}'s {@link BufferedImage#getType() image-type} is of {@link BufferedImage#TYPE_CUSTOM TYPE_CUSTOM}. * We are not able to change this detail, since the AWT image implementation associates the {@link BufferedImage#getType() image-type} * with a build-in storage-type. * Use {@link BufferedImageInt#getCustomType()} to retrieve the custom image-type, which will return the <code>imageType</code> - * value passed here. + * value passed here. * </p> - * + * * @param width * @param height - * @param imageType one of {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}, {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE}, + * @param imageType one of {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}, {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE}, * {@link BufferedImage#TYPE_INT_RGB TYPE_INT_RGB} or {@link BufferedImage#TYPE_INT_BGR TYPE_INT_BGR}. * @param location origin, if <code>null</code> 0/0 is assumed. * @param properties <code>Hashtable</code> of - * <code>String</code>/<code>Object</code> pairs. Used for {@link BufferedImage#getProperty(String)} etc. + * <code>String</code>/<code>Object</code> pairs. Used for {@link BufferedImage#getProperty(String)} etc. * @return */ public static BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties) { @@ -150,30 +150,30 @@ public final class DirectDataBufferInt extends DataBuffer { bandMasks[0] = rmask; bandMasks[1] = gmask; bandMasks[2] = bmask; - + final DirectDataBufferInt dataBuffer = new DirectDataBufferInt(width*height); if( null == location ) { location = new Point(0,0); } - final SinglePixelPackedSampleModel sppsm = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), + final SinglePixelPackedSampleModel sppsm = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), width, height, width /* scanLineStride */, bandMasks); // IntegerComponentRasters must haveinteger DataBuffers: // final WritableRaster raster = new IntegerInterleavedRaster(sppsm, dataBuffer, location); // Not public: // final WritableRaster raster = new SunWritableRaster(sppsm, dataBuffer, location); final WritableRaster raster = new DirectWritableRaster(sppsm, dataBuffer, location); - + return new BufferedImageInt(imageType, colorModel, raster, properties); } - + /** Default data bank. */ private IntBuffer data; /** All data banks */ private IntBuffer bankdata[]; - + /** - * Constructs an nio integer-based {@link DataBuffer} with a single bank + * Constructs an nio integer-based {@link DataBuffer} with a single bank * and the specified size. * * @param size The size of the {@link DataBuffer}. @@ -222,17 +222,17 @@ public final class DirectDataBufferInt extends DataBuffer { /** * Returns the default (first) int data array in {@link DataBuffer}. - * + * * @return The first integer data array. */ public IntBuffer getData() { return data; } - /** - * Returns the data array for the specified bank. - * - * @param bank The bank whose data array you want to get. + /** + * Returns the data array for the specified bank. + * + * @param bank The bank whose data array you want to get. * @return The data array for the specified bank. */ public IntBuffer getData(int bank) { @@ -241,7 +241,7 @@ public final class DirectDataBufferInt extends DataBuffer { /** * Returns the requested data array element from the first (default) bank. - * + * * @param i The data array element you want to get. * @return The requested data array element as an integer. * @see #setElem(int, int) @@ -253,7 +253,7 @@ public final class DirectDataBufferInt extends DataBuffer { /** * Returns the requested data array element from the specified bank. - * + * * @param bank The bank from which you want to get a data array element. * @param i The data array element you want to get. * @return The requested data array element as an integer. diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 38a46f214..49b2daeae 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -123,7 +123,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private boolean localVisibility = component.isVisible(); private boolean globalVisibility = localVisibility; private boolean visibilityPropagation = false; - + private String s(ComponentEvent e) { return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+ " ** COMP "+e.getComponent()+Platform.getNewline()+ @@ -164,7 +164,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public void componentHidden(ComponentEvent e) { + public void componentHidden(ComponentEvent e) { if(DEBUG) { System.err.println("JAWTWindow.componentHidden: "+s(e)); } @@ -174,7 +174,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, @Override public void hierarchyChanged(HierarchyEvent e) { final long bits = e.getChangeFlags(); - final java.awt.Component changed = e.getChanged(); + final java.awt.Component changed = e.getChanged(); if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) { final boolean displayable = changed.isDisplayable(); final boolean resetLocalVisibility = changed == component && !displayable && localVisibility != component.isVisible(); @@ -220,7 +220,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, if(DEBUG) { System.err.println("JAWTWindow.invalidate() - "+Thread.currentThread().getName()); if( isSurfaceLayerAttached() ) { - System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer)); + System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer)); } // Thread.dumpStack(); } @@ -237,14 +237,14 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected final boolean updateBounds(JAWT_Rectangle jawtBounds) { final Rectangle jb = new Rectangle(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); final boolean changed = !bounds.equals(jb); - + if(changed) { if(DEBUG) { System.err.println("JAWTWindow.updateBounds: "+bounds+" -> "+jb); // Thread.dumpStack(); } bounds.set(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); - + if(component instanceof Container) { final java.awt.Insets contInsets = ((Container)component).getInsets(); insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); @@ -279,7 +279,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // // OffscreenLayerOption // - + @Override public void setShallUseOffscreenLayer(boolean v) { shallUseOffscreenLayer = v; @@ -316,9 +316,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * Layout the offscreen layer according to the implementing class's constraints. * <p> * This method allows triggering a re-layout of the offscreen surface - * in case the implementation requires it. + * in case the implementation requires it. * </p> - * <p> + * <p> * Call this method if any parent or ancestor's layout has been changed, * which could affects the layout of this surface. * </p> @@ -326,14 +326,14 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false */ protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {} - + private final void layoutSurfaceLayerIfEnabled(boolean visible) throws NativeWindowException { if( isOffscreenLayerSurfaceEnabled() && 0 != offscreenSurfaceLayer ) { layoutSurfaceLayerImpl(offscreenSurfaceLayer, visible); } } - - + + @Override public final void detachSurfaceLayer() throws NativeWindowException { if( 0 == offscreenSurfaceLayer) { @@ -351,35 +351,35 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } }; - /** + /** * @param detachNotify Runnable to be called before native detachment */ protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify) { throw new UnsupportedOperationException("offscreen layer not supported"); } - + @Override public final long getAttachedSurfaceLayer() { return offscreenSurfaceLayer; } - + @Override public final boolean isSurfaceLayerAttached() { return 0 != offscreenSurfaceLayer; } - + @Override public final void setChosenCapabilities(CapabilitiesImmutable caps) { ((MutableGraphicsConfiguration)getGraphicsConfiguration()).setChosenCapabilities(caps); - getPrivateGraphicsConfiguration().setChosenCapabilities(caps); + getPrivateGraphicsConfiguration().setChosenCapabilities(caps); } - + @Override public final RecursiveLock getLock() { return surfaceLock; } - + // // SurfaceUpdateListener // @@ -527,7 +527,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, public final AbstractGraphicsConfiguration getGraphicsConfiguration() { return config.getNativeGraphicsConfiguration(); } - + @Override public final long getDisplayHandle() { return getGraphicsConfiguration().getScreen().getDevice().getHandle(); @@ -545,7 +545,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, @Override public final int getHeight() { - return component.getHeight(); + return component.getHeight(); } // @@ -647,10 +647,10 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected abstract Point getLocationOnScreenNativeImpl(int x, int y); protected static Component getLocationOnScreenNonBlocking(Point storage, Component comp) { - final java.awt.Insets insets = new java.awt.Insets(0, 0, 0, 0); // DEBUG + final java.awt.Insets insets = new java.awt.Insets(0, 0, 0, 0); // DEBUG Component last = null; while(null != comp) { - final int dx = comp.getX(); + final int dx = comp.getX(); final int dy = comp.getY(); if( DEBUG ) { final java.awt.Insets ins = AWTMisc.getInsets(comp, false); @@ -674,7 +674,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } return last; } - + @Override public boolean hasFocus() { return component.hasFocus(); @@ -693,7 +693,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } return sb; } - + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -715,7 +715,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return sb.toString(); } - + protected final String toHexString(long l) { return "0x"+Long.toHexString(l); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index fb6d39b2f..c83814907 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -45,7 +45,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * <p> * FIXME: This shall be removed when relocated EGL to the nativewindow package, * since then it can be utilized directly. - * </p> + * </p> */ public interface EGLDisplayLifecycleCallback { /** @@ -55,14 +55,14 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * @return the initialized EGL display ID, or <code>0</code> if not successful */ public long eglGetAndInitDisplay(long[] nativeDisplayID); - + /** * Implementation should issue an <code>EGL.eglTerminate(eglDisplayHandle)</code> call. * @param eglDisplayHandle */ void eglTerminate(long eglDisplayHandle); } - + /** * Note that this is not an open connection, ie no native display handle exist. * This constructor exist to setup a default device connection/unit.<br> @@ -78,9 +78,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl this.nativeDisplayID[0] = nativeDisplayID; this.eglLifecycleCallback = eglLifecycleCallback; } - + public long getNativeDisplayID() { return nativeDisplayID[0]; } - + @Override public Object clone() { return super.clone(); @@ -100,7 +100,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return false; } - + @Override public boolean close() { if(null != eglLifecycleCallback && 0 != handle) { @@ -111,11 +111,11 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return super.close(); } - + @Override public boolean isHandleOwner() { return null != eglLifecycleCallback; - } + } @Override public void clearHandleOwner() { eglLifecycleCallback = null; @@ -126,9 +126,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } @Override protected Object setHandleOwnership(Object newOwnership) { - final EGLDisplayLifecycleCallback oldOwnership = eglLifecycleCallback; + final EGLDisplayLifecycleCallback oldOwnership = eglLifecycleCallback; eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership; return oldOwnership; - } + } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java index 0dc788c17..89df7f853 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index 5c4fd82d2..6057f6700 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -54,28 +54,28 @@ import jogamp.nativewindow.x11.X11Lib; public class SWTAccessor { private static final boolean DEBUG = true; - + private static final Field swt_control_handle; private static final boolean swt_uses_long_handles; - - private static Object swt_osx_init = new Object(); + + private static Object swt_osx_init = new Object(); private static Field swt_osx_control_view = null; private static Field swt_osx_view_id = null; - + private static final String nwt; private static final boolean isOSX; private static final boolean isWindows; private static final boolean isX11; private static final boolean isX11GTK; - + // X11/GTK, Windows/GDI, .. private static final String str_handle = "handle"; - + // OSX/Cocoa private static final String str_osx_view = "view"; // OSX private static final String str_osx_id = "id"; // OSX // static final String str_NSView = "org.eclipse.swt.internal.cocoa.NSView"; - + private static final Method swt_control_internal_new_GC; private static final Method swt_control_internal_dispose_GC; private static final String str_internal_new_GC = "internal_new_GC"; @@ -85,18 +85,18 @@ public class SWTAccessor { public static final Class<?> OS_gtk_class; private static final String str_OS_gtk_version = "GTK_VERSION"; public static final VersionNumber OS_gtk_version; - + private static final Method OS_gtk_widget_realize; private static final Method OS_gtk_widget_unrealize; // optional (removed in SWT 4.3) private static final Method OS_GTK_WIDGET_WINDOW; private static final Method OS_gtk_widget_get_window; private static final Method OS_gdk_x11_drawable_get_xdisplay; private static final Method OS_gdk_x11_display_get_xdisplay; - private static final Method OS_gdk_window_get_display; - private static final Method OS_gdk_x11_drawable_get_xid; + private static final Method OS_gdk_window_get_display; + private static final Method OS_gdk_x11_drawable_get_xid; private static final Method OS_gdk_x11_window_get_xid; private static final Method OS_gdk_window_set_back_pixmap; - + private static final String str_gtk_widget_realize = "gtk_widget_realize"; private static final String str_gtk_widget_unrealize = "gtk_widget_unrealize"; private static final String str_GTK_WIDGET_WINDOW = "GTK_WIDGET_WINDOW"; @@ -107,11 +107,11 @@ public class SWTAccessor { private static final String str_gdk_x11_drawable_get_xid = "gdk_x11_drawable_get_xid"; private static final String str_gdk_x11_window_get_xid = "gdk_x11_window_get_xid"; private static final String str_gdk_window_set_back_pixmap = "gdk_window_set_back_pixmap"; - + private static final VersionNumber GTK_VERSION_2_14_0 = new VersionNumber(2, 14, 0); private static final VersionNumber GTK_VERSION_2_24_0 = new VersionNumber(2, 24, 0); private static final VersionNumber GTK_VERSION_3_0_0 = new VersionNumber(3, 0, 0); - + private static VersionNumber GTK_VERSION(int version) { // return (major << 16) + (minor << 8) + micro; final int micro = ( version ) & 0x0f; @@ -119,20 +119,20 @@ public class SWTAccessor { final int major = ( version >> 16 ) & 0x0f; return new VersionNumber(major, minor, micro); } - + static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { NativeWindowFactory.initSingleton(); // last resort .. return null; } } ); - + nwt = NativeWindowFactory.getNativeWindowType(false); isOSX = NativeWindowFactory.TYPE_MACOSX == nwt; isWindows = NativeWindowFactory.TYPE_WINDOWS == nwt; isX11 = NativeWindowFactory.TYPE_X11 == nwt; - - Field f = null; + + Field f = null; if( !isOSX ) { try { f = Control.class.getField(str_handle); @@ -141,7 +141,7 @@ public class SWTAccessor { } } swt_control_handle = f; // maybe null ! - + boolean ulh; if (null != swt_control_handle) { ulh = swt_control_handle.getGenericType().toString().equals(long.class.toString()); @@ -151,7 +151,7 @@ public class SWTAccessor { swt_uses_long_handles = ulh; // System.err.println("SWT long handles: " + swt_uses_long_handles); // System.err.println("Platform 64bit: "+Platform.is64Bit()); - + Method m=null; try { m = ReflectionUtil.getMethod(Control.class, str_internal_new_GC, new Class[] { GCData.class }); @@ -159,12 +159,12 @@ public class SWTAccessor { throw new NativeWindowException(ex); } swt_control_internal_new_GC = m; - + try { if(swt_uses_long_handles) { - m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { long.class, GCData.class }); + m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { long.class, GCData.class }); } else { - m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { int.class, GCData.class }); + m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { int.class, GCData.class }); } } catch (NoSuchMethodException ex) { throw new NativeWindowException(ex); @@ -181,7 +181,7 @@ public class SWTAccessor { c = ReflectionUtil.getClass(str_OS_gtk_class, false, SWTAccessor.class.getClassLoader()); Field field_OS_gtk_version = c.getField(str_OS_gtk_version); _gtk_version = GTK_VERSION(field_OS_gtk_version.getInt(null)); - m1 = c.getDeclaredMethod(str_gtk_widget_realize, handleType); + m1 = c.getDeclaredMethod(str_gtk_widget_realize, handleType); if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) { m4 = c.getDeclaredMethod(str_gtk_widget_get_window, handleType); } else { @@ -189,9 +189,9 @@ public class SWTAccessor { } if (_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) { m6 = c.getDeclaredMethod(str_gdk_x11_display_get_xdisplay, handleType); - m7 = c.getDeclaredMethod(str_gdk_window_get_display, handleType); + m7 = c.getDeclaredMethod(str_gdk_window_get_display, handleType); } else { - m5 = c.getDeclaredMethod(str_gdk_x11_drawable_get_xdisplay, handleType); + m5 = c.getDeclaredMethod(str_gdk_x11_drawable_get_xdisplay, handleType); } if (_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) { m9 = c.getDeclaredMethod(str_gdk_x11_window_get_xid, handleType); @@ -200,7 +200,7 @@ public class SWTAccessor { } ma = c.getDeclaredMethod(str_gdk_window_set_back_pixmap, handleType, handleType, boolean.class); } catch (Exception ex) { throw new NativeWindowException(ex); } - // optional + // optional try { m2 = c.getDeclaredMethod(str_gtk_widget_unrealize, handleType); } catch (Exception ex) { } @@ -213,33 +213,33 @@ public class SWTAccessor { OS_gtk_widget_get_window = m4; OS_gdk_x11_drawable_get_xdisplay = m5; OS_gdk_x11_display_get_xdisplay = m6; - OS_gdk_window_get_display = m7; + OS_gdk_window_get_display = m7; OS_gdk_x11_drawable_get_xid = m8; OS_gdk_x11_window_get_xid = m9; OS_gdk_window_set_back_pixmap = ma; - + isX11GTK = isX11 && null != OS_gtk_class; - + if(DEBUG) { System.err.println("SWTAccessor.<init>: GTK Version: "+OS_gtk_version); } } - + private static Number getIntOrLong(long arg) { if(swt_uses_long_handles) { return new Long(arg); } return new Integer((int) arg); } - - private static void callStaticMethodL2V(Method m, long arg) { + + private static void callStaticMethodL2V(Method m, long arg) { ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) }); } - - private static void callStaticMethodLLZ2V(Method m, long arg0, long arg1, boolean arg3) { + + private static void callStaticMethodLLZ2V(Method m, long arg0, long arg1, boolean arg3) { ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg0), getIntOrLong(arg1), Boolean.valueOf(arg3) }); } - + private static long callStaticMethodL2L(Method m, long arg) { Object o = ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) }); if(o instanceof Number) { @@ -252,18 +252,18 @@ public class SWTAccessor { // // Public properties // - + public static boolean isUsingLongHandles() { return swt_uses_long_handles; } public static boolean useX11GTK() { return isX11GTK; } public static VersionNumber GTK_VERSION() { return OS_gtk_version; } - + // // Common GTK // - + public static long gdk_widget_get_window(long handle) { final long window; if (OS_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) { @@ -276,7 +276,7 @@ public class SWTAccessor { } return window; } - + public static long gdk_window_get_xdisplay(long window) { final long xdisplay; if (OS_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) { @@ -293,7 +293,7 @@ public class SWTAccessor { } return xdisplay; } - + public static long gdk_window_get_xwindow(long window) { final long xWindow; if (OS_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) { @@ -306,15 +306,15 @@ public class SWTAccessor { } return xWindow; } - + public static void gdk_window_set_back_pixmap(long window, long pixmap, boolean parent_relative) { callStaticMethodLLZ2V(OS_gdk_window_set_back_pixmap, window, pixmap, parent_relative); } - + // // Common any toolkit // - + /** * @param swtControl the SWT Control to retrieve the native widget-handle from * @return the native widget-handle @@ -335,9 +335,9 @@ public class SWTAccessor { } } catch (Exception ex) { throw new NativeWindowException(ex); - } + } } - } else { + } else { try { h = swt_control_handle.getLong(swtControl); } catch (Exception ex) { @@ -350,14 +350,14 @@ public class SWTAccessor { return h; } - public static void setRealized(final Control swtControl, final boolean realize) - throws NativeWindowException + public static void setRealized(final Control swtControl, final boolean realize) + throws NativeWindowException { if(!realize && swtControl.isDisposed()) { return; } final long handle = getHandle(swtControl); - + if(null != OS_gtk_class) { invoke(true, new Runnable() { public void run() { @@ -365,16 +365,16 @@ public class SWTAccessor { callStaticMethodL2V(OS_gtk_widget_realize, handle); } else if(null != OS_gtk_widget_unrealize) { callStaticMethodL2V(OS_gtk_widget_unrealize, handle); - } + } } }); } } - + /** * @param swtControl the SWT Control to retrieve the native device handle from * @return the AbstractGraphicsDevice w/ the native device handle - * @throws NativeWindowException if the widget handle is null + * @throws NativeWindowException if the widget handle is null * @throws UnsupportedOperationException if the windowing system is not supported */ public static AbstractGraphicsDevice getDevice(Control swtControl) throws NativeWindowException, UnsupportedOperationException { @@ -391,7 +391,7 @@ public class SWTAccessor { } throw new UnsupportedOperationException("n/a for this windowing system: "+nwt); } - + /** * @param device * @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen @@ -400,7 +400,7 @@ public class SWTAccessor { public static AbstractGraphicsScreen getScreen(AbstractGraphicsDevice device, int screen) { return NativeWindowFactory.createScreen(device, screen); } - + public static int getNativeVisualID(AbstractGraphicsDevice device, long windowHandle) { if( isX11 ) { return X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle); @@ -408,29 +408,29 @@ public class SWTAccessor { if( isWindows || isOSX ) { return VisualIDHolder.VID_UNDEFINED; } - throw new UnsupportedOperationException("n/a for this windowing system: "+nwt); + throw new UnsupportedOperationException("n/a for this windowing system: "+nwt); } - + /** * @param swtControl the SWT Control to retrieve the native window handle from * @return the native window handle - * @throws NativeWindowException if the widget handle is null + * @throws NativeWindowException if the widget handle is null * @throws UnsupportedOperationException if the windowing system is not supported */ public static long getWindowHandle(Control swtControl) throws NativeWindowException, UnsupportedOperationException { - final long handle = getHandle(swtControl); + final long handle = getHandle(swtControl); if(0 == handle) { throw new NativeWindowException("Null SWT handle of SWT control "+swtControl); } if( isX11GTK ) { - return gdk_window_get_xwindow( gdk_widget_get_window( handle ) ); + return gdk_window_get_xwindow( gdk_widget_get_window( handle ) ); } if( isWindows || isOSX ) { return handle; } throw new UnsupportedOperationException("n/a for this windowing system: "+nwt); } - + public static long newGC(final Control swtControl, final GCData gcData) { final Object[] o = new Object[1]; invoke(true, new Runnable() { @@ -444,7 +444,7 @@ public class SWTAccessor { throw new InternalError("SWT internal_new_GC did not return int or long but "+o[0].getClass()); } } - + public static void disposeGC(final Control swtControl, final long gc, final GCData gcData) { invoke(true, new Runnable() { public void run() { @@ -456,7 +456,7 @@ public class SWTAccessor { } }); } - + /** * Runs the specified action in an SWT compatible thread, which is: * <ul> @@ -468,7 +468,7 @@ public class SWTAccessor { * <li>Linux, Windows, .. * <ul> * <li>Current thread.</li> - * </ul></li> + * </ul></li> * </ul> * @see Platform#AWT_AVAILABLE * @see Platform#getOSType() @@ -479,9 +479,9 @@ public class SWTAccessor { OSXUtil.RunOnMainThread(wait, runnable); } else { runnable.run(); - } + } } - + /** * Runs the specified action on the SWT UI thread. * <p> @@ -492,56 +492,56 @@ public class SWTAccessor { public static void invoke(org.eclipse.swt.widgets.Display display, boolean wait, Runnable runnable) { if( display.isDisposed() || Thread.currentThread() == display.getThread() ) { invoke(wait, runnable); - } else if( wait ) { + } else if( wait ) { display.syncExec(runnable); } else { display.asyncExec(runnable); } } - + // // Specific X11 GTK ChildWindow - Using plain X11 native parenting (works well) // - + public static long createCompatibleX11ChildWindow(AbstractGraphicsScreen screen, Control swtControl, int visualID, int width, int height) { final long handle = getHandle(swtControl); final long parentWindow = gdk_widget_get_window( handle ); gdk_window_set_back_pixmap (parentWindow, 0, false); - + final long x11ParentHandle = gdk_window_get_xwindow(parentWindow); final long x11WindowHandle = X11Lib.CreateWindow(x11ParentHandle, screen.getDevice().getHandle(), screen.getIndex(), visualID, width, height, true, true); - + return x11WindowHandle; } - + public static void resizeX11Window(AbstractGraphicsDevice device, Rectangle clientArea, long x11Window) { - X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height); + X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height); } public static void destroyX11Window(AbstractGraphicsDevice device, long x11Window) { X11Lib.DestroyWindow(device.getHandle(), x11Window); } - + // // Specific X11 SWT/GTK ChildWindow - Using SWT/GTK native parenting (buggy - sporadic resize flickering, sporadic drop of rendering) // // FIXME: Need to use reflection for 32bit access as well ! // - + // public static final int GDK_WA_TYPE_HINT = 1 << 9; // public static final int GDK_WA_VISUAL = 1 << 6; - + public static long createCompatibleGDKChildWindow(Control swtControl, int visualID, int width, int height) { return 0; /** final long handle = SWTAccessor.getHandle(swtControl); final long parentWindow = gdk_widget_get_window( handle ); - + final long screen = OS.gdk_screen_get_default (); final long gdkvisual = OS.gdk_x11_screen_lookup_visual (screen, visualID); - + final GdkWindowAttr attrs = new GdkWindowAttr(); attrs.width = width > 0 ? width : 1; - attrs.height = height > 0 ? height : 1; + attrs.height = height > 0 ? height : 1; attrs.event_mask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK | OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK | @@ -550,16 +550,16 @@ public class SWTAccessor { OS.GDK_POINTER_MOTION_HINT_MASK; attrs.window_type = OS.GDK_WINDOW_CHILD; attrs.visual = gdkvisual; - + final long childWindow = OS.gdk_window_new (parentWindow, attrs, OS.GDK_WA_VISUAL|GDK_WA_TYPE_HINT); OS.gdk_window_set_user_data (childWindow, handle); OS.gdk_window_set_back_pixmap (parentWindow, 0, false); - + OS.gdk_window_show (childWindow); OS.gdk_flush(); return childWindow; */ } - + public static void showGDKWindow(long gdkWindow) { /* OS.gdk_window_show (gdkWindow); OS.gdk_flush(); */ @@ -576,8 +576,8 @@ public class SWTAccessor { OS.gdk_window_resize (gdkWindow, clientArea.width, clientArea.height); OS.gdk_flush(); */ } - + public static void destroyGDKWindow(long gdkWindow) { // OS.gdk_window_destroy (gdkWindow); - } + } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java index 5cabdf150..7468d254b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -34,7 +34,7 @@ package com.jogamp.nativewindow.windows; import javax.media.nativewindow.*; -/** +/** * Encapsulates a graphics device on Windows platforms.<br> */ public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java index 0d2914c7d..120c86584 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.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 @@ -48,7 +48,7 @@ import jogamp.nativewindow.x11.XVisualInfo; public class X11GraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { private XVisualInfo info; - public X11GraphicsConfiguration(X11GraphicsScreen screen, + public X11GraphicsConfiguration(X11GraphicsScreen screen, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, XVisualInfo info) { super(screen, capsChosen, capsRequested); @@ -71,12 +71,12 @@ public class X11GraphicsConfiguration extends MutableGraphicsConfiguration imple final public int getXVisualID() { return (null!=info)?(int)info.getVisualid():0; } - + @Override public String toString() { return getClass().getSimpleName()+"["+getScreen()+", visualID 0x" + Long.toHexString(getXVisualID()) + ",\n\tchosen " + capabilitiesChosen+ - ",\n\trequested " + capabilitiesRequested+ + ",\n\trequested " + capabilitiesRequested+ "]"; } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java index e630e012e..40d212df3 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.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 @@ -87,12 +87,12 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl handleOwner = owner; isXineramaEnabled = X11Util.XineramaIsEnabled(this); } - + private static int getDefaultScreenImpl(long dpy) { return X11Lib.DefaultScreen(dpy); } - + /** * Returns the default screen number as referenced by the display connection, i.e. 'somewhere:0.1' -> 1 * <p> @@ -110,7 +110,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return ds; } - + public int getDefaultVisualID() { final long display = getHandle(); if(0==display) { @@ -118,11 +118,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return X11Lib.DefaultVisualID(display, getDefaultScreenImpl(display)); } - + public final boolean isXineramaEnabled() { return isXineramaEnabled; } - + @Override public Object clone() { return super.clone(); @@ -142,7 +142,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return false; } - + @Override public boolean close() { if(handleOwner && 0 != handle) { @@ -153,11 +153,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } return super.close(); } - + @Override public boolean isHandleOwner() { return handleOwner; - } + } @Override public void clearHandleOwner() { handleOwner = false; @@ -168,8 +168,8 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } @Override protected Object setHandleOwnership(Object newOwnership) { - final Boolean oldOwnership = Boolean.valueOf(handleOwner); + final Boolean oldOwnership = Boolean.valueOf(handleOwner); handleOwner = ((Boolean) newOwnership).booleanValue(); return oldOwnership; - } + } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java index 2ec66290a..8aac7095a 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.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 @@ -62,7 +62,7 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl // It still could be an AWT hold handle .. return X11Lib.DefaultVisualID(getDevice().getHandle(), getIndex()); } - + public Object clone() { return super.clone(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java index 4e45113d4..48f72e574 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. */ @@ -44,7 +44,7 @@ package javax.media.nativewindow; pixel format in a toolkit-independent manner. */ public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable { public Object clone(); - + /** * Return the screen this graphics configuration is valid for */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java index ed305d49e..31b64269f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java +++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2005 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. */ @@ -47,7 +47,7 @@ import jogamp.nativewindow.Debug; */ public interface AbstractGraphicsDevice extends Cloneable { public static final boolean DEBUG = Debug.debug("GraphicsDevice"); - + /** Dummy connection value for a default connection where no native support for multiple devices is available */ public static String DEFAULT_CONNECTION = "decon"; @@ -58,7 +58,7 @@ public interface AbstractGraphicsDevice extends Cloneable { public static int DEFAULT_UNIT = 0; public Object clone(); - + /** * Returns the type of the underlying subsystem, ie * NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, .. @@ -96,7 +96,7 @@ public interface AbstractGraphicsDevice extends Cloneable { * The unique ID may be used as a key for semantic device mapping. * </p> * <p> - * The returned string object reference is unique using {@link String#intern()} + * The returned string object reference is unique using {@link String#intern()} * and hence can be used as a key itself. * </p> */ @@ -114,29 +114,29 @@ public interface AbstractGraphicsDevice extends Cloneable { */ public void lock(); - /** + /** * Optionally unlocking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#unlock()}. * The lock implementation must be recursive. - * + * * @throws RuntimeException in case the lock is not acquired by this thread. */ public void unlock(); /** - * @throws RuntimeException if current thread does not hold the lock + * @throws RuntimeException if current thread does not hold the lock */ public void validateLocked() throws RuntimeException; - - /** + + /** * Optionally [re]opening the device if handle is <code>null</code>. * <p> * The default implementation is a <code>NOP</code>. * </p> * <p> - * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice} - * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice} + * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice} + * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice} * issue the native open operation in case handle is <code>null</code>. - * </p> + * </p> * * @return true if the handle was <code>null</code> and opening was successful, otherwise false. */ @@ -148,19 +148,19 @@ public interface AbstractGraphicsDevice extends Cloneable { * The default implementation {@link ToolkitLock#dispose() dispose} it's {@link ToolkitLock} and sets the handle to <code>null</code>. * </p> * <p> - * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice} - * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice} + * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice} + * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice} * issue the native close operation or skip it depending on the {@link #isHandleOwner() handles's ownership}. - * </p> + * </p> * * @return true if the handle was not <code>null</code> and closing was successful, otherwise false. */ public boolean close(); - + /** * @return <code>true</code> if instance owns the handle to issue {@link #close()}, otherwise <code>false</code>. */ public boolean isHandleOwner(); - + public void clearHandleOwner(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java index acb98073b..da8f12f3e 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java @@ -1,21 +1,21 @@ /* * Copyright (c) 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. */ @@ -45,7 +45,7 @@ package javax.media.nativewindow; public interface AbstractGraphicsScreen extends Cloneable { public Object clone(); - + /** * Return the device this graphics configuration is valid for */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java index f2a8e2394..9eed887b5 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java +++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java @@ -61,7 +61,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { // Switch for on- or offscreen private boolean onscreen = true; - + // offscreen bitmap mode private boolean isBitmap = false; @@ -74,7 +74,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { public Object cloneMutable() { return clone(); } - + @Override public Object clone() { try { @@ -85,7 +85,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } /** - * Copies all {@link Capabilities} values + * Copies all {@link Capabilities} values * from <code>source</code> into this instance. * @return this instance */ @@ -103,7 +103,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { transparentValueAlpha = other.getTransparentAlphaValue(); return this; } - + @Override public int hashCode() { // 31 * x == (x << 5) - x @@ -150,15 +150,15 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { **/ @Override public int compareTo(final CapabilitiesImmutable caps) { - /** + /** if ( ! ( o instanceof CapabilitiesImmutable ) ) { Class<?> c = (null != o) ? o.getClass() : null ; throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c); } final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */ - + final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 ); - + final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * ( caps.getAlphaBits() + 1 ); if(rgba > xrgba) { @@ -222,17 +222,17 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { return alphaBits; } - /** + /** * Sets the number of bits requested for the color buffer's alpha * component. On some systems only the color depth, which is the * sum of the red, green, and blue bits, is considered. * <p> - * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code> + * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code> * by {@link #setBackgroundOpaque(boolean)} and it's OpenGL specialization <code>GLCapabilities::setSampleBuffers(boolean)</code>.<br/> * Ensure to call this method after the above to ensure a <code>zero</code> value.</br> * The above automated settings takes into account, that the user calls this method to <i>request</i> alpha bits, * not to <i>reflect</i> a current state. Nevertheless if this is the case - call it at last. - * </p> + * </p> */ public void setAlphaBits(int alphaBits) { this.alphaBits = alphaBits; @@ -271,7 +271,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * Defaults to true. * </p> * <p> - * If requesting an offscreen surface without further selection of it's mode, + * If requesting an offscreen surface without further selection of it's mode, * e.g. FBO, Pbuffer or {@link #setBitmap(boolean) bitmap}, * the implementation will choose the best available offscreen mode. * </p> @@ -304,12 +304,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } isBitmap = enable; } - + @Override public boolean isBitmap() { - return isBitmap; + return isBitmap; } - + @Override public final int getTransparentRedValue() { return transparentValueRed; } @@ -354,7 +354,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { public StringBuilder toString(StringBuilder sink) { return toString(sink, true); } - + /** Returns a textual representation of this Capabilities object. */ @Override @@ -365,7 +365,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { msg.append("]"); return msg.toString(); } - + /** Return a textual representation of this object's on/off screen state. Use the given StringBuilder [optional]. */ protected StringBuilder onoffScreenToString(StringBuilder sink) { if(null == sink) { @@ -381,19 +381,19 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } else if(onscreen) { sink.append("."); // no additional off-screen modes besides on-screen } else { - sink.append("auto-cfg"); // auto-config off-screen mode + sink.append("auto-cfg"); // auto-config off-screen mode } - sink.append("]"); - + sink.append("]"); + return sink; } - + /** Element separator */ protected static final String ESEP = "/"; /** Component separator */ protected static final String CSEP = ", "; - - protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) { + + protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) { if(null == sink) { sink = new StringBuilder(); } @@ -409,6 +409,6 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } return sink; } - + protected final String toHexString(int val) { return Integer.toHexString(val); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java index e1fdf4938..1f4db7997 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java +++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -58,7 +58,7 @@ public interface CapabilitiesChooser { not necessarily required, that the chooser select that entry. <P> <em>Note:</em> this method is called automatically by the - {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method + {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method when an instance of this class is passed in to it. It should generally not be invoked by users directly, unless it is desired to delegate the diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java index 85659f286..c496a1535 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java @@ -70,12 +70,12 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C * Returns whether an opaque or translucent surface is requested, supported or chosen. * <p> * Default is true, i.e. opaque. - * </p> + * </p> */ boolean isBackgroundOpaque(); /** - * Returns whether an on- or offscreen surface is requested, available or chosen. + * Returns whether an on- or offscreen surface is requested, available or chosen. * <p> * Default is true, i.e. onscreen. * </p> @@ -83,7 +83,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C * Mind that an capabilities intance w/ <i>available</i> semantics * may show onscreen, but also the offscreen modes FBO, Pbuffer or {@link #setBitmap(boolean) bitmap}. * This is valid, since one native configuration maybe used for either functionality. - * </p> + * </p> */ boolean isOnscreen(); @@ -97,7 +97,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C * </p> */ boolean isBitmap(); - + /** * Gets the transparent red value for the frame buffer configuration. This * value is undefined if; equals true. diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java index 4f07bca9b..6095db052 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.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. */ @@ -66,16 +66,16 @@ import jogamp.nativewindow.Debug; */ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { - private static final boolean DEBUG; + private static final boolean DEBUG; static { Debug.initSingleton(); DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true); } - + private final static int NO_SCORE = -9999999; private final static int COLOR_MISMATCH_PENALTY_SCALE = 36; - + public int chooseCapabilities(final CapabilitiesImmutable desired, final List<? extends CapabilitiesImmutable> available, final int windowSystemRecommendedChoice) { @@ -112,7 +112,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { if (desired.isOnscreen() && !cur.isOnscreen()) { continue; // requested onscreen, but n/a } - + int score = 0; // Compute difference in color depth score += (COLOR_MISMATCH_PENALTY_SCALE * @@ -132,7 +132,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { System.err.println(" ]"); } - // Ready to select. Choose score closest to 0. + // Ready to select. Choose score closest to 0. int scoreClosestToZero = NO_SCORE; int chosenIndex = -1; for (int i = 0; i < availnum; i++) { diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java index 6b23172e1..3e32f30df 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -36,12 +36,12 @@ import jogamp.nativewindow.Debug; public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphicsConfiguration { protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration"); - + private AbstractGraphicsScreen screen; protected CapabilitiesImmutable capabilitiesChosen; protected CapabilitiesImmutable capabilitiesRequested; - public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen, + public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { if(null == screen) { throw new IllegalArgumentException("Null screen"); @@ -89,7 +89,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics final public int getVisualID(VIDType type) throws NativeWindowException { return capabilitiesChosen.getVisualID(type); } - + /** * Set the capabilities to a new value. * @@ -119,7 +119,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics public String toString() { return getClass().getSimpleName()+"[" + screen + ",\n\tchosen " + capabilitiesChosen+ - ",\n\trequested " + capabilitiesRequested+ + ",\n\trequested " + capabilitiesRequested+ "]"; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java index 0bf5c2937..d74954a0d 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.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 @@ -140,8 +140,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice public final void validateLocked() throws RuntimeException { toolkitLock.validateLocked(); } - - /** + + /** * {@inheritDoc} * <p> * Locking is perfomed via delegation to {@link ToolkitLock#lock()}, {@link ToolkitLock#unlock()}. @@ -154,7 +154,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice public final void unlock() { toolkitLock.unlock(); } - + @Override public boolean open() { return false; @@ -174,11 +174,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice public boolean isHandleOwner() { return false; } - + @Override - public void clearHandleOwner() { + public void clearHandleOwner() { } - + @Override public String toString() { return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]"; @@ -193,14 +193,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice handle = newHandle; return oldHandle; } - + protected Object getHandleOwnership() { return null; } protected Object setHandleOwnership(Object newOwnership) { return null; } - + public static final void swapDeviceHandleAndOwnership(final DefaultGraphicsDevice aDevice1, final DefaultGraphicsDevice aDevice2) { aDevice1.lock(); try { @@ -219,7 +219,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice aDevice1.unlock(); } } - + /** * Set the internal ToolkitLock, which is used within the * {@link #lock()} and {@link #unlock()} implementation. @@ -228,7 +228,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * The current ToolkitLock is being locked/unlocked while swapping the reference, * ensuring no concurrent access can occur during the swap. * </p> - * + * * @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used * @return the previous ToolkitLock instance */ @@ -253,8 +253,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice return toolkitLock; } - /** - * Returns a unique String object using {@link String#intern()} for the given arguments, + /** + * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ protected static String getUniqueID(String type, String connection, int unitID) { diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java index 9fa58c7a3..ffcad235c 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -57,7 +57,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen public AbstractGraphicsDevice getDevice() { return device; } - + public int getIndex() { return idx; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index 9694f2491..e1aa91959 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008-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 @@ -48,7 +48,7 @@ import java.util.Set; /** * Provides the mechanism by which the graphics configuration for a - * window can be chosen before the window is created. The graphics + * window can be chosen before the window is created. The graphics * configuration decides parameters related to hardware accelerated rendering such * as the OpenGL pixel format. <br> * On some window systems (EGL/OpenKODE and X11 in particular) it is necessary to @@ -69,21 +69,21 @@ public abstract class GraphicsConfigurationFactory { public final Class<?> deviceType; public final Class<?> capsType; private final int hash32; - + public DeviceCapsType(Class<?> deviceType, Class<?> capsType) { this.deviceType = deviceType; this.capsType = capsType; - + // 31 * x == (x << 5) - x int hash32 = 31 + deviceType.hashCode(); hash32 = ((hash32 << 5) - hash32) + capsType.hashCode(); this.hash32 = hash32; } - + public final int hashCode() { return hash32; } - + public final boolean equals(Object obj) { if(this == obj) { return true; } if (obj instanceof DeviceCapsType) { @@ -92,18 +92,18 @@ public abstract class GraphicsConfigurationFactory { } return false; } - + @Override public final String toString() { return "DeviceCapsType["+deviceType.getName()+", "+capsType.getName()+"]"; } - + } - + private static final Map<DeviceCapsType, GraphicsConfigurationFactory> registeredFactories; - private static final DeviceCapsType defaultDeviceCapsType; + private static final DeviceCapsType defaultDeviceCapsType; static boolean initialized = false; - + static { DEBUG = Debug.debug("GraphicsConfiguration"); if(DEBUG) { @@ -113,7 +113,7 @@ public abstract class GraphicsConfigurationFactory { registeredFactories = Collections.synchronizedMap(new HashMap<DeviceCapsType, GraphicsConfigurationFactory>()); defaultDeviceCapsType = new DeviceCapsType(AbstractGraphicsDevice.class, CapabilitiesImmutable.class); } - + public static synchronized void initSingleton() { if(!initialized) { initialized = true; @@ -121,31 +121,31 @@ public abstract class GraphicsConfigurationFactory { if(DEBUG) { System.err.println(Thread.currentThread().getName()+" - GraphicsConfigurationFactory.initSingleton()"); } - + // Register the default no-op factory for arbitrary // AbstractGraphicsDevice implementations, including // AWTGraphicsDevice instances -- the OpenGL binding will take // care of handling AWTGraphicsDevices on X11 platforms (as // well as X11GraphicsDevices in non-AWT situations) registerFactory(defaultDeviceCapsType.deviceType, defaultDeviceCapsType.capsType, new DefaultGraphicsConfigurationFactoryImpl()); - + if (NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) { try { - ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory", - "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); + ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory", + "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); } catch (Exception e) { throw new RuntimeException(e); } if(NativeWindowFactory.isAWTAvailable()) { try { - ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory", - "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); + ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory", + "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); } catch (Exception e) { /* n/a */ } } } } } - + public static synchronized void shutdown() { if(initialized) { initialized = false; @@ -155,7 +155,7 @@ public abstract class GraphicsConfigurationFactory { registeredFactories.clear(); } } - + protected static String getThreadName() { return Thread.currentThread().getName(); } @@ -176,10 +176,10 @@ public abstract class GraphicsConfigurationFactory { /** * Returns the graphics configuration factory for use with the * given device and capability. - * + * * @see #getFactory(Class, Class) */ - public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) { + public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) { if (device == null) { throw new IllegalArgumentException("null device"); } @@ -195,7 +195,7 @@ public abstract class GraphicsConfigurationFactory { * <p> * Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only. * </p> - * + * * <p> * Pseudo code for finding a suitable factory is: * <pre> @@ -211,7 +211,7 @@ public abstract class GraphicsConfigurationFactory { * @param deviceType the minimum capabilities class type accepted, must implement or extend {@link AbstractGraphicsDevice} * @param capabilitiesType the minimum capabilities class type accepted, must implement or extend {@link CapabilitiesImmutable} * - * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or + * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or * capabilitiesType does not implement {@link CapabilitiesImmutable} */ public static GraphicsConfigurationFactory getFactory(Class<?> deviceType, Class<?> capabilitiesType) @@ -228,12 +228,12 @@ public abstract class GraphicsConfigurationFactory { System.err.println("GraphicsConfigurationFactory.getFactory: "+deviceType.getName()+", "+capabilitiesType.getName()); dumpFactories(); } - - final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false); + + final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false); if(DEBUG) { System.err.println("GraphicsConfigurationFactory.getFactory() deviceTypes: " + deviceTypes); } - final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true); + final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true); if(DEBUG) { System.err.println("GraphicsConfigurationFactory.getFactory() capabilitiesTypes: " + capabilitiesTypes); } @@ -259,7 +259,7 @@ public abstract class GraphicsConfigurationFactory { return factory; } private static ArrayList<Class<?>> getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly) { - // Using a todo list avoiding a recursive loop! + // Using a todo list avoiding a recursive loop! final ArrayList<Class<?>> inspectClasses = new ArrayList<Class<?>>(); final ArrayList<Class<?>> resolvedInterfaces = new ArrayList<Class<?>>(); inspectClasses.add(fromClass); @@ -277,7 +277,7 @@ public abstract class GraphicsConfigurationFactory { } } types.addAll(Arrays.asList(fromClass.getInterfaces())); - + for(int i=0; i<types.size(); i++) { final Class<?> iface = types.get(i); if( superClassOrInterface.isAssignableFrom(iface) && !resolvedInterfaces.contains(iface) ) { @@ -302,20 +302,20 @@ public abstract class GraphicsConfigurationFactory { } } - /** + /** * Registers a GraphicsConfigurationFactory handling * the given graphics device and capability class. * <p> * This does not need to be called by end users, only implementors of new * GraphicsConfigurationFactory subclasses. * </p> - * + * * <p> * Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only. - * </p> - * + * </p> + * * <p>See {@link #getFactory(Class, Class)} for a description of the find algorithm.</p> - * + * * @param deviceType the minimum capabilities class type accepted, must implement or extend interface {@link AbstractGraphicsDevice} * @param capabilitiesType the minimum capabilities class type accepted, must extend interface {@link CapabilitiesImmutable} * @return the previous registered factory, or null if none @@ -329,7 +329,7 @@ public abstract class GraphicsConfigurationFactory { } if (!(defaultDeviceCapsType.capsType.isAssignableFrom(capabilitiesType))) { throw new IllegalArgumentException("Given capabilities class must implement CapabilitiesImmutable"); - } + } final DeviceCapsType dct = new DeviceCapsType(abstractGraphicsDeviceImplementor, capabilitiesType); final GraphicsConfigurationFactory prevFactory; if(null == factory) { @@ -352,7 +352,7 @@ public abstract class GraphicsConfigurationFactory { * <P> Selects a graphics configuration on the specified graphics * device compatible with the supplied {@link Capabilities}. Some * platforms (e.g.: X11, EGL, KD) require the graphics configuration - * to be specified when the native window is created. + * to be specified when the native window is created. * These architectures have seperated their device, screen, window and drawable * context and hence are capable of quering the capabilities for each screen. * A fully established window is not required.</P> @@ -360,7 +360,7 @@ public abstract class GraphicsConfigurationFactory { * <P>Other platforms (e.g. Windows, MacOSX) don't offer the mentioned seperation * and hence need a fully established window and it's drawable. * Here the validation of the capabilities is performed later. - * In this case, the AbstractGraphicsConfiguration implementation + * In this case, the AbstractGraphicsConfiguration implementation * must allow an overwrite of the Capabilites, for example * {@link DefaultGraphicsConfiguration#setChosenCapabilities DefaultGraphicsConfiguration.setChosenCapabilities(..)}. * </P> @@ -385,7 +385,7 @@ public abstract class GraphicsConfigurationFactory { * @param capsRequested the original requested capabilities * @param chooser the choosing implementation * @param screen the referring Screen - * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system. + * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system. * @return the complete GraphicsConfiguration * * @throws IllegalArgumentException if the data type of the passed diff --git a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java index ff53c8109..a0db11ad9 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java @@ -31,12 +31,12 @@ package javax.media.nativewindow; /** * Provides a {@link NativeSurface} with a mutable <code>surfaceHandle</code> * via {@link #setSurfaceHandle(long)}. - * + * * @see NativeSurface */ public interface MutableSurface extends NativeSurface { - /** + /** * Sets the surface handle which is created outside of this implementation. */ public void setSurfaceHandle(long surfaceHandle); diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index a89caec76..a755b1812 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.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 javax.media.nativewindow; /** Provides low-level information required for @@ -54,10 +54,10 @@ public interface NativeSurface extends SurfaceUpdatedListener { * <p> * The surface handle shall be valid after a successfull call, * ie return a value other than {@link #LOCK_SURFACE_UNLOCKED} and {@link #LOCK_SURFACE_NOT_READY}, - * which is - * <pre> - * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface(); - * </pre> + * which is + * <pre> + * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface(); + * </pre> * </p> * <p> * The caller may need to take care of the result {@link #LOCK_SURFACE_CHANGED}, @@ -71,7 +71,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * This call allows recursion from the same thread. * </p> * <p> - * The implementation may want to aquire the + * The implementation may want to aquire the * application level {@link com.jogamp.common.util.locks.RecursiveLock} * first before proceeding with a native surface lock. * </p> @@ -115,7 +115,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * </pre> */ public boolean isSurfaceLockedByOtherThread(); - + /** * Return the locking owner's Thread, or null if not locked. */ @@ -123,15 +123,15 @@ public interface NativeSurface extends SurfaceUpdatedListener { /** * Provide a mechanism to utilize custom (pre-) swap surface - * code. This method is called before the render toolkit (e.g. JOGL) + * code. This method is called before the render toolkit (e.g. JOGL) * swaps the buffer/surface if double buffering is enabled. - * <p> + * <p> * The implementation may itself apply the swapping, * in which case true shall be returned. * </p> * * @return true if this method completed swapping the surface, - * otherwise false, in which case eg the GLDrawable + * otherwise false, in which case eg the GLDrawable * implementation has to swap the code. */ public boolean surfaceSwap(); @@ -153,13 +153,13 @@ public interface NativeSurface extends SurfaceUpdatedListener { /** Remove the specified {@link SurfaceUpdatedListener} from the list. */ public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l); - + /** * Returns the handle to the surface for this NativeSurface. <P> - * + * * The surface handle should be set/update by {@link #lockSurface()}, * where {@link #unlockSurface()} is not allowed to modify it. - * After {@link #unlockSurface()} it is no more guaranteed + * After {@link #unlockSurface()} it is no more guaranteed * that the surface handle is still valid. * * The surface handle shall reflect the platform one @@ -195,16 +195,16 @@ public interface NativeSurface extends SurfaceUpdatedListener { public AbstractGraphicsConfiguration getGraphicsConfiguration(); /** - * Convenience: Get display handle from + * Convenience: Get display handle from * AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice */ public long getDisplayHandle(); /** - * Convenience: Get display handle from + * Convenience: Get display handle from * AbstractGraphicsConfiguration . AbstractGraphicsScreen */ public int getScreenIndex(); - + } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java index 593c1e7d6..0943c8c09 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 07d1008b4..bad72f355 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008-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 @@ -90,13 +90,13 @@ public abstract class NativeWindowFactory { private static final String nativeWindowingTypePure; // canonical String via String.intern() private static final String nativeWindowingTypeCustom; // canonical String via String.intern() - + private static NativeWindowFactory defaultFactory; private static Map<Class<?>, NativeWindowFactory> registeredFactories; - + private static Class<?> nativeWindowClass; private static boolean isAWTAvailable; - + private static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ; /** {@link jogamp.nativewindow.x11.X11Util} implements {@link ToolkitProperties}. */ private static final String X11UtilClassName = "jogamp.nativewindow.x11.X11Util"; @@ -104,16 +104,16 @@ public abstract class NativeWindowFactory { private static final String OSXUtilClassName = "jogamp.nativewindow.macosx.OSXUtil"; /** {@link jogamp.nativewindow.windows.GDIUtil} implements {@link ToolkitProperties}. */ private static final String GDIClassName = "jogamp.nativewindow.windows.GDIUtil"; - + private static ToolkitLock jawtUtilJAWTToolkitLock; - + private static boolean requiresToolkitLock; private static boolean desktopHasThreadingIssues; // Shutdown hook mechanism for the factory private static volatile boolean isJVMShuttingDown = false; private static final List<Runnable> customShutdownHooks = new ArrayList<Runnable>(); - + /** Creates a new NativeWindowFactory instance. End users do not need to call this method. */ protected NativeWindowFactory() { @@ -139,10 +139,10 @@ public abstract class NativeWindowFactory { case MACOS: return TYPE_MACOSX; case WINDOWS: - return TYPE_WINDOWS; + return TYPE_WINDOWS; case OPENKODE: return TYPE_EGL; - + case LINUX: case FREEBSD: case SUNOS: @@ -158,7 +158,7 @@ public abstract class NativeWindowFactory { static { final boolean[] _DEBUG = new boolean[] { false }; final String[] _tmp = new String[] { null }; - + AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { Platform.initSingleton(); // last resort .. @@ -168,16 +168,16 @@ public abstract class NativeWindowFactory { new Thread(new Runnable() { public void run() { NativeWindowFactory.shutdown(true); - } }, "NativeWindowFactory_ShutdownHook" ) ) ; + } }, "NativeWindowFactory_ShutdownHook" ) ) ; return null; } } ) ; - + DEBUG = _DEBUG[0]; if(DEBUG) { System.err.println(Thread.currentThread().getName()+" - Info: NativeWindowFactory.<init>"); // Thread.dumpStack(); } - + // Gather the windowing TK first nativeWindowingTypePure = _getNativeWindowingType(); if(null==_tmp[0] || _tmp[0].length()==0) { @@ -202,23 +202,23 @@ public abstract class NativeWindowFactory { } if( null != clazzName ) { ReflectionUtil.callStaticMethod(clazzName, "initSingleton", null, null, cl ); - + final Boolean res1 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "requiresToolkitLock", null, null, cl); requiresToolkitLock = res1.booleanValue(); final Boolean res2 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "hasThreadingIssues", null, null, cl); desktopHasThreadingIssues = res2.booleanValue(); - } else { + } else { requiresToolkitLock = false; desktopHasThreadingIssues = false; } } - /** Returns true if the JVM is shutting down, otherwise false. */ + /** Returns true if the JVM is shutting down, otherwise false. */ public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; } - - /** + + /** * Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance. - * + * * @param head if true add runnable at the start, otherwise at the end * @param runnable runnable to be added. */ @@ -234,7 +234,7 @@ public abstract class NativeWindowFactory { } } - /** + /** * Cleanup resources at JVM shutdown */ public static synchronized void shutdown(boolean _isJVMShuttingDown) { @@ -246,14 +246,14 @@ public abstract class NativeWindowFactory { final int cshCount = customShutdownHooks.size(); for(int i=0; i < cshCount; i++) { try { - if( DEBUG ) { + if( DEBUG ) { System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount); } customShutdownHooks.get(i).run(); } catch(Throwable t) { System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount); - if( DEBUG ) { - t.printStackTrace(); + if( DEBUG ) { + t.printStackTrace(); } } } @@ -262,7 +262,7 @@ public abstract class NativeWindowFactory { if(DEBUG) { System.err.println("NativeWindowFactory.shutdown(): Post customShutdownHook"); } - + if(initialized) { initialized = false; if(null != registeredFactories) { @@ -271,14 +271,14 @@ public abstract class NativeWindowFactory { } GraphicsConfigurationFactory.shutdown(); } - + shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown // SharedResourceToolkitLock.shutdown(DEBUG); // not used yet if(DEBUG) { System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown); } } - + private static void shutdownNativeImpl(final ClassLoader cl) { final String clazzName; if( TYPE_X11 == nativeWindowingTypePure ) { @@ -292,11 +292,11 @@ public abstract class NativeWindowFactory { } if( null != clazzName ) { ReflectionUtil.callStaticMethod(clazzName, "shutdown", null, null, cl ); - } + } } - + /** Returns true if {@link #initSingleton()} has been called w/o subsequent {@link #shutdown(boolean)}. */ - public static synchronized boolean isInitialized() { return initialized; } + public static synchronized boolean isInitialized() { return initialized; } /** * Static one time initialization of this factory.<br> @@ -316,7 +316,7 @@ public abstract class NativeWindowFactory { if( Platform.AWT_AVAILABLE && ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) { - + Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { public Method[] run() { try { @@ -327,7 +327,7 @@ public abstract class NativeWindowFactory { jawtUtilInitMethod.setAccessible(true); Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{}); jawtUtilGetJAWTToolkitLockMethod.setAccessible(true); - return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod }; + return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod }; } catch (Exception e) { if(DEBUG) { e.printStackTrace(); @@ -340,7 +340,7 @@ public abstract class NativeWindowFactory { final Method jawtUtilInitMethod = jawtUtilMethods[0]; final Method jawtUtilIsHeadlessMethod = jawtUtilMethods[1]; final Method jawtUtilGetJAWTToolkitLockMethod = jawtUtilMethods[2]; - + ReflectionUtil.callMethod(null, jawtUtilInitMethod); Object resO = ReflectionUtil.callMethod(null, jawtUtilIsHeadlessMethod); @@ -351,21 +351,21 @@ public abstract class NativeWindowFactory { } else { throw new RuntimeException("JAWTUtil.isHeadlessMode() didn't return a Boolean"); } - resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod); + resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod); if(resO instanceof ToolkitLock) { jawtUtilJAWTToolkitLock = (ToolkitLock) resO; } else { throw new RuntimeException("JAWTUtil.getJAWTToolkitLock() didn't return a ToolkitLock"); - } + } } } - + // X11 initialization after possible AWT initialization // This is performed post AWT initialization, allowing AWT to complete the same, - // which may have been triggered before NativeWindow initialization. - // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..). + // which may have been triggered before NativeWindow initialization. + // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..). initSingletonNativeImpl(cl); - + registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>()); // register our default factory -> NativeWindow @@ -373,17 +373,17 @@ public abstract class NativeWindowFactory { nativeWindowClass = javax.media.nativewindow.NativeWindow.class; registerFactory(nativeWindowClass, factory); defaultFactory = factory; - + if ( isAWTAvailable ) { // register either our default factory or (if exist) the X11/AWT one -> AWT Component registerFactory(ReflectionUtil.getClass(ReflectionUtil.AWTNames.ComponentClass, false, cl), factory); } - + if(DEBUG) { System.err.println("NativeWindowFactory requiresToolkitLock "+requiresToolkitLock+", desktopHasThreadingIssues "+desktopHasThreadingIssues); System.err.println("NativeWindowFactory isAWTAvailable "+isAWTAvailable+", defaultFactory "+factory); } - + GraphicsConfigurationFactory.initSingleton(); } } @@ -392,20 +392,20 @@ public abstract class NativeWindowFactory { public static boolean requiresToolkitLock() { return requiresToolkitLock; } - + /** @return true if not headless, AWT Component and NativeWindow's AWT part available */ public static boolean isAWTAvailable() { return isAWTAvailable; } /** * @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value. - * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}. + * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}. * Hence {@link String#equals(Object)} and <code>==</code> produce the same result. */ public static String getNativeWindowType(boolean useCustom) { return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure; } - /** Don't know if we shall add this factory here .. + /** Don't know if we shall add this factory here .. public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) { if(TYPE_EGL == type) { return new @@ -427,13 +427,13 @@ public abstract class NativeWindowFactory { return defaultFactory; } - /** + /** * Returns the AWT {@link ToolkitLock} (JAWT based) if {@link #isAWTAvailable}, otherwise null. * <p> * The JAWT based {@link ToolkitLock} also locks the global lock, * which matters if the latter is required. - * </p> - */ + * </p> + */ public static ToolkitLock getAWTToolkitLock() { return jawtUtilJAWTToolkitLock; } @@ -441,7 +441,7 @@ public abstract class NativeWindowFactory { public static ToolkitLock getNullToolkitLock() { return NativeWindowFactoryImpl.getNullToolkitLock(); } - + /** * Provides the system default {@link ToolkitLock} for the default system windowing type. * @see #getNativeWindowType(boolean) @@ -486,7 +486,7 @@ public abstract class NativeWindowFactory { } return NativeWindowFactoryImpl.getNullToolkitLock(); } - + /** * @param device * @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen @@ -510,7 +510,7 @@ public abstract class NativeWindowFactory { } return new DefaultGraphicsScreen(device, screen); } - + /** Returns the appropriate NativeWindowFactory to handle window objects of the given type. The windowClass might be {@link NativeWindow NativeWindow}, in which case the client has @@ -543,7 +543,7 @@ public abstract class NativeWindowFactory { } /** Converts the given window object and it's - {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a + {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a {@link NativeWindow NativeWindow} which can be operated upon by a custom toolkit, e.g. {@link javax.media.opengl.GLDrawableFactory javax.media.opengl.GLDrawableFactory}.<br> The object may be a component for a particular window toolkit, such as an AWT @@ -554,7 +554,7 @@ public abstract class NativeWindowFactory { NativeWindowFactory is responsible for handling objects from a particular window toolkit. The built-in NativeWindowFactory handles NativeWindow instances as well as AWT Components.<br> - + @throws IllegalArgumentException if the given window object could not be handled by any of the registered NativeWindowFactory instances @@ -573,22 +573,22 @@ public abstract class NativeWindowFactory { NativeWindow. Implementors of concrete NativeWindowFactory subclasses should override this method. */ protected abstract NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException; - + /** * Returns the {@link OffscreenLayerSurface} instance of this {@link NativeSurface}. * <p> - * In case this surface is a {@link NativeWindow}, we traverse from the given surface + * In case this surface is a {@link NativeWindow}, we traverse from the given surface * up to root until an implementation of {@link OffscreenLayerSurface} is found. * In case <code>ifEnabled</code> is true, the surface must also implement {@link OffscreenLayerOption} - * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>. + * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>. * </p> - * + * * @param surface The surface to query. - * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}. + * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}. * @return */ public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) { - if(surface instanceof OffscreenLayerSurface && + if(surface instanceof OffscreenLayerSurface && ( !ifEnabled || surface instanceof OffscreenLayerOption ) ) { final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface; return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null; @@ -601,12 +601,12 @@ public abstract class NativeWindowFactory { final OffscreenLayerSurface ols = (OffscreenLayerSurface) nw; return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null; } - nw = nw.getParent(); + nw = nw.getParent(); } } - return null; + return null; } - + /** * Returns true if the given visualID is valid for further processing, i.e. OpenGL usage, * otherwise return false. @@ -619,8 +619,8 @@ public abstract class NativeWindowFactory { * </p> */ public static boolean isNativeVisualIDValidForProcessing(int visualID) { - return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) || + return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) || VisualIDHolder.VID_UNDEFINED != visualID ; } - + } diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java index 12d30b3cd..11496899a 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java +++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java @@ -32,30 +32,30 @@ package javax.media.nativewindow; * within the implementation. */ public interface OffscreenLayerOption { - /** + /** * Request an offscreen layer, if supported. * <p> * Shall be called before the first {@link NativeWindow#lockSurface()}, * and hence before realization. * </p> - * + * * @see #getShallUseOffscreenLayer() - * @see #isOffscreenLayerSurfaceEnabled() + * @see #isOffscreenLayerSurfaceEnabled() */ public void setShallUseOffscreenLayer(boolean v); /** Returns the property set by {@link #setShallUseOffscreenLayer(boolean)}. */ public boolean getShallUseOffscreenLayer(); - /** + /** * Returns true if this instance uses an offscreen layer, otherwise false. * <p> * This instance is an offscreen layer, if {@link #setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)} * has been called before it's realization and first lock and the underlying implementation supports it. * </p> * The return value is undefined before issuing the first {@link NativeWindow#lockSurface()}. - * - * @see #setShallUseOffscreenLayer(boolean) + * + * @see #setShallUseOffscreenLayer(boolean) */ public boolean isOffscreenLayerSurfaceEnabled(); }
\ No newline at end of file diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java index 1826008ad..8681422ef 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java @@ -33,36 +33,36 @@ import com.jogamp.common.util.locks.RecursiveLock; * Interface specifying the offscreen layer surface protocol. */ public interface OffscreenLayerSurface { - /** + /** * Attach the offscreen layer to this offscreen layer surface. * <p> * Implementation may realize all required resources at this point. * </p> - * + * * @see #isOffscreenLayerSurfaceEnabled() * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false */ public void attachSurfaceLayer(final long layerHandle) throws NativeWindowException; - - /** + + /** * Detaches a previously attached offscreen layer from this offscreen layer surface. * @see #attachSurfaceLayer(long) * @see #isOffscreenLayerSurfaceEnabled() - * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false + * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false * or no surface layer is attached. */ public void detachSurfaceLayer() throws NativeWindowException; - + /** Returns the attached surface layer or null if none is attached. */ public long getAttachedSurfaceLayer(); - + /** Returns true if a surface layer is attached, otherwise false. */ public boolean isSurfaceLayerAttached(); - + /** Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings. */ public void setChosenCapabilities(CapabilitiesImmutable caps); - - /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */ + + /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */ public RecursiveLock getLock(); - + } diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java index 15a8738c5..eb0a6cf04 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java @@ -33,44 +33,44 @@ import jogamp.nativewindow.Debug; /** * Provides a mutable {@link NativeSurface}, i.e. {@link MutableSurface}, while allowing an * {@link UpstreamSurfaceHook} to influence the lifecycle and information. - * + * * @see UpstreamSurfaceHook * @see MutableSurface * @see NativeSurface */ -public interface ProxySurface extends MutableSurface { +public interface ProxySurface extends MutableSurface { public static final boolean DEBUG = Debug.debug("ProxySurface"); - - /** + + /** * Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's surface handle * @see #addUpstreamOptionBits(int) * @see #clearUpstreamOptionBits(int) * @see #getUpstreamOptionBits() - */ + */ public static final int OPT_PROXY_OWNS_UPSTREAM_SURFACE = 1 << 6; - - /** + + /** * Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's {@link AbstractGraphicsDevice}. * @see #addUpstreamOptionBits(int) * @see #clearUpstreamOptionBits(int) * @see #getUpstreamOptionBits() - */ + */ public static final int OPT_PROXY_OWNS_UPSTREAM_DEVICE = 1 << 7; - - /** + + /** * Implementation specific bitvalue stating the upstream's {@link NativeSurface} is an invisible window, i.e. maybe incomplete. * @see #addUpstreamOptionBits(int) * @see #clearUpstreamOptionBits(int) * @see #getUpstreamOptionBits() - */ + */ public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8; /** Allow redefining the AbstractGraphicsConfiguration */ - public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg); + public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg); /** * Return the upstream {@link NativeSurface} if used, otherwise <code>null</code>. - * <p> + * <p> * An upstream {@link NativeSurface} may backup this {@link ProxySurface} instance's representation, * e.g. via a {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set} {@link UpstreamSurfaceHook}. * </p> @@ -80,47 +80,47 @@ public interface ProxySurface extends MutableSurface { * </p> */ public NativeSurface getUpstreamSurface(); - + /** Returns the {@link UpstreamSurfaceHook} if {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set}, otherwise <code>null</code>. */ public UpstreamSurfaceHook getUpstreamSurfaceHook(); - + /** * Sets the {@link UpstreamSurfaceHook} and returns the previous value. */ public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook); - - /** - * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions + + /** + * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions * {@link UpstreamSurfaceHook#create(ProxySurface)} and {@link UpstreamSurfaceHook#destroy(ProxySurface)}. * <p> * Use this for small code blocks where the native resources shall not change, * i.e. resizing a derived (OpenGL) drawable. - * </p> + * </p> */ public void enableUpstreamSurfaceHookLifecycle(boolean enable); - - /** + + /** * {@link UpstreamSurfaceHook#create(ProxySurface)} is being issued and the proxy surface/window handles shall be set. - */ + */ public void createNotify(); - - /** + + /** * {@link UpstreamSurfaceHook#destroy(ProxySurface)} is being issued and all proxy surface/window handles shall be cleared. - */ + */ public void destroyNotify(); - + public StringBuilder getUpstreamOptionBits(StringBuilder sink); public int getUpstreamOptionBits(); - + /** Returns <code>true</code> if the give bit-mask <code>v</code> is set in this instance upstream-option-bits, otherwise <code>false</code>.*/ public boolean containsUpstreamOptionBits(int v); - + /** Add the given bit-mask to this instance upstream-option-bits using bit-or w/ <code>v</code>.*/ public void addUpstreamOptionBits(int v); - + /** Clear the given bit-mask from this instance upstream-option-bits using bit-and w/ <code>~v</code>*/ public void clearUpstreamOptionBits(int v); - + public StringBuilder toString(StringBuilder sink); public String toString(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java index 0912b5afe..de65a3031 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java +++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.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. - * + * */ package javax.media.nativewindow; diff --git a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java index eccfcfa4f..017b996d7 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java +++ b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java @@ -53,26 +53,26 @@ public interface ToolkitLock { * @throws RuntimeException in case of a timeout */ public void lock(); - + /** * Release the lock. * * @throws RuntimeException in case the lock is not acquired by this thread. */ public void unlock(); - + /** - * @throws RuntimeException if current thread does not hold the lock + * @throws RuntimeException if current thread does not hold the lock */ public void validateLocked() throws RuntimeException; - - /** + + /** * Dispose this instance. - * <p> + * <p> * Shall be called when instance is no more required. * </p> * This allows implementations sharing a lock via resources - * to decrease the reference counter. + * to decrease the reference counter. */ public void dispose(); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java index 6fe2e5364..f08a6c938 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java +++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java @@ -28,24 +28,24 @@ package javax.media.nativewindow; -/** - * Interface allowing upstream caller to pass lifecycle actions and size info - * to a {@link ProxySurface} instance. - */ +/** + * Interface allowing upstream caller to pass lifecycle actions and size info + * to a {@link ProxySurface} instance. + */ public interface UpstreamSurfaceHook { /** called within {@link ProxySurface#createNotify()} within lock, before using surface. */ public void create(ProxySurface s); /** called within {@link ProxySurface#destroyNotify()} within lock, before clearing fields. */ public void destroy(ProxySurface s); - /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ + /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ public int getWidth(ProxySurface s); - /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ + /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ public int getHeight(ProxySurface s); - + /** - * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize. - */ + * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize. + */ public interface MutableSize extends UpstreamSurfaceHook { public void setSize(int width, int height); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java index 4f3d3ff00..4ee71ee79 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java +++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java @@ -38,7 +38,7 @@ import java.util.Comparator; * </p> */ public interface VisualIDHolder { - + public enum VIDType { // Generic Values INTRINSIC(0), NATIVE(1), @@ -47,19 +47,19 @@ public interface VisualIDHolder { // X11 Values X11_XVISUAL(20), X11_FBCONFIG(21), // Windows Values - WIN32_PFD(30); - + WIN32_PFD(30); + public final int id; VIDType(int id){ this.id = id; } - } - + } + /** * Returns the native visual ID of the given <code>type</code> * if supported, or {@link #VID_UNDEFINED} if not supported. - * <p> + * <p> * Depending on the native windowing system, <code>type</code> is handled as follows: * <ul> * <li>X11 throws NativeWindowException on <code>EGL_CONFIG</code>, <code>WIN32_PFD</code> @@ -76,7 +76,7 @@ public interface VisualIDHolder { * <li><code>X11_XVISUAL</code>: <i>X11 XVisual ID</i></li> * <li><code>X11_FBCONFIG</code>: <i>X11 FBConfig ID</i> or <code>VID_UNDEFINED</code></li> * </ul></li> - * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code> + * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code> * <ul> * <li><code>INTRINSIC</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li> * <li><code>NATIVE</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li> @@ -91,35 +91,35 @@ public interface VisualIDHolder { * </ul> * </p> * Note: <code>INTRINSIC</code> and <code>NATIVE</code> are always handled, - * but may result in {@link #VID_UNDEFINED}. The latter is true if - * the native value are actually undefined or the corresponding object is not + * but may result in {@link #VID_UNDEFINED}. The latter is true if + * the native value are actually undefined or the corresponding object is not * mapped to a native visual object. - * + * * @throws NativeWindowException if <code>type</code> is neither * <code>INTRINSIC</code> nor <code>NATIVE</code> - * and does not match the native implementation. + * and does not match the native implementation. */ int getVisualID(VIDType type) throws NativeWindowException ; - - /** + + /** * {@link #getVisualID(VIDType)} result indicating an undefined value, * which could be cause by an unsupported query. * <p> * We assume the const value <code>0</code> doesn't reflect a valid native visual ID * and is interpreted as <i>no value</i> on all platforms. * This is currently true for Android, X11 and Windows. - * </p> + * </p> */ static final int VID_UNDEFINED = 0; - + /** Comparing {@link VIDType#NATIVE} */ public static class VIDComparator implements Comparator<VisualIDHolder> { private VIDType type; - + public VIDComparator(VIDType type) { this.type = type; } - + public int compare(VisualIDHolder vid1, VisualIDHolder vid2) { final int id1 = vid1.getVisualID(type); final int id2 = vid2.getVisualID(type); @@ -131,5 +131,5 @@ public interface VisualIDHolder { } return 0; } - } + } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java index 02f68f442..8570b78da 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java +++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java @@ -37,7 +37,7 @@ package javax.media.nativewindow; * this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.</p> */ public interface WindowClosingProtocol { - + /** * Window closing mode if triggered by toolkit close operation. */ @@ -47,7 +47,7 @@ public interface WindowClosingProtocol { * This is the default behavior within an AWT environment. */ DO_NOTHING_ON_CLOSE, - + /** * Dispose resources on native window close operation.<br> * This is the default behavior in case no underlying toolkit defines otherwise. diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java index 17b4930c5..b8b48a46c 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java @@ -4,14 +4,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 @@ -21,12 +21,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 javax.media.nativewindow.util; public class Dimension implements Cloneable, DimensionImmutable { @@ -48,7 +48,7 @@ public class Dimension implements Cloneable, DimensionImmutable { public Object cloneMutable() { return clone(); } - + public Object clone() { try { return super.clone(); @@ -92,7 +92,7 @@ public class Dimension implements Cloneable, DimensionImmutable { public int compareTo(final DimensionImmutable d) { final int tsq = width*height; final int xsq = d.getWidth()*d.getHeight(); - + if(tsq > xsq) { return 1; } else if(tsq < xsq) { @@ -100,13 +100,13 @@ public class Dimension implements Cloneable, DimensionImmutable { } return 0; } - + @Override public boolean equals(Object obj) { if(this == obj) { return true; } if (obj instanceof Dimension) { Dimension p = (Dimension)obj; - return height == p.height && + return height == p.height && width == p.width ; } return false; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java index 22bd3f48b..9caa433a6 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java @@ -46,12 +46,12 @@ public interface DimensionImmutable extends WriteCloneable, Comparable<Dimension /** * <p> * Compares square of size. - * </p> + * </p> * {@inheritDoc} */ @Override public int compareTo(final DimensionImmutable d); - + /** * Checks whether two dimensions objects are equal. Two instances * of <code>DimensionReadOnly</code> are equal if two components diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java index 942c12c2b..dbd997c60 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.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,18 +20,18 @@ * 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 javax.media.nativewindow.util; public class Insets implements Cloneable, InsetsImmutable { static final InsetsImmutable zeroInsets = new Insets(); public static final InsetsImmutable getZero() { return zeroInsets; } - + int l, r, t, b; public Insets() { @@ -44,11 +44,11 @@ public class Insets implements Cloneable, InsetsImmutable { this.t=top; this.b=bottom; } - + public Object cloneMutable() { return clone(); } - + protected Object clone() { try { return super.clone(); @@ -77,7 +77,7 @@ public class Insets implements Cloneable, InsetsImmutable { public final void setRightWidth(int right) { r = right; } public final void setTopHeight(int top) { t = top; } public final void setBottomHeight(int bottom) { b = bottom; } - + @Override public boolean equals(Object obj) { if(this == obj) { return true; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java index 075641ede..0f99a7861 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java @@ -41,13 +41,13 @@ public interface InsetsImmutable extends WriteCloneable { /** @return total width, ie. <code>left_width + right_width</code> */ int getTotalWidth(); - + /** @return top inset height */ int getTopHeight(); /** @return bottom inset height */ int getBottomHeight(); - + /** @return total height, ie. <code>top_height + bottom_height</code> */ int getTotalHeight(); diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java index 4c233bb16..aba515d52 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java @@ -45,7 +45,7 @@ public class Point implements Cloneable, PointImmutable { public Object cloneMutable() { return clone(); } - + public Object clone() { try { return super.clone(); @@ -58,7 +58,7 @@ public class Point implements Cloneable, PointImmutable { public int compareTo(final PointImmutable d) { final int sq = x*y; final int xsq = d.getX()*d.getY(); - + if(sq > xsq) { return 1; } else if(sq < xsq) { @@ -66,7 +66,7 @@ public class Point implements Cloneable, PointImmutable { } return 0; } - + @Override public boolean equals(Object obj) { if(this == obj) { return true; } @@ -120,5 +120,5 @@ public class Point implements Cloneable, PointImmutable { y *= sy ; return this; } - + } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java index b00329bb5..f5377e059 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java @@ -41,12 +41,12 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl /** * <p> * Compares the square of the position. - * </p> + * </p> * {@inheritDoc} */ @Override public int compareTo(final PointImmutable d); - + /** * Checks whether two points objects are equal. Two instances * of <code>PointReadOnly</code> are equal if the two components @@ -57,5 +57,5 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl public boolean equals(Object obj); public int hashCode(); - + } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java index bbbfa2932..3a51fb67d 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.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 javax.media.nativewindow.util; import java.util.List; @@ -46,11 +46,11 @@ public class Rectangle implements Cloneable, RectangleImmutable { this.width=width; this.height=height; } - + public Object cloneMutable() { return clone(); } - + protected Object clone() { try { return super.clone(); @@ -67,7 +67,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { public final int getWidth() { return width; } @Override public final int getHeight() { return height; } - + public final void set(int x, int y, int width, int height) { this.x = x; this.y = y; @@ -89,7 +89,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { final int y1 = Math.min(y, ry1); final int x2 = Math.max(x + width, rx2); final int y2 = Math.max(y + height, ry2); - return new Rectangle(x1, y1, x2 - x1, y2 - y1); + return new Rectangle(x1, y1, x2 - x1, y2 - y1); } /** * Calculates the union of the given rectangles, stores it in this instance and returns this instance. @@ -109,7 +109,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { set(x1, y1, x2 - x1, y2 - y1); return this; } - + @Override public final RectangleImmutable intersection(RectangleImmutable r) { return intersection(r.getX(), r.getY(), r.getX() + r.getWidth(), r.getY() + r.getHeight()); @@ -144,13 +144,13 @@ public class Rectangle implements Cloneable, RectangleImmutable { final float sqT = (float) ( width*height ); return sqI / sqT; } - + @Override public int compareTo(final RectangleImmutable d) { { final int sq = width*height; final int xsq = d.getWidth()*d.getHeight(); - + if(sq > xsq) { return 1; } else if(sq < xsq) { @@ -160,7 +160,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { { final int sq = x*y; final int xsq = d.getX()*d.getY(); - + if(sq > xsq) { return 1; } else if(sq < xsq) { @@ -169,7 +169,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { } return 0; } - + @Override public boolean equals(Object obj) { if(this == obj) { return true; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java index 440d9e000..ce735f53f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java @@ -49,7 +49,7 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle RectangleImmutable intersection(RectangleImmutable r); /** Returns the intersection of this rectangleand the given coordinates. */ RectangleImmutable intersection(final int rx1, final int ry1, final int rx2, final int ry2); - /** + /** * Returns the coverage of given rectangle w/ this this one, i.e. between <code>0.0</code> and <code>1.0</code>. * <p> * Coverage is computed by: @@ -57,19 +57,19 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle * isect = this.intersection(r); * coverage = area( isect ) / area( this ) ; * </pre> - * </p> + * </p> */ float coverage(RectangleImmutable r); - + /** * <p> * Compares square of size 1st, if equal the square of position. - * </p> + * </p> * {@inheritDoc} */ @Override public int compareTo(final RectangleImmutable d); - + /** * Checks whether two rect objects are equal. Two instances * of <code>Rectangle</code> are equal if the four integer values diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java index 3084816a5..917f7e230 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java @@ -4,14 +4,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 @@ -21,15 +21,15 @@ * 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 javax.media.nativewindow.util; -/** +/** * Immutable SurfaceSize Class, consisting of it's read only components:<br> * <ul> * <li>{@link javax.media.nativewindow.util.DimensionImmutable} size in pixels</li> @@ -63,7 +63,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> { /** * <p> * Compares {@link DimensionImmutable#compareTo(DimensionImmutable) resolution} 1st, if equal the bitsPerPixel. - * </p> + * </p> * {@inheritDoc} */ @Override @@ -72,7 +72,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> { if( 0 != rres ) { return rres; } - final int xbpp = ssz.getBitsPerPixel(); + final int xbpp = ssz.getBitsPerPixel(); if(bitsPerPixel > xbpp) { return 1; } else if(bitsPerPixel < xbpp) { @@ -80,7 +80,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> { } return 0; } - + /** * Checks whether two size objects are equal. Two instances * of <code>SurfaceSize</code> are equal if the two components diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java index c5e316364..a7bf536ec 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java +++ b/src/nativewindow/classes/jogamp/nativewindow/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,7 +51,7 @@ 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() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java index 52e9c8308..b3b5d2131 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.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 diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java index c9f830811..5fdbbf697 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java @@ -36,20 +36,20 @@ import com.jogamp.common.util.locks.RecursiveLock; /** * Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}. * <p> - * This is the last resort for unstable driver where multiple X11 display connections + * This is the last resort for unstable driver where multiple X11 display connections * to the same connection name are not treated thread safe within the GL/X11 driver. * </p> */ public class GlobalToolkitLock implements ToolkitLock { private static final RecursiveLock globalLock = LockFactory.createRecursiveLock(); private static GlobalToolkitLock singleton = new GlobalToolkitLock(); - + public static final GlobalToolkitLock getSingleton() { return singleton; } - + private GlobalToolkitLock() { } - + @Override public final void lock() { globalLock.lock(); @@ -61,17 +61,17 @@ public class GlobalToolkitLock implements ToolkitLock { if(TRACE_LOCK) { System.err.println("GlobalToolkitLock.unlock()"); } globalLock.unlock(); // implicit lock validation } - + @Override public final void validateLocked() throws RuntimeException { globalLock.validateLocked(); } - + @Override public final void dispose() { // nop } - + public String toString() { return "GlobalToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+globalLock.isOwner(Thread.currentThread())+", "+globalLock.toString()+"]"; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java index 1a106b1b9..36a25acfb 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.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.nativewindow; @@ -36,7 +36,7 @@ import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempJarCache; -public class NWJNILibLoader extends JNILibLoaderBase { +public class NWJNILibLoader extends JNILibLoaderBase { public static boolean loadNativeWindow(final String ossuffix) { return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index a3a66b7f1..e3f6ab5ca 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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 @@ -48,7 +48,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { public static ToolkitLock getNullToolkitLock() { return nullToolkitLock; } - + // This subclass of NativeWindowFactory handles the case of // NativeWindows being passed in protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException { @@ -69,7 +69,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { winObj.getClass().getName() + " is unsupported; expected " + "javax.media.nativewindow.NativeWindow or "+AWTNames.ComponentClass); } - + private Constructor<?> nativeWindowConstructor = null; private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) { @@ -93,7 +93,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { } nativeWindowConstructor = ReflectionUtil.getConstructor( - windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class }, + windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class }, getClass().getClassLoader()); } catch (Exception e) { throw new IllegalArgumentException(e); diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java index 5fc5fe376..d8ce98acb 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java @@ -38,7 +38,7 @@ import javax.media.nativewindow.ToolkitLock; public class NullToolkitLock implements ToolkitLock { /** Singleton via {@link NativeWindowFactoryImpl#getNullToolkitLock()} */ protected NullToolkitLock() { } - + @Override public final void lock() { if(TRACE_LOCK) { @@ -51,21 +51,21 @@ public class NullToolkitLock implements ToolkitLock { public final void unlock() { if(TRACE_LOCK) { System.err.println("NullToolkitLock.unlock()"); } } - + @Override public final void validateLocked() throws RuntimeException { if( NativeWindowFactory.requiresToolkitLock() ) { throw new RuntimeException("NullToolkitLock does not lock, but locking is required."); } } - + @Override public final void dispose() { // nop } - + public String toString() { return "NullToolkitLock[]"; } - + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java index 56e342793..8a1048c6f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java @@ -40,7 +40,7 @@ import javax.media.nativewindow.UpstreamSurfaceHook; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; -public abstract class ProxySurfaceImpl implements ProxySurface { +public abstract class ProxySurfaceImpl implements ProxySurface { private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper(); private AbstractGraphicsConfiguration config; // control access due to delegation private UpstreamSurfaceHook upstream; @@ -70,15 +70,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface { this.upstreamSurfaceHookLifecycleEnabled = true; if(ownsDevice) { addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE ); - } + } } @Override public NativeSurface getUpstreamSurface() { return null; } - + @Override public final UpstreamSurfaceHook getUpstreamSurfaceHook() { return upstream; } - + @Override public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook) { if(null == hook) { @@ -86,14 +86,14 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } upstream = hook; } - + @Override public final void enableUpstreamSurfaceHookLifecycle(boolean enable) { upstreamSurfaceHookLifecycleEnabled = enable; } - + @Override - public void createNotify() { + public void createNotify() { if(upstreamSurfaceHookLifecycleEnabled) { upstream.create(this); } @@ -113,15 +113,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } this.surfaceHandle_old = 0; } - - /** + + /** * Must be overridden by implementations allowing having a {@link UpstreamSurfaceHook} being passed. - * @see #destroyNotify() + * @see #destroyNotify() */ protected void invalidateImpl() { - throw new InternalError("UpstreamSurfaceHook given, but required method not implemented."); + throw new InternalError("UpstreamSurfaceHook given, but required method not implemented."); } - + protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() { return config; } @@ -140,7 +140,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { public final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) { config = cfg; } - + @Override public final int getScreenIndex() { return getGraphicsConfiguration().getScreen().getIndex(); @@ -151,7 +151,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { @Override public abstract void setSurfaceHandle(long surfaceHandle); - + @Override public final int getWidth() { return upstream.getWidth(this); @@ -252,7 +252,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { public final Thread getSurfaceLockOwner() { return surfaceLock.getOwner(); } - + public final StringBuilder getUpstreamOptionBits(StringBuilder sink) { if(null == sink) { sink = new StringBuilder(); @@ -284,21 +284,21 @@ public abstract class ProxySurfaceImpl implements ProxySurface { sink.append(" ]"); return sink; } - + @Override public final int getUpstreamOptionBits() { return implBitfield; } - + @Override public final boolean containsUpstreamOptionBits(int v) { return v == ( implBitfield & v ) ; } - + @Override public final void addUpstreamOptionBits(int v) { implBitfield |= v; } - + @Override public final void clearUpstreamOptionBits(int v) { implBitfield &= ~v; } - + @Override public StringBuilder toString(StringBuilder sink) { if(null == sink) { @@ -315,7 +315,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { // append("\n, upstreamSurface "+getUpstreamSurface()); return sink; } - + @Override public String toString() { StringBuilder msg = new StringBuilder(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java index 5b79de0b8..51dd58543 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java @@ -50,7 +50,7 @@ public class ResourceToolkitLock implements ToolkitLock { private ResourceToolkitLock() { this.lock = LockFactory.createRecursiveLock(); } - + @Override public final void lock() { lock.lock(); @@ -62,17 +62,17 @@ public class ResourceToolkitLock implements ToolkitLock { if(TRACE_LOCK) { System.err.println("ResourceToolkitLock.unlock()"); } lock.unlock(); // implicit lock validation } - + @Override public final void validateLocked() throws RuntimeException { lock.validateLocked(); } - + @Override public final void dispose() { // nop } - + public String toString() { return "ResourceToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]"; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java index 94d12e6fc..e20d3d138 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java @@ -54,8 +54,8 @@ public class SharedResourceToolkitLock implements ToolkitLock { handle2Lock = new LongObjectHashMap(); handle2Lock.setKeyNotFoundValue(null); } - - /** + + /** * @return number of unclosed EGL Displays.<br> */ public static int shutdown(boolean verbose) { @@ -70,7 +70,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { } return handle2Lock.size(); } - + public static void dumpOpenDisplayConnections() { System.err.println("SharedResourceToolkitLock: Open ResourceToolkitLock's: "+handle2Lock.size()); int i=0; @@ -79,7 +79,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { System.err.println("SharedResourceToolkitLock: Open["+i+"]: "+e.value); } } - + public static final SharedResourceToolkitLock get(long handle) { SharedResourceToolkitLock res; synchronized(handle2Lock) { @@ -106,8 +106,8 @@ public class SharedResourceToolkitLock implements ToolkitLock { this.handle = handle; this.refCount = 0; } - - + + @Override public final void lock() { lock.lock(); @@ -119,12 +119,12 @@ public class SharedResourceToolkitLock implements ToolkitLock { if(TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.unlock()"); } lock.unlock(); } - + @Override public final void validateLocked() throws RuntimeException { lock.validateLocked(); } - + @Override public final void dispose() { if(0 < refCount) { // volatile OK @@ -141,7 +141,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { if(DEBUG || TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.dispose() * NULL *: "+this); } } } - + public String toString() { return "SharedResourceToolkitLock[refCount "+refCount+", handle 0x"+Long.toHexString(handle)+", obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]"; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java index 4f68c6945..d11e240fa 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.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. @@ -39,27 +39,27 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener { // // Management Utils - // + // public int size() { return surfaceUpdatedListeners.size(); } public SurfaceUpdatedListener get(int i) { return surfaceUpdatedListeners.get(i); } - + // // Implementation of NativeSurface SurfaceUpdatedListener methods - // - + // + public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { addSurfaceUpdatedListener(-1, l); } - public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) + public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { if(l == null) { return; } synchronized(surfaceUpdatedListenersLock) { - if(0>index) { - index = surfaceUpdatedListeners.size(); + if(0>index) { + index = surfaceUpdatedListeners.size(); } surfaceUpdatedListeners.add(index, l); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java index ed23def8f..47b3e63fa 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java @@ -8,14 +8,14 @@ import javax.media.nativewindow.NativeWindowFactory; * Implementation requires to provide static methods: * <pre> public static void initSingleton() {} - + public static void shutdown() {} - + public static boolean requiresToolkitLock() {} - + public static boolean hasThreadingIssues() {} * </pre> - * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()}, + * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()}, * or {@link NativeWindowFactory#shutdown()} via reflection. * </p> */ @@ -25,23 +25,23 @@ public interface ToolkitProperties { * Called by {@link NativeWindowFactory#initSingleton()} */ // void initSingleton(); - - /** + + /** * Cleanup resources. * <p> * Called by {@link NativeWindowFactory#shutdown()} * </p> */ // void shutdown(); - + /** * Called by {@link NativeWindowFactory#initSingleton()} */ // boolean requiresToolkitLock(); - + /** * Called by {@link NativeWindowFactory#initSingleton()} */ - // boolean hasThreadingIssues(); - + // boolean hasThreadingIssues(); + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index c94f249a1..f622db8cc 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -37,7 +37,7 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; /** * Generic Surface implementation which wraps an existing window handle. - * + * * @see ProxySurface */ public class WrappedSurface extends ProxySurfaceImpl { @@ -46,7 +46,7 @@ public class WrappedSurface extends ProxySurfaceImpl { /** * Utilizes a {@link UpstreamSurfaceHook.MutableSize} to hold the size information, * which is being passed to the {@link ProxySurface} instance. - * + * * @param cfg the {@link AbstractGraphicsConfiguration} to be used * @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined * @param initialWidth @@ -59,7 +59,7 @@ public class WrappedSurface extends ProxySurfaceImpl { super(cfg, new UpstreamSurfaceHookMutableSize(initialWidth, initialHeight), ownsDevice); surfaceHandle=handle; } - + /** * @param cfg the {@link AbstractGraphicsConfiguration} to be used * @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined @@ -74,7 +74,7 @@ public class WrappedSurface extends ProxySurfaceImpl { } @Override - protected void invalidateImpl() { + protected void invalidateImpl() { surfaceHandle = 0; } @@ -87,7 +87,7 @@ public class WrappedSurface extends ProxySurfaceImpl { public final void setSurfaceHandle(long surfaceHandle) { this.surfaceHandle=surfaceHandle; } - + @Override protected final int lockSurfaceImpl() { return LOCK_SUCCESS; diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index 23c48d20e..0fa5006cc 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -71,19 +71,19 @@ public class AWTMisc { } return (Container) c; } - + /** * Return insets of the component w/o traversing up to parent, * i.e. trying Window and JComponent. * <p> - * Exception is JRootPane. + * Exception is JRootPane. * Return it's parent's Window component's insets if available, * otherwise return JRootPane's insets.<br> - * This is due to <i>experience</i> that <i>some</i> JRootPane's + * This is due to <i>experience</i> that <i>some</i> JRootPane's * do not expose valid insets value. * </p> * @param topLevelOnly if true only returns insets of top-level components, i.e. Window and JRootPanel, - * otherwise for JComponent as well. + * otherwise for JComponent as well. */ public static Insets getInsets(Component c, boolean topLevelOnly) { if( c instanceof Window ) { @@ -108,7 +108,7 @@ public class AWTMisc { */ public void run(Component c); } - + public static int performAction(Container c, Class<?> cType, ComponentAction action) { int count = 0; final int cc = c.getComponentCount(); @@ -128,18 +128,18 @@ public class AWTMisc { } return count; } - + /** * Traverse to the next forward or backward component using the * container's FocusTraversalPolicy. - * - * @param comp the assumed current focuse component + * + * @param comp the assumed current focuse component * @param forward if true, returns the next focus component, otherwise the previous one. * @return */ public static Component getNextFocus(Component comp, boolean forward) { Container focusContainer = comp.getFocusCycleRootAncestor(); - while ( focusContainer != null && + while ( focusContainer != null && ( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) ) { comp = focusContainer; @@ -155,7 +155,7 @@ public class AWTMisc { } return next; } - + /** * Issue this when your non AWT toolkit gains focus to clear AWT menu path */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java index f579da217..815facbee 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -47,7 +47,7 @@ import java.awt.Toolkit; import java.security.AccessController; import java.security.PrivilegedAction; -public class JAWTJNILibLoader extends NWJNILibLoader { +public class JAWTJNILibLoader extends NWJNILibLoader { static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { @@ -55,7 +55,7 @@ public class JAWTJNILibLoader extends NWJNILibLoader { // a Dialog with "awt.dll not found" might pop up. // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4481947. Toolkit.getDefaultToolkit(); - + // Must pre-load JAWT on all non-Mac platforms to // ensure references from jogl_awt shared object // will succeed since JAWT shared object isn't in @@ -74,9 +74,9 @@ public class JAWTJNILibLoader extends NWJNILibLoader { } }); } - + public static void initSingleton() { - // just exist to ensure static init has been run + // just exist to ensure static init has been run } - + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 844b17469..32946fe2d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.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. @@ -63,13 +63,13 @@ public class JAWTUtil { /** OSX JAWT version option to use CALayer */ public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000; - + /** OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended) */ public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4); - + /** OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7 */ public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = Platform.Version17; - + // See whether we're running in headless mode private static final boolean headlessMode; private static final JAWT jawtLockObject; @@ -81,27 +81,27 @@ public class JAWTUtil { private static final Method sunToolkitAWTLockMethod; private static final Method sunToolkitAWTUnlockMethod; private static final boolean hasSunToolkitAWTLock; - + private static final RecursiveLock jawtLock; private static final ToolkitLock jawtToolkitLock; private static class PrivilegedDataBlob1 { PrivilegedDataBlob1() { ok = false; - } + } Method sunToolkitAWTLockMethod; Method sunToolkitAWTUnlockMethod; boolean ok; } - + /** * Returns true if this platform's JAWT implementation supports offscreen layer. */ public static boolean isOffscreenLayerSupported() { return Platform.OS_TYPE == Platform.OSType.MACOS && - Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0; + Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0; } - + /** * Returns true if this platform's JAWT implementation requires using offscreen layer. */ @@ -109,8 +109,8 @@ public class JAWTUtil { return Platform.OS_TYPE == Platform.OSType.MACOS && Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0; } - - /** + + /** * CALayer size needs to be set using the AWT component size. * <p> * AWT's super-calayer, i.e. the AWT's own component CALayer, @@ -120,13 +120,13 @@ public class JAWTUtil { * <p> * As of today, this flag is enabled for all known AWT versions. * </p> - * <p> + * <p> * Sync w/ NativeWindowProtocols.h - * </p> + * </p> */ public static final int JAWT_OSX_CALAYER_QUIRK_SIZE = 1 << 0; - - /** + + /** * CALayer position needs to be set to zero. * <p> * AWT's super-calayer, i.e. the AWT's own component CALayer, @@ -137,19 +137,19 @@ public class JAWTUtil { * </p> * <p> * Further more a re-layout seems to be required in this case, - * i.e. a programmatic forced resize +1 and it's inverted resize -1. + * i.e. a programmatic forced resize +1 and it's inverted resize -1. * </p> * <p> - * This flag is enabled w/ AWT < 1.7.0_40. + * This flag is enabled w/ AWT < 1.7.0_40. * </p> - * <p> + * <p> * Sync w/ NativeWindowProtocols.h - * </p> + * </p> */ public static final int JAWT_OSX_CALAYER_QUIRK_POSITION = 1 << 1; - - /** - * CALayer position needs to be derived from AWT position + + /** + * CALayer position needs to be derived from AWT position * in relation to super CALayer. * <p> * AWT's super-calayer, i.e. the AWT top-container's CALayer, @@ -165,7 +165,7 @@ public class JAWTUtil { * </p> * <p> * The super-calayer lies within the AWT top-container client space (content). - * </p> + * </p> * <p> * Component's location in super-calayer: * <pre> @@ -188,12 +188,12 @@ public class JAWTUtil { * <p> * As of today, this flag is enabled for w/ AWT >= 1.7.0_40. * </p> - * <p> + * <p> * Sync w/ NativeWindowProtocols.h - * </p> + * </p> */ public static final int JAWT_OSX_CALAYER_QUIRK_LAYOUT = 1 << 2; - + /** * Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs. * <p> @@ -211,12 +211,12 @@ public class JAWTUtil { */ public static int getOSXCALayerQuirks() { int res = 0; - if( Platform.OS_TYPE == Platform.OSType.MACOS && + if( Platform.OS_TYPE == Platform.OSType.MACOS && Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) { - + /** Knowing impl. all expose the SIZE bug */ res |= JAWT_OSX_CALAYER_QUIRK_SIZE; - + final int c = Platform.JAVA_VERSION_NUMBER.compareTo(Platform.Version17); if( c < 0 || c == 0 && Platform.JAVA_VERSION_UPDATE < 40 ) { res |= JAWT_OSX_CALAYER_QUIRK_POSITION; @@ -226,20 +226,20 @@ public class JAWTUtil { } return res; } - + /** * @param useOffscreenLayerIfAvailable * @return */ public static JAWT getJAWT(boolean useOffscreenLayerIfAvailable) { - final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4; + final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4; JAWT jawt = JAWT.create(); - + // default queries boolean tryOffscreenLayer; boolean tryOnscreen; int jawt_version_flags_offscreen = jawt_version_flags; - + if(isOffscreenLayerRequired()) { if(Platform.OS_TYPE == Platform.OSType.MACOS) { if(Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) { @@ -263,11 +263,11 @@ public class JAWTUtil { } else { tryOffscreenLayer = false; tryOnscreen = true; - } + } if(DEBUG) { System.err.println("JAWTUtil.getJAWT(tryOffscreenLayer "+tryOffscreenLayer+", tryOnscreen "+tryOnscreen+")"); } - + StringBuilder errsb = new StringBuilder(); if(tryOffscreenLayer) { errsb.append("Offscreen 0x").append(Integer.toHexString(jawt_version_flags_offscreen)); @@ -282,15 +282,15 @@ public class JAWTUtil { errsb.append("Onscreen 0x").append(Integer.toHexString(jawt_version_flags)); if( JAWT.getJAWT(jawt, jawt_version_flags) ) { return jawt; - } + } } throw new RuntimeException("Unable to initialize JAWT, trials: "+errsb.toString()); } - + public static boolean isJAWTUsingOffscreenLayer(JAWT jawt) { return 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER ); } - + static { if(DEBUG) { System.err.println("JAWTUtil initialization (JAWT/JNI/..."); @@ -319,10 +319,10 @@ public class JAWTUtil { isQueueFlusherThread = m; j2dExist = ok; - PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() { + PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { PrivilegedDataBlob1 d = new PrivilegedDataBlob1(); - try { + try { final Class<?> sunToolkitClass = Class.forName("sun.awt.SunToolkit"); d.sunToolkitAWTLockMethod = sunToolkitClass.getDeclaredMethod("awtLock", new Class[]{}); d.sunToolkitAWTLockMethod.setAccessible(true); @@ -337,7 +337,7 @@ public class JAWTUtil { }); sunToolkitAWTLockMethod = pdb1.sunToolkitAWTLockMethod; sunToolkitAWTUnlockMethod = pdb1.sunToolkitAWTUnlockMethod; - + boolean _hasSunToolkitAWTLock = false; if ( pdb1.ok ) { try { @@ -351,10 +351,10 @@ public class JAWTUtil { // hasSunToolkitAWTLock = false; jawtLock = LockFactory.createRecursiveLock(); - jawtToolkitLock = new ToolkitLock() { + jawtToolkitLock = new ToolkitLock() { public final void lock() { JAWTUtil.lockToolkit(); - } + } public final void unlock() { JAWTUtil.unlockToolkit(); } @@ -411,11 +411,11 @@ public class JAWTUtil { public static void initSingleton() { // just exist to ensure static init has been run } - + /** * Called by {@link NativeWindowFactory#shutdown()} */ - public static void shutdown() { + public static void shutdown() { } public static boolean hasJava2D() { @@ -443,7 +443,7 @@ public class JAWTUtil { * which just uses AWT's global ReentrantLock. * </p> * <p> - * AWT locking is wrapped through a recursive lock object. + * AWT locking is wrapped through a recursive lock object. * </p> */ public static void lockToolkit() throws NativeWindowException { @@ -471,11 +471,11 @@ public class JAWTUtil { * which just uses AWT's global ReentrantLock. * </p> * <p> - * AWT unlocking is wrapped through a recursive lock object. + * AWT unlocking is wrapped through a recursive lock object. * </p> */ public static void unlockToolkit() { - jawtLock.validateLocked(); + jawtLock.validateLocked(); if(ToolkitLock.TRACE_LOCK) { System.err.println("JAWTUtil-ToolkitLock.unlock(): "+jawtLock); } if( 1 == jawtLock.getHoldCount() ) { if(!headlessMode && !isJava2DQueueFlusherThread()) { @@ -492,14 +492,14 @@ public class JAWTUtil { } jawtLock.unlock(); } - + public static final void validateLocked() throws RuntimeException { jawtLock.validateLocked(); - } + } public static ToolkitLock getJAWTToolkitLock() { return jawtToolkitLock; } - + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java index 40d7b8032..4f12d1925 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index b712f6a1a..87e3d3dd8 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.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. */ @@ -102,7 +102,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } windowHandle=0; } - + @Override protected void attachSurfaceLayerImpl(final long layerHandle) { OSXUtil.RunOnMainThread(false, new Runnable() { @@ -119,7 +119,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { if( null != outterInsets ) { p1.translate(-outterInsets.left, -outterInsets.top); } - + if( DEBUG ) { final java.awt.Point pA0 = component.getLocationOnScreen(); final Point pA1 = new Point(pA0.x, pA0.y); @@ -133,7 +133,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, p1.getX(), p1.getY(), getWidth(), getHeight(), JAWTUtil.getOSXCALayerQuirks()); } } ); } - + @Override protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) { final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks(); @@ -149,7 +149,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { if( null != outterInsets ) { p1.translate(-outterInsets.left, -outterInsets.top); } - + if( DEBUG ) { final java.awt.Point pA0 = component.getLocationOnScreen(); final Point pA1 = new Point(pA0.x, pA0.y); @@ -163,7 +163,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks); } - + @Override protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify) { OSXUtil.RunOnMainThread(false, new Runnable() { @@ -172,17 +172,17 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { OSXUtil.RemoveCASublayer(rootSurfaceLayer, layerHandle); } } ); } - + @Override public final long getWindowHandle() { return windowHandle; } - + @Override public final long getSurfaceHandle() { return offscreenSurfaceDrawableSet ? offscreenSurfaceDrawable : drawable /* super.getSurfaceHandle() */ ; } - + public void setSurfaceHandle(long surfaceHandle) { if( !isOffscreenLayerSurfaceEnabled() ) { throw new java.lang.UnsupportedOperationException("Not using CALAYER"); @@ -198,7 +198,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { // use offscreen if supported and [ applet or requested ] return JAWTUtil.getJAWT(getShallUseOffscreenLayer() || isApplet()); } - + protected int lockSurfaceImpl() throws NativeWindowException { int ret = NativeWindow.LOCK_SURFACE_NOT_READY; ds = getJAWT().GetDrawingSurface(component); @@ -247,7 +247,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { return NativeWindow.LOCK_SURFACE_NOT_READY; } drawable = macosxdsi.getCocoaViewRef(); - + if (drawable == 0) { unlockSurfaceImpl(); return NativeWindow.LOCK_SURFACE_NOT_READY; @@ -259,9 +259,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { /** * Only create a fake invisible NSWindow for the drawable handle * to please frameworks requiring such (eg. NEWT). - * - * The actual surface/ca-layer shall be created/attached - * by the upper framework (JOGL) since they require more information. + * + * The actual surface/ca-layer shall be created/attached + * by the upper framework (JOGL) since they require more information. */ String errMsg = null; if(0 == drawable) { @@ -286,10 +286,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { OSXUtil.RunOnMainThread(false, new Runnable() { public void run() { String errMsg = null; - if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) { + if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) { rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight()); if(0 == rootSurfaceLayer) { - errMsg = "Could not create root CALayer"; + errMsg = "Could not create root CALayer"; } else { try { SetJAWTRootSurfaceLayer0(jawtSurfaceLayersHandle, rootSurfaceLayer); @@ -318,10 +318,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } ret = NativeWindow.LOCK_SUCCESS; } - + return ret; } - + protected void unlockSurfaceImpl() throws NativeWindowException { if(null!=ds) { if (null!=dsi) { @@ -340,7 +340,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { System.err.println("MaxOSXJAWTWindow: 0x"+Integer.toHexString(this.hashCode())+" - thread: "+Thread.currentThread().getName()); dumpJAWTInfo(); } - + /** * {@inheritDoc} * <p> @@ -350,9 +350,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { * .. * ds = getJAWT().GetDrawingSurface(component); * due to a SIGSEGV. - * + * * Hence we have some threading / sync issues with the native JAWT implementation. - * </p> + * </p> */ @Override public Point getLocationOnScreen(Point storage) { @@ -361,36 +361,36 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } getLocationOnScreenNonBlocking(storage, component); return storage; - } + } protected Point getLocationOnScreenNativeImpl(final int x0, final int y0) { return null; } - - + + private static native long GetJAWTSurfaceLayersHandle0(Buffer jawtDrawingSurfaceInfoBuffer); - - /** + + /** * Set the given root CALayer in the JAWT surface - */ + */ private static native void SetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer); - - /** + + /** * Unset the given root CALayer in the JAWT surface, passing the NIO DrawingSurfaceInfo buffer - */ + */ private static native void UnsetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer); - + // Variables for lockSurface/unlockSurface private JAWT_DrawingSurface ds; private boolean dsLocked; private JAWT_DrawingSurfaceInfo dsi; private long jawtSurfaceLayersHandle; - + private JAWT_MacOSXDrawingSurfaceInfo macosxdsi; - + private volatile long rootSurfaceLayer = 0; // attached to the JAWT_SurfaceLayer - + private long windowHandle = 0; private long offscreenSurfaceDrawable = 0; private boolean offscreenSurfaceDrawableSet = false; - + // Workaround for instance of 4796548 private boolean firstLock = true; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java index 74dabb67f..876531151 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.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. */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index 905a313d5..64e177155 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.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. */ @@ -67,7 +67,7 @@ public class WindowsJAWTWindow extends JAWTWindow { protected JAWT fetchJAWTImpl() throws NativeWindowException { return JAWTUtil.getJAWT(false); // no offscreen } - + protected int lockSurfaceImpl() throws NativeWindowException { int ret = NativeWindow.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index 2e5dc7fb5..b08a7d83a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.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. @@ -62,7 +62,7 @@ public class X11JAWTWindow extends JAWTWindow { protected JAWT fetchJAWTImpl() throws NativeWindowException { return JAWTUtil.getJAWT(false); // no offscreen } - + protected int lockSurfaceImpl() throws NativeWindowException { int ret = NativeWindow.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); @@ -123,11 +123,11 @@ public class X11JAWTWindow extends JAWTWindow { // surface is locked and hence the device return X11Lib.GetRelativeLocation(getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y); } - + // Variables for lockSurface/unlockSurface private JAWT_DrawingSurface ds; private boolean dsLocked; private JAWT_DrawingSurfaceInfo dsi; private JAWT_X11DrawingSurfaceInfo x11dsi; - + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java index 27e0a5e50..f1104d02f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.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. */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java index de3206c0c..b71af1042 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java @@ -9,12 +9,12 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { long nsWindow; - + /** - * @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 */ @@ -22,7 +22,7 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize super(width, height); nsWindow = 0; } - + @Override public final void create(ProxySurface s) { if(0 == nsWindow && 0 == s.getSurfaceHandle()) { @@ -35,11 +35,11 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize throw new NativeWindowException("Error NS view 0"); } s.setSurfaceHandle(nsView); - s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); } - + @Override public final void destroy(ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index 0d498fa54..004a91a42 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -41,9 +41,9 @@ import jogamp.nativewindow.NWJNILibLoader; import jogamp.nativewindow.ToolkitProperties; public class OSXUtil implements ToolkitProperties { - private static boolean isInit = false; + private static boolean isInit = false; private static final boolean DEBUG = Debug.debug("OSXUtil"); - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties @@ -56,10 +56,10 @@ public class OSXUtil implements ToolkitProperties { if(!NWJNILibLoader.loadNativeWindow("macosx")) { throw new NativeWindowException("NativeWindow MacOSX native library load error."); } - + if( !initIDs0() ) { throw new NativeWindowException("MacOSX: Could not initialized native stub"); - } + } isInit = true; } } @@ -69,27 +69,27 @@ public class OSXUtil implements ToolkitProperties { * @see ToolkitProperties */ public static void shutdown() { } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static boolean requiresToolkitLock() { return false; } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static final boolean hasThreadingIssues() { return false; } - + public static boolean isNSView(long object) { return 0 != object ? isNSView0(object) : false; } - + public static boolean isNSWindow(long object) { return 0 != object ? isNSWindow0(object) : false; } - + /** * In case the <code>windowOrView</code> is top-level, * you shall set <code>topLevel</code> to true where @@ -108,7 +108,7 @@ public class OSXUtil implements ToolkitProperties { * @param src_y * @return the client position */ - public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) { + public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) { final Point los = (Point) GetLocationOnScreen0(windowOrView, src_x, src_y); if(topLevel) { // top-level position -> client window position @@ -117,11 +117,11 @@ public class OSXUtil implements ToolkitProperties { } return los; } - + public static Insets GetInsets(long windowOrView) { return (Insets) GetInsets0(windowOrView); } - + public static long CreateNSWindow(int x, int y, int width, int height) { return CreateNSWindow0(x, y, width, height); } @@ -134,11 +134,11 @@ public class OSXUtil implements ToolkitProperties { public static long GetNSWindow(long nsView) { return GetNSWindow0(nsView); } - - /** + + /** * Create a CALayer suitable to act as a root CALayer. * @see #DestroyCALayer(long) - * @see #AddCASublayer(long, long) + * @see #AddCASublayer(long, long) */ public static long CreateCALayer(final int width, final int height) { final long l = CreateCALayer0(width, height); @@ -147,8 +147,8 @@ public class OSXUtil implements ToolkitProperties { } return l; } - - /** + + /** * Attach a sub CALayer to the root CALayer * <p> * Method will trigger a <code>display</code> @@ -156,7 +156,7 @@ public class OSXUtil implements ToolkitProperties { * </p> * <p> * Hence it is important that related resources are not locked <i>if</i> - * they will be used for creation. + * they will be used for creation. * </p> * @param caLayerQuirks TODO * @see #CreateCALayer(int, int) @@ -171,18 +171,18 @@ public class OSXUtil implements ToolkitProperties { } AddCASublayer0(rootCALayer, subCALayer, x, y, width, height, caLayerQuirks); } - - /** + + /** * Fix root and sub CALayer position to 0/0 and size * <p> * If the sub CALayer implements the Objective-C NativeWindow protocol NWDedicatedSize (e.g. JOGL's MyNSOpenGLLayer), - * the dedicated size is passed to the layer, which propagates it appropriately. + * the dedicated size is passed to the layer, which propagates it appropriately. * </p> * <p> * On OSX/Java7 our root CALayer's frame position and size gets corrupted by its NSView, * hence we have created the NWDedicatedSize protocol. * </p> - * + * * @param rootCALayer the root surface layer, maybe null. * @param subCALayer the client surface layer, maybe null. * @param visible TODO @@ -196,8 +196,8 @@ public class OSXUtil implements ToolkitProperties { } FixCALayerLayout0(rootCALayer, subCALayer, visible, x, y, width, height, caLayerQuirks); } - - /** + + /** * Detach a sub CALayer from the root CALayer. */ public static void RemoveCASublayer(final long rootCALayer, final long subCALayer) { @@ -209,11 +209,11 @@ public class OSXUtil implements ToolkitProperties { } RemoveCASublayer0(rootCALayer, subCALayer); } - - /** + + /** * Destroy a CALayer. * @see #CreateCALayer(int, int) - */ + */ public static void DestroyCALayer(final long caLayer) { if(0==caLayer) { throw new IllegalArgumentException("caLayer 0x"+Long.toHexString(caLayer)); @@ -223,13 +223,13 @@ public class OSXUtil implements ToolkitProperties { } DestroyCALayer0(caLayer); } - + /** * Run on OSX UI main thread. - * <p> + * <p> * 'waitUntilDone' is implemented on Java site via lock/wait on {@link RunnableTask} to not freeze OSX main thread. * </p> - * + * * @param waitUntilDone * @param runnable */ @@ -238,10 +238,10 @@ public class OSXUtil implements ToolkitProperties { runnable.run(); // don't leave the JVM } else { // Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread, - // otherwise we may freeze the OSX main thread. + // otherwise we may freeze the OSX main thread. Throwable throwable = null; final Object sync = new Object(); - final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err ); + final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err ); synchronized(sync) { RunOnMainThread0(rt); if( waitUntilDone ) { @@ -260,7 +260,7 @@ public class OSXUtil implements ToolkitProperties { } } } - + /** * Run later on .. * @param onMain if true, run on main-thread, otherwise on the current OSX thread. @@ -270,20 +270,20 @@ public class OSXUtil implements ToolkitProperties { public static void RunLater(boolean onMain, Runnable runnable, int delay) { RunLater0(onMain, new RunnableTask( runnable, null, true, System.err ), delay); } - + private static Runnable _nop = new Runnable() { public void run() {}; }; - - /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an <i>NOP</i> runnable, while waiting until done. */ + + /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an <i>NOP</i> runnable, while waiting until done. */ public static void WaitUntilFinish() { RunOnMainThread(true, _nop); } - + /** * Run on OSX UI main thread. - * <p> + * <p> * 'waitUntilDone' is implemented on Java site via lock/wait on {@link FunctionTask} to not freeze OSX main thread. * </p> - * + * * @param waitUntilDone * @param func */ @@ -292,10 +292,10 @@ public class OSXUtil implements ToolkitProperties { return func.eval(args); // don't leave the JVM } else { // Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread, - // otherwise we may freeze the OSX main thread. + // otherwise we may freeze the OSX main thread. Throwable throwable = null; final Object sync = new Object(); - final FunctionTask<R,A> rt = new FunctionTask<R,A>( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err ); + final FunctionTask<R,A> rt = new FunctionTask<R,A>( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err ); synchronized(sync) { rt.setArgs(args); RunOnMainThread0(rt); @@ -316,20 +316,20 @@ public class OSXUtil implements ToolkitProperties { return rt.getResult(); } } - + public static boolean IsMainThread() { return IsMainThread0(); } - + /** Returns the screen refresh rate in Hz. If unavailable, returns 60Hz. */ public static int GetScreenRefreshRate(int scrn_idx) { return GetScreenRefreshRate0(scrn_idx); } - + /*** private static boolean isAWTEDTMainThreadInit = false; private static boolean isAWTEDTMainThread; - + public synchronized static boolean isAWTEDTMainThread() { if(!isAWTEDTMainThreadInit) { isAWTEDTMainThreadInit = true; @@ -343,10 +343,10 @@ public class OSXUtil implements ToolkitProperties { } else { isAWTEDTMainThread = false; } - } + } return isAWTEDTMainThread; } */ - + private static native boolean initIDs0(); private static native boolean isNSView0(long object); private static native boolean isNSWindow0(long object); diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java index aa5f3dac5..e5de43c0a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java @@ -9,31 +9,31 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; public class GDIDummyUpstreamSurfaceHook 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 GDIDummyUpstreamSurfaceHook(int width, int height) { super(width, height); } - + @Override public final void create(ProxySurface s) { final GDISurface ms = (GDISurface)s; - if(0 == ms.getWindowHandle()) { + if(0 == ms.getWindowHandle()) { final long windowHandle = GDIUtil.CreateDummyWindow(0, 0, 64, 64); if(0 == windowHandle) { throw new NativeWindowException("Error windowHandle 0, werr: "+GDI.GetLastError()); - } + } ms.setWindowHandle(windowHandle); - ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); } - + @Override public final void destroy(ProxySurface s) { final GDISurface ms = (GDISurface)s; @@ -46,5 +46,5 @@ public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize ms.setWindowHandle(0); ms.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } - } + } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java index cc9c9853b..3e07b2a9e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java @@ -43,7 +43,7 @@ import jogamp.nativewindow.windows.GDI; * allowing the use of HDC via lockSurface()/unlockSurface() protocol. * The latter will get and release the HDC. * The size via getWidth()/getHeight() is invalid. - * + * * @see ProxySurface */ public class GDISurface extends ProxySurfaceImpl { @@ -65,20 +65,20 @@ public class GDISurface extends ProxySurfaceImpl { } @Override - protected void invalidateImpl() { + protected void invalidateImpl() { if(0 != surfaceHandle) { throw new NativeWindowException("didn't release surface Handle: "+this); } windowHandle = 0; // surfaceHandle = 0; } - + /** * {@inheritDoc} * <p> - * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived + * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived * from it at {@link #lockSurface()}. - * </p> + * </p> */ @Override public final void setSurfaceHandle(long surfaceHandle) { @@ -86,7 +86,7 @@ public class GDISurface extends ProxySurfaceImpl { } /** - * Sets the window handle (HWND). + * Sets the window handle (HWND). */ public final void setWindowHandle(long windowHandle) { this.windowHandle = windowHandle; @@ -118,7 +118,7 @@ public class GDISurface extends ProxySurfaceImpl { final protected void unlockSurfaceImpl() { if (0 != surfaceHandle) { if(0 == GDI.ReleaseDC(windowHandle, surfaceHandle)) { - throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName()); + throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName()); } surfaceHandle=0; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java index 00741a328..db61b1efd 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java @@ -37,11 +37,11 @@ import jogamp.nativewindow.ToolkitProperties; public class GDIUtil implements ToolkitProperties { private static final boolean DEBUG = Debug.debug("GDIUtil"); - + private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ; private static RegisteredClassFactory dummyWindowClassFactory; private static boolean isInit = false; - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties @@ -59,42 +59,42 @@ public class GDIUtil implements ToolkitProperties { if( !initIDs0() ) { throw new NativeWindowException("GDI: Could not initialized native stub"); } - dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0()); + dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0()); isInit = true; } } } } - + /** * Called by {@link NativeWindowFactory#shutdown()} * @see ToolkitProperties */ - public static void shutdown() { + public static void shutdown() { } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static boolean requiresToolkitLock() { return false; } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static final boolean hasThreadingIssues() { return false; } - + private static RegisteredClass dummyWindowClass = null; private static Object dummyWindowSync = new Object(); - + public static long CreateDummyWindow(int x, int y, int width, int height) { synchronized(dummyWindowSync) { dummyWindowClass = dummyWindowClassFactory.getSharedClass(); return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height); } } - + public static boolean DestroyDummyWindow(long hwnd) { boolean res; synchronized(dummyWindowSync) { @@ -106,27 +106,27 @@ public class GDIUtil implements ToolkitProperties { } return res; } - + public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) { return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y); } - + public static boolean IsUndecorated(long win) { return IsUndecorated0(win); } - + public static boolean IsChild(long win) { return IsChild0(win); } - + public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc); public static native boolean DestroyWindowClass(long hInstance, String className); - + private static native boolean initIDs0(); - private static native long getDummyWndProc0(); + private static native long getDummyWndProc0(); private static native Object GetRelativeLocation0(long src_win, long dest_win, int src_x, int src_y); private static native boolean IsChild0(long win); private static native boolean IsUndecorated0(long win); - - static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height); + + static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java index 949f5d06d..976693e3a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java @@ -39,7 +39,7 @@ public class RegisteredClass { /** Application handle, same as {@link RegisteredClassFactory#getHInstance()}. */ public final long getHInstance() { return hInstance; } - + /** Unique Window Class Name */ public final String getName() { return className; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java index 0280b0df7..e033a9f66 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java @@ -34,9 +34,9 @@ import javax.media.nativewindow.NativeWindowException; public class RegisteredClassFactory { private static final boolean DEBUG = Debug.debug("RegisteredClass"); - private static final ArrayList<RegisteredClassFactory> registeredFactories; + private static final ArrayList<RegisteredClassFactory> registeredFactories; private static final long hInstance; - + static { hInstance = GDI.GetApplicationHandle(); if( 0 == hInstance ) { @@ -44,7 +44,7 @@ public class RegisteredClassFactory { } registeredFactories = new ArrayList<RegisteredClassFactory>(); } - + private String classBaseName; private long wndProc; @@ -52,9 +52,9 @@ public class RegisteredClassFactory { private int classIter = 0; private int sharedRefCount = 0; private final Object sync = new Object(); - + /** - * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}. + * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}. */ public static void shutdownSharedClasses() { synchronized(registeredFactories) { @@ -65,7 +65,7 @@ public class RegisteredClassFactory { GDIUtil.DestroyWindowClass(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName()); rcf.sharedClass = null; rcf.sharedRefCount = 0; - rcf.classIter = 0; + rcf.classIter = 0; if(DEBUG) { System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+" shutdownSharedClasses : "+rcf.sharedClass); } @@ -74,7 +74,7 @@ public class RegisteredClassFactory { } } } - + /** Application handle. */ public static long getHInstance() { return hInstance; } @@ -94,7 +94,7 @@ public class RegisteredClassFactory { } String clazzName = null; boolean registered = false; - final int classIterMark = classIter - 1; + final int classIterMark = classIter - 1; while ( !registered && classIterMark != classIter ) { // Retry with next clazz name, this could happen if more than one JVM is running clazzName = classBaseName + classIter; diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java index 827862002..2c8ef642c 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java @@ -14,17 +14,17 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11DummyUpstreamSurfaceHook 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 X11DummyUpstreamSurfaceHook(int width, int height) { super(width, height); } - + @Override public final void create(ProxySurface s) { final X11GraphicsConfiguration cfg = (X11GraphicsConfiguration) s.getGraphicsConfiguration(); @@ -42,14 +42,14 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize throw new NativeWindowException("Creating dummy window failed w/ "+cfg); } s.setSurfaceHandle(windowHandle); - s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); + s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE); } finally { device.unlock(); } } - + @Override public final void destroy(ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { @@ -59,7 +59,7 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } device.lock(); try { - X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle()); + X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle()); s.setSurfaceHandle(0); s.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ); } finally { diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java index b11dd1df1..d6e7b5970 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.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 @@ -47,10 +47,10 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactory { public static void registerFactory() { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class, new X11GraphicsConfigurationFactory()); - } + } private X11GraphicsConfigurationFactory() { } - + protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID) throws IllegalArgumentException, NativeWindowException { @@ -109,7 +109,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor XVisualInfo best=null; int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits(); for (int i = 0; vinfos!=null && i < num[0]; i++) { - if ( best == null || + if ( best == null || best.getDepth() < vinfos[i].getDepth() ) { best = vinfos[i]; diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 78e432b7f..6431fb3f5 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.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 @@ -54,16 +54,16 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; */ public class X11Util implements ToolkitProperties { public static final boolean DEBUG = Debug.debug("X11Util"); - - /** + + /** * See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515 - * <p> + * <p> * It is observed that ATI X11 drivers, eg. - * <ul> + * <ul> * <li>fglrx 8.78.6,</li> * <li>fglrx 11.08/8.881 and </li> * <li>fglrx 11.11/8.911</li> - * </ul> + * </ul> * are quite sensitive to multiple Display connections. * </p> * <p> @@ -81,11 +81,11 @@ public class X11Util implements ToolkitProperties { * </p> * <p> * With ATI X11 drivers all connections must be closed at JVM shutdown, - * otherwise a SIGSEGV (after JVM safepoint) will be caused. + * otherwise a SIGSEGV (after JVM safepoint) will be caused. * </p> */ public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = !Debug.isPropertyDefined("nativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG", true); - + /** See {@link #ATI_HAS_XCLOSEDISPLAY_BUG}. */ public static final boolean HAS_XCLOSEDISPLAY_BUG = Debug.isPropertyDefined("nativewindow.debug.X11Util.HAS_XCLOSEDISPLAY_BUG", true); @@ -105,7 +105,7 @@ public class X11Util implements ToolkitProperties { private static final Object setX11ErrorHandlerLock = new Object(); private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI"; private static final String X11_EXTENSION_ATIFGLEXTENSION = "ATIFGLEXTENSION"; - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties @@ -121,15 +121,15 @@ public class X11Util implements ToolkitProperties { if(!NWJNILibLoader.loadNativeWindow("x11")) { throw new NativeWindowException("NativeWindow X11 native library load error."); } - + final boolean isInitOK = initialize0( XERROR_STACKDUMP ); - + final boolean hasX11_EXTENSION_ATIFGLRXDRI, hasX11_EXTENSION_ATIFGLEXTENSION; final long dpy = X11Lib.XOpenDisplay(PropertyAccess.getProperty("nativewindow.x11.display.default", true)); if(0 != dpy) { if(XSYNC_ENABLED) { X11Lib.XSynchronize(dpy, true); - } + } try { nullDisplayName = X11Lib.XDisplayString(dpy); hasX11_EXTENSION_ATIFGLRXDRI = X11Lib.QueryExtension(dpy, X11_EXTENSION_ATIFGLRXDRI); @@ -147,7 +147,7 @@ public class X11Util implements ToolkitProperties { if ( !markAllDisplaysUnclosable ) { markAllDisplaysUnclosable = ( ATI_HAS_XCLOSEDISPLAY_BUG && isATIFGLRX ) || HAS_XCLOSEDISPLAY_BUG; } - + if(DEBUG) { System.err.println("X11Util.initSingleton(): OK "+isInitOK+"]"+ ",\n\t X11 Display(NULL) <"+nullDisplayName+">"+ @@ -164,17 +164,17 @@ public class X11Util implements ToolkitProperties { } } } - + // not exactly thread safe, but good enough for our purpose, // which is to tag a NamedDisplay uncloseable after creation. - private static Object globalLock = new Object(); + private static Object globalLock = new Object(); private static LongObjectHashMap openDisplayMap = new LongObjectHashMap(); // handle -> name private static List<NamedDisplay> openDisplayList = new ArrayList<NamedDisplay>(); // open, no close attempt private static List<NamedDisplay> reusableDisplayList = new ArrayList<NamedDisplay>(); // close attempt, marked uncloseable, for reuse private static List<NamedDisplay> pendingDisplayList = new ArrayList<NamedDisplay>(); // all open (close attempt or reusable) in creation order private static final HashMap<String /* displayName */, Boolean> displayXineramaEnabledMap = new HashMap<String, Boolean>(); - - /** + + /** * Cleanup resources. * <p> * Called by {@link NativeWindowFactory#shutdown()} @@ -184,7 +184,7 @@ public class X11Util implements ToolkitProperties { public static void shutdown() { if(isInit) { synchronized(X11Util.class) { - if(isInit) { + if(isInit) { final boolean isJVMShuttingDown = NativeWindowFactory.isJVMShuttingDown() ; if( DEBUG || ( ( openDisplayMap.size() > 0 || reusableDisplayList.size() > 0 || pendingDisplayList.size() > 0 ) && @@ -207,9 +207,9 @@ public class X11Util implements ToolkitProperties { } } } - - // Only at JVM shutdown time, since AWT impl. seems to - // dislike closing of X11 Display's (w/ ATI driver). + + // Only at JVM shutdown time, since AWT impl. seems to + // dislike closing of X11 Display's (w/ ATI driver). if( isJVMShuttingDown ) { synchronized(globalLock) { isInit = false; @@ -226,7 +226,7 @@ public class X11Util implements ToolkitProperties { } } } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties @@ -234,15 +234,15 @@ public class X11Util implements ToolkitProperties { public static final boolean requiresToolkitLock() { return true; // JAWT locking: yes, instead of native X11 locking w use a recursive lock per display connection. } - + /** * Called by {@link NativeWindowFactory#initSingleton()} * @see ToolkitProperties */ public static final boolean hasThreadingIssues() { - return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere" + return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere" } - + public static void setX11ErrorHandler(boolean onoff, boolean quiet) { synchronized(setX11ErrorHandlerLock) { setX11ErrorHandler0(onoff, quiet); @@ -271,7 +271,7 @@ public class X11Util implements ToolkitProperties { public static boolean getMarkAllDisplaysUnclosable() { return markAllDisplaysUnclosable; } - + private X11Util() {} public static class NamedDisplay { @@ -303,7 +303,7 @@ public class X11Util implements ToolkitProperties { public final int hashCode() { return hash32; } - + public final boolean equals(Object obj) { if(this == obj) { return true; } if(obj instanceof NamedDisplay) { @@ -311,10 +311,10 @@ public class X11Util implements ToolkitProperties { } return false; } - + public final void addRef() { refCount++; } public final void removeRef() { refCount--; } - + public final String getName() { return name; } public final long getHandle() { return handle; } public final int getRefCount() { return refCount; } @@ -365,7 +365,7 @@ public class X11Util implements ToolkitProperties { return openDisplayList.size(); } } - + public static void dumpOpenDisplayConnections() { synchronized(globalLock) { System.err.println("X11Util: Open X11 Display Connections: "+openDisplayList.size()); @@ -381,7 +381,7 @@ public class X11Util implements ToolkitProperties { } } } - + public static int getReusableDisplayConnectionNumber() { synchronized(globalLock) { return reusableDisplayList.size(); @@ -439,7 +439,7 @@ public class X11Util implements ToolkitProperties { NamedDisplay namedDpy = null; name = validateDisplayName(name); boolean reused = false; - + synchronized(globalLock) { for(int i=0; i<reusableDisplayList.size(); i++) { if(reusableDisplayList.get(i).getName().equals(name)) { @@ -484,7 +484,7 @@ public class X11Util implements ToolkitProperties { X11Util.dumpPendingDisplayConnections(); throw new RuntimeException("X11Util.Display: Display(0x"+Long.toHexString(handle)+") Mapping error: "+namedDpy+". Thread "+Thread.currentThread().getName()); } - + namedDpy.removeRef(); if(!openDisplayList.remove(namedDpy)) { throw new RuntimeException("Internal: "+namedDpy); } @@ -497,13 +497,13 @@ public class X11Util implements ToolkitProperties { pendingDisplayList.remove(namedDpy); } else { // for reuse - X11Lib.XSync(namedDpy.getHandle(), true); // flush output buffer and discard all events + X11Lib.XSync(namedDpy.getHandle(), true); // flush output buffer and discard all events reusableDisplayList.add(namedDpy); } if(DEBUG) { System.err.println("X11Util.Display: Closed (real: "+(!namedDpy.isUncloseable())+") "+namedDpy+". Thread "+Thread.currentThread().getName()); - } + } } } @@ -513,7 +513,7 @@ public class X11Util implements ToolkitProperties { } } - /** + /** * @return If name is null, it returns the previous queried NULL display name, * otherwise the name. */ public static String validateDisplayName(String name) { @@ -537,7 +537,7 @@ public class X11Util implements ToolkitProperties { long handle = X11Lib.XOpenDisplay(arg0); if(XSYNC_ENABLED && 0 != handle) { X11Lib.XSynchronize(handle, true); - } + } if(TRACE_DISPLAY_LIFECYCLE) { System.err.println(Thread.currentThread()+" - X11Util.XOpenDisplay("+arg0+") 0x"+Long.toHexString(handle)); // Thread.dumpStack(); @@ -557,13 +557,13 @@ public class X11Util implements ToolkitProperties { System.err.println("X11Util: Catched Exception:"); ex.printStackTrace(); } - return res; + return res; } static volatile boolean XineramaFetched = false; static long XineramaLibHandle = 0; static long XineramaQueryFunc = 0; - + public static boolean XineramaIsEnabled(X11GraphicsDevice device) { if(null == device) { throw new IllegalArgumentException("X11 Display device is NULL"); @@ -573,9 +573,9 @@ public class X11Util implements ToolkitProperties { return XineramaIsEnabled(device.getHandle()); } finally { device.unlock(); - } + } } - + public static boolean XineramaIsEnabled(long displayHandle) { if( 0 == displayHandle ) { throw new IllegalArgumentException("X11 Display handle is NULL"); @@ -616,10 +616,10 @@ public class X11Util implements ToolkitProperties { } return res; } - + private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI - + private static native boolean initialize0(boolean debug); private static native void shutdown0(); private static native void setX11ErrorHandler0(boolean onoff, boolean quiet); diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java index b152f0f97..7b37d3cca 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.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,16 +59,16 @@ import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.X11Util; public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFactory { - + public static void registerFactory() { GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, CapabilitiesImmutable.class, new X11AWTGraphicsConfigurationFactory()); - } + } private X11AWTGraphicsConfigurationFactory() { } protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only AWTGraphicsScreen objects"); @@ -79,16 +79,16 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac return chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, (AWTGraphicsScreen)absScreen, nativeVisualID); } - + public static AWTGraphicsConfiguration chooseGraphicsConfigurationStatic( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AWTGraphicsScreen awtScreen, int nativeVisualID) { if(DEBUG) { System.err.println("X11AWTGraphicsConfigurationFactory: got "+awtScreen); } - + final GraphicsDevice device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); - + final long displayHandleAWT = X11SunJDKReflection.graphicsDeviceGetDisplay(device); final long displayHandle; final boolean owner; @@ -101,8 +101,8 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac } else { /** * Using the AWT display handle works fine with NVidia. - * However we experienced different results w/ AMD drivers, - * some work, but some behave erratic. + * However we experienced different results w/ AMD drivers, + * some work, but some behave erratic. * I.e. hangs in XQueryExtension(..) via X11GraphicsScreen. */ final String displayName = X11Lib.XDisplayString(displayHandleAWT); @@ -113,13 +113,13 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac } } // Global JAWT lock required - No X11 resource locking due to private display connection - final ToolkitLock lock = NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_AWT); - final X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT, lock, owner); + final ToolkitLock lock = NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_AWT); + final X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT, lock, owner); final X11GraphicsScreen x11Screen = new X11GraphicsScreen(x11Device, awtScreen.getIndex()); if(DEBUG) { System.err.println("X11AWTGraphicsConfigurationFactory: made "+x11Screen); } - + final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(x11Device, capsChosen); AbstractGraphicsConfiguration aConfig = factory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, x11Screen, nativeVisualID); if (aConfig == null) { @@ -129,7 +129,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac System.err.println("X11AWTGraphicsConfigurationFactory: chosen config: "+aConfig); // Thread.dumpStack(); } - + // // Match the X11/GL Visual with AWT: // - choose a config AWT agnostic and then @@ -137,7 +137,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac // // The resulting GraphicsConfiguration has to be 'forced' on the AWT native peer, // ie. returned by GLCanvas's getGraphicsConfiguration() befor call by super.addNotify(). - // + // final GraphicsConfiguration[] configs = device.getConfigurations(); int visualID = aConfig.getVisualID(VIDType.NATIVE); if(VisualIDHolder.VID_UNDEFINED != visualID) { diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 382a5d583..83383d23c 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -114,9 +114,9 @@ public abstract class Display { */ public abstract int removeReference(); - /** - * Return the {@link AbstractGraphicsDevice} used for depending resources lifecycle, - * i.e. {@link Screen} and {@link Window}, as well as the event dispatching (EDT). */ + /** + * Return the {@link AbstractGraphicsDevice} used for depending resources lifecycle, + * i.e. {@link Screen} and {@link Window}, as well as the event dispatching (EDT). */ public abstract AbstractGraphicsDevice getGraphicsDevice(); /** @@ -136,8 +136,8 @@ public abstract class Display { public abstract int getId(); /** - * @return This display connection name as defined at creation time. - * The display connection name is a technical platform specific detail, see {@link AbstractGraphicsDevice#getConnection()}. + * @return This display connection name as defined at creation time. + * The display connection name is a technical platform specific detail, see {@link AbstractGraphicsDevice#getConnection()}. * * @see AbstractGraphicsDevice#getConnection() */ @@ -154,11 +154,11 @@ public abstract class Display { /** * Sets a new {@link EDTUtil} and returns the previous one. * <p> - * If <code>usrEDTUtil</code> is <code>null</code>, + * If <code>usrEDTUtil</code> is <code>null</code>, * the device's default EDTUtil is created and used. * </p> * <p> - * If a previous one exists and it differs from <code>usrEDTUtil</code>, + * If a previous one exists and it differs from <code>usrEDTUtil</code>, * it's being stopped, wait-until-idle. * </p> * <p> @@ -167,7 +167,7 @@ public abstract class Display { * </p> */ public abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil); - + public abstract EDTUtil getEDTUtil(); /** @@ -176,7 +176,7 @@ public abstract class Display { public abstract boolean isEDTRunning(); public abstract void dispatchMessages(); - + // Global Displays protected static final ArrayList<WeakReference<Display>> displayList = new ArrayList<WeakReference<Display>>(); protected static int displaysActive = 0; @@ -193,12 +193,12 @@ public abstract class Display { } /** - * + * * @param type * @param name * @param fromIndex start index, then increasing until found or end of list - * @paran shared if true, only shared instances are found, otherwise also exclusive - * @return + * @paran shared if true, only shared instances are found, otherwise also exclusive + * @return */ public static Display getFirstDisplayOf(String type, String name, int fromIndex, boolean shared) { return getDisplayOfImpl(type, name, fromIndex, 1, shared); @@ -209,7 +209,7 @@ public abstract class Display { * @param type * @param name * @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1. - * @paran shared if true, only shared instances are found, otherwise also exclusive + * @paran shared if true, only shared instances are found, otherwise also exclusive * @return */ public static Display getLastDisplayOf(String type, String name, int fromIndex, boolean shared) { @@ -231,7 +231,7 @@ public abstract class Display { } else { if( display.getType().equals(type) && display.getName().equals(name) && - ( !shared || shared && !display.isExclusive() ) + ( !shared || shared && !display.isExclusive() ) ) { return display; } @@ -241,7 +241,7 @@ public abstract class Display { } return null; } - + protected static void addDisplay2List(Display display) { synchronized(displayList) { // GC before add @@ -256,7 +256,7 @@ public abstract class Display { displayList.add(new WeakReference<Display>(display)); } } - + /** Returns the global display collection */ public static Collection<Display> getAllDisplays() { ArrayList<Display> list; diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index 42ac34240..625a7b39f 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.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 com.jogamp.newt; import java.util.List; @@ -36,7 +36,7 @@ import javax.media.nativewindow.util.RectangleImmutable; import com.jogamp.common.util.ArrayHashSet; -/** +/** * Visual output device, i.e. a CRT, LED ..consisting of it's components:<br> * <ui> * <li>Immutable @@ -55,7 +55,7 @@ import com.jogamp.common.util.ArrayHashSet; */ public abstract class MonitorDevice { protected final Screen screen; // backref - protected final int nativeId; // unique monitor device ID + protected final int nativeId; // unique monitor device ID protected final DimensionImmutable sizeMM; // in [mm] protected final MonitorMode originalMode; protected final ArrayHashSet<MonitorMode> supportedModes; // FIXME: May need to support mutable mode, i.e. adding modes on the fly! @@ -73,14 +73,14 @@ public abstract class MonitorDevice { this.viewport = viewport; this.modeChanged = false; } - + /** Returns the {@link Screen} owning this monitor. */ public final Screen getScreen() { return screen; } - + /** - * Tests equality of two <code>MonitorDevice</code> objects + * Tests equality of two <code>MonitorDevice</code> objects * by evaluating equality of it's components:<br> * <ul> * <li><code>nativeID</code></li> @@ -105,10 +105,10 @@ public abstract class MonitorDevice { public final int hashCode() { return nativeId; } - + /** @return the immutable unique native Id of this monitor device. */ public final int getId() { return nativeId; } - + /** * @return the immutable monitor size in millimeters. */ @@ -140,11 +140,11 @@ public abstract class MonitorDevice { return supportedModes.getData(); } - /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */ + /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */ public final RectangleImmutable getViewport() { return viewport; } - + /** Returns <code>true</code> if given coordinates are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>. */ public final boolean contains(int x, int y) { return x >= viewport.getX() && @@ -152,8 +152,8 @@ public abstract class MonitorDevice { y >= viewport.getY() && y < viewport.getY() + viewport.getHeight() ; } - - /** + + /** * Returns the coverage of given rectangle w/ this this {@link #getViewport() viewport}, i.e. between <code>0.0</code> and <code>1.0</code>. * <p> * Coverage is computed by: @@ -161,12 +161,12 @@ public abstract class MonitorDevice { * isect = viewport.intersection(r); * coverage = area( isect ) / area( viewport ) ; * </pre> - * </p> + * </p> */ public final float coverage(RectangleImmutable r) { return viewport.coverage(r); } - + /** * Returns the union of the given monitor's {@link #getViewport() viewport}. * @param result storage for result, will be returned @@ -186,14 +186,14 @@ public abstract class MonitorDevice { result.set(x1, y1, x2 - x1, y2 - y1); return result; } - + public final boolean isOriginalMode() { return currentMode.hashCode() == originalMode.hashCode(); } - + /** * Returns <code>true</true> if the {@link MonitorMode} - * has been changed programmatic via this API <i>only</i>, otherwise <code>false</code>. + * has been changed programmatic via this API <i>only</i>, otherwise <code>false</code>. * <p> * Note: We cannot guarantee that we won't interfere w/ another running * application's screen mode change or vice versa. @@ -202,7 +202,7 @@ public abstract class MonitorDevice { public final boolean isModeChangedByUs() { return modeChanged && !isOriginalMode(); } - + /** * Returns the cached current {@link MonitorMode} w/o native query. * <p> @@ -212,7 +212,7 @@ public abstract class MonitorDevice { public final MonitorMode getCurrentMode() { return currentMode; } - + /** * Returns the current {@link MonitorMode} resulting from a native query. * <p> diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java index 218cd8bd5..175d6e5f2 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java @@ -37,7 +37,7 @@ import javax.media.nativewindow.util.SurfaceSize; import com.jogamp.newt.util.MonitorModeUtil; -/** +/** * Immutable MonitorMode Class, consisting of it's read only components:<br> * <ul> * <li>nativeId</li> @@ -79,7 +79,7 @@ import com.jogamp.newt.util.MonitorModeUtil; // Pick the monitor: // Either the one used by a window .. MonitorDevice monitor = window.getMainMonitor(); - + // Or arbitrary from the list .. List<MonitorDevice> allMonitor = getMonitorDevices(); MonitorDevice monitor = allMonitor.get(0); @@ -87,7 +87,7 @@ import com.jogamp.newt.util.MonitorModeUtil; // Current and original modes .. MonitorMode mmCurrent = monitor.queryCurrentMode(); MonitorMode mmOrig = monitor.getOriginalMode(); - + // Target resolution Dimension res = new Dimension(800, 600); @@ -102,7 +102,7 @@ import com.jogamp.newt.util.MonitorModeUtil; monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot); monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res); - monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq); + monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq); monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); // pick 1st one and set to current .. @@ -111,20 +111,20 @@ import com.jogamp.newt.util.MonitorModeUtil; * </pre> */ public class MonitorMode implements Comparable<MonitorMode> { - + /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the ascending order. */ public static final Comparator<MonitorMode> monitorModeComparator = new Comparator<MonitorMode>() { public int compare(MonitorMode mm1, MonitorMode mm2) { return mm1.compareTo(mm2); } }; - + /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the descending order. */ public static final Comparator<MonitorMode> monitorModeComparatorInv = new Comparator<MonitorMode>() { public int compare(MonitorMode mm1, MonitorMode mm2) { return mm2.compareTo(mm1); } }; - - /** + + /** * Immutable <i>surfaceSize, flags and refreshRate</i> Class, consisting of it's read only components:<br> * <ul> * <li>nativeId</li> @@ -141,7 +141,7 @@ public class MonitorMode implements Comparable<MonitorMode> { /** Vertical refresh rate */ public final float refreshRate; public final int hashCode; - + public SizeAndRRate(SurfaceSize surfaceSize, float refreshRate, int flags) { if(null==surfaceSize) { throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")"); @@ -151,11 +151,11 @@ public class MonitorMode implements Comparable<MonitorMode> { this.refreshRate=refreshRate; this.hashCode = getHashCode(); } - + private final static String STR_INTERLACE = "Interlace"; private final static String STR_DOUBLESCAN = "DoubleScan"; private final static String STR_SEP = ", "; - + public static final StringBuilder flags2String(int flags) { final StringBuilder sb = new StringBuilder(); boolean sp = false; @@ -175,11 +175,11 @@ public class MonitorMode implements Comparable<MonitorMode> { public final String toString() { return new String(surfaceSize+" @ "+refreshRate+" Hz, flags ["+flags2String(flags).toString()+"]"); } - + /** * <p> * Compares {@link SurfaceSize#compareTo(SurfaceSize) surfaceSize} 1st, then {@link #flags}, then {@link #refreshRate}. - * </p> + * </p> * <p> * Flags are compared as follows: * <pre> @@ -196,7 +196,7 @@ public class MonitorMode implements Comparable<MonitorMode> { final int rssz = surfaceSize.compareTo(sszr.surfaceSize); if( 0 != rssz ) { return rssz; - } + } final int tflags = 0 == flags ? Integer.MAX_VALUE : flags; // normalize NONE final int xflags = 0 == sszr.flags ? Integer.MAX_VALUE : sszr.flags; // normalize NONE if( tflags == xflags ) { @@ -218,9 +218,9 @@ public class MonitorMode implements Comparable<MonitorMode> { return 0; } } - + /** - * Tests equality of two {@link SizeAndRRate} objects + * Tests equality of two {@link SizeAndRRate} objects * by evaluating equality of it's components:<br/> * <ul> * <li><code>surfaceSize</code></li> @@ -238,7 +238,7 @@ public class MonitorMode implements Comparable<MonitorMode> { } return false; } - + /** * Returns a combined hash code of it's elements:<br/> * <ul> @@ -249,16 +249,16 @@ public class MonitorMode implements Comparable<MonitorMode> { */ public final int hashCode() { return hashCode; - } + } private final int getHashCode() { // 31 * x == (x << 5) - x int hash = 31 + surfaceSize.hashCode(); hash = ((hash << 5) - hash) + flags; hash = ((hash << 5) - hash) + (int)(refreshRate*100.0f); return hash; - } + } } - + /** zero rotation, compared to normal settings */ public static final int ROTATE_0 = 0; @@ -270,15 +270,15 @@ public class MonitorMode implements Comparable<MonitorMode> { /** 270 degrees CCW rotation */ public static final int ROTATE_270 = 270; - + /** Frame is split into two fields. See {@link #getFlags()}. */ public static final int FLAG_INTERLACE = 1 << 0; - + /** Lines are doubled. See {@link #getFlags()}. */ public static final int FLAG_DOUBLESCAN = 1 << 1; /** The immutable native Id of this instance, which may not be unique. */ - private final int nativeId; + private final int nativeId; private final SizeAndRRate sizeAndRRate; private final int rotation; private final int hashCode; @@ -301,7 +301,7 @@ public class MonitorMode implements Comparable<MonitorMode> { this.rotation = rotation; this.hashCode = getHashCode(); } - + /** * Creates a user instance w/o {@link #getId() identity} to filter our matching modes w/ identity. * <p> @@ -314,16 +314,16 @@ public class MonitorMode implements Comparable<MonitorMode> { */ public MonitorMode(SurfaceSize surfaceSize, float refreshRate, int flags, int rotation) { this(0, new SizeAndRRate(surfaceSize, refreshRate, flags), rotation); - } + } /** @return the immutable native Id of this mode, may not be unique, may be 0. */ public final int getId() { return nativeId; } - + /** Returns the <i>surfaceSize and refreshRate</i> instance. */ - public final SizeAndRRate getSizeAndRRate() { + public final SizeAndRRate getSizeAndRRate() { return sizeAndRRate; } - + /** Returns the unrotated {@link SurfaceSize} */ public final SurfaceSize getSurfaceSize() { return sizeAndRRate.surfaceSize; @@ -338,23 +338,23 @@ public class MonitorMode implements Comparable<MonitorMode> { public final int getFlags() { return sizeAndRRate.flags; } - + /** Returns the CCW rotation of this mode */ public final int getRotation() { return rotation; } - - /** Returns the rotated screen width, + + /** Returns the rotated screen width, * derived from <code>getMonitorMode().getSurfaceSize().getResolution()</code> - * and <code>getRotation()</code> + * and <code>getRotation()</code> */ public final int getRotatedWidth() { return getRotatedWH(true); } - - /** Returns the rotated screen height, + + /** Returns the rotated screen height, * derived from <code>getMonitorMode().getSurfaceSize().getResolution()</code> - * and <code>getRotation()</code> + * and <code>getRotation()</code> */ public final int getRotatedHeight() { return getRotatedWH(false); @@ -367,9 +367,9 @@ public class MonitorMode implements Comparable<MonitorMode> { /** * <p> * Compares {@link SizeAndRRate#compareTo(SizeAndRRate) sizeAndRRate} 1st, then {@link #rotation}. - * </p> + * </p> * <p> - * Rotation is compared inverted, i.e. <code>360 - rotation</code>, + * Rotation is compared inverted, i.e. <code>360 - rotation</code>, * so the lowest rotation reflects a higher value. * </p> * <p> @@ -380,7 +380,7 @@ public class MonitorMode implements Comparable<MonitorMode> { * <li>flags</li> * <li>refresh rate</li> * <li>rotation</li> - * </ul> + * </ul> * </p> * {@inheritDoc} */ @@ -399,9 +399,9 @@ public class MonitorMode implements Comparable<MonitorMode> { } return 0; } - + /** - * Tests equality of two {@link MonitorMode} objects + * Tests equality of two {@link MonitorMode} objects * by evaluating equality of it's components:<br/> * <ul> * <li><code>nativeId</code></li> @@ -438,7 +438,7 @@ public class MonitorMode implements Comparable<MonitorMode> { hash = ((hash << 5) - hash) + getRotation(); return hash; } - + private final int getRotatedWH(boolean width) { final DimensionImmutable d = sizeAndRRate.surfaceSize.getResolution(); final boolean swap = MonitorMode.ROTATE_90 == rotation || MonitorMode.ROTATE_270 == rotation ; @@ -446,5 +446,5 @@ public class MonitorMode implements Comparable<MonitorMode> { return d.getHeight(); } return d.getWidth(); - } + } } diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index e66b2f624..7116877a3 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.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. - * + * */ package com.jogamp.newt; @@ -53,16 +53,16 @@ public class NewtFactory { public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window"); public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver"; - + static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { NativeWindowFactory.initSingleton(); // last resort .. - + // Work-around for initialization order problems on Mac OS X // between native Newt and (apparently) Fmod WindowImpl.init(NativeWindowFactory.getNativeWindowType(true)); - + return null; } } ); } @@ -75,7 +75,7 @@ public class NewtFactory { clazzName = DRIVER_DEFAULT_ROOT_PACKAGE + packageName + "." + classBaseName ; } else { clazzName = packageName + "." + classBaseName ; - } + } try { clazz = Class.forName(clazzName); } catch (Throwable t) { @@ -90,7 +90,7 @@ public class NewtFactory { private static boolean useEDT = true; - /** + /** * Toggles the usage of an EventDispatchThread while creating a Display.<br> * The default is enabled.<br> * The EventDispatchThread is thread local to the Display instance.<br> @@ -108,7 +108,7 @@ public class NewtFactory { * Native creation is lazily done at usage, ie. {@link Display#addReference()}. * </p> * <p> - * An already existing display connection of the same <code>name</code> will be reused. + * An already existing display connection of the same <code>name</code> will be reused. * </p> * @param name the display connection name which is a technical platform specific detail, * see {@link AbstractGraphicsDevice#getConnection()}. Use <code>null</code> for default. diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java index 9adb7aac5..e70d63f88 100644 --- a/src/newt/classes/com/jogamp/newt/NewtVersion.java +++ b/src/newt/classes/com/jogamp/newt/NewtVersion.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 com.jogamp.newt; import com.jogamp.common.GlueGenVersion; diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index f56ee344b..1274b3459 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -39,7 +39,7 @@ import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.util.Rectangle; import javax.media.nativewindow.util.RectangleImmutable; -/** +/** * A screen may span multiple {@link MonitorDevice}s representing their combined virtual size. */ public abstract class Screen { @@ -102,7 +102,7 @@ public abstract class Screen { /** * See {@link Display#addReference()} - * + * * @return number of references post operation * @throws NativeWindowException if the native creation failed. * @see #removeReference() @@ -113,7 +113,7 @@ public abstract class Screen { /** * See {@link Display#removeReference()} - * + * * @return number of references post operation * @see #addReference() * @see #setDestroyWhenUnused(boolean) @@ -132,12 +132,12 @@ public abstract class Screen { * @return the x position of the virtual viewport's top-left origin. */ public abstract int getX(); - + /** * @return the y position of the virtual viewport's top-left origin. */ public abstract int getY(); - + /** * @return the <b>rotated</b> virtual viewport's width. */ @@ -152,19 +152,19 @@ public abstract class Screen { * @return the <b>rotated</b> virtual viewport, i.e. origin and size. */ public abstract RectangleImmutable getViewport(); - + /** * @return the associated Display */ public abstract Display getDisplay(); - /** + /** * @return The screen fully qualified Screen name, * which is a key of {@link com.jogamp.newt.Display#getFQName()} + {@link #getIndex()}. */ public abstract String getFQName(); - /** + /** * Return a list of all {@link MonitorMode}s for all {@link MonitorDevice}s. * <p> * The list is ordered in descending order, @@ -173,23 +173,23 @@ public abstract class Screen { */ public abstract List<MonitorMode> getMonitorModes(); - /** + /** * Return a list of available {@link MonitorDevice}s. */ public abstract List<MonitorDevice> getMonitorDevices(); /** - * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport} + * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport} * {@link MonitorDevice#coverage(RectangleImmutable) covers} the given rectangle the most. * <p> - * If no coverage is detected the first {@link MonitorDevice} is returned. + * If no coverage is detected the first {@link MonitorDevice} is returned. * </p> */ public final MonitorDevice getMainMonitor(RectangleImmutable r) { MonitorDevice res = null; float maxCoverage = Float.MIN_VALUE; final List<MonitorDevice> monitors = getMonitorDevices(); - for(int i=monitors.size()-1; i>=0; i--) { + for(int i=monitors.size()-1; i>=0; i--) { final MonitorDevice monitor = monitors.get(i); final float coverage = monitor.coverage(r); if( coverage > maxCoverage ) { @@ -207,14 +207,14 @@ public abstract class Screen { * Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport}. * <p> * Should be equal to {@link #getX()}, {@link #getY()}, {@link #getWidth()} and {@link #getHeight()}, - * however, some native toolkits may choose a different virtual screen area. + * however, some native toolkits may choose a different virtual screen area. * </p> * @param result storage for result, will be returned */ public final Rectangle unionOfMonitorViewportSize(final Rectangle result) { return MonitorDevice.unionOfViewports(result, getMonitorDevices()); } - + /** * @param sml {@link MonitorModeListener} to be added for {@link MonitorEvent} */ @@ -274,7 +274,7 @@ public abstract class Screen { } return null; } - + protected static void addScreen2List(Screen screen) { synchronized(screenList) { // GC before add @@ -289,7 +289,7 @@ public abstract class Screen { screenList.add(new WeakReference<Screen>(screen)); } } - + /** Returns the global screen collection */ public static Collection<Screen> getAllScreens() { ArrayList<Screen> list; @@ -308,7 +308,7 @@ public abstract class Screen { } return list; } - + public static int getActiveScreenNumber() { synchronized(screenList) { return screensActive; diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 02727353f..04eb07a25 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -58,8 +58,8 @@ import javax.media.nativewindow.util.RectangleImmutable; * <li>... and more</li> * </ul> * <p> - * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates - * window operation to an instance of this interface while providing OpenGL + * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates + * window operation to an instance of this interface while providing OpenGL * functionality. * </p> */ @@ -90,14 +90,14 @@ public interface Window extends NativeWindow, WindowClosingProtocol { Screen getScreen(); /** - * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport} + * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport} * {@link MonitorDevice#coverage(RectangleImmutable) covers} this window the most. * <p> - * If no coverage is detected the first {@link MonitorDevice} is returned. + * If no coverage is detected the first {@link MonitorDevice} is returned. * </p> */ MonitorDevice getMainMonitor(); - + /** * Set the CapabilitiesChooser to help determine the native visual type. * @@ -129,7 +129,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * Visibility is set to false. * </p> * <p> - * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and + * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and * {@link WindowEvent#EVENT_WINDOW_DESTROYED post-} destruction events * to all of it's {@link WindowListener}. * </p> @@ -151,7 +151,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * Set a custom action handling destruction issued by a {@link WindowImpl#windowDestroyNotify(boolean) toolkit triggered window destroy} * replacing the default {@link #destroy()} action. * <p> - * The custom action shall call {@link #destroy()} + * The custom action shall call {@link #destroy()} * but may perform further tasks before and after. * </p> */ @@ -369,7 +369,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * @param x new top-level position, use -1 for default position. * @param y new top-level position, use -1 for default position. * @param forceDestroyCreate if true, uses re-creation strategy for reparenting, default is <code>false</code>. - * + * * @return The issued reparent action type (strategy) as defined in Window.ReparentAction * @see #reparentWindow(NativeWindow) */ @@ -378,7 +378,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { /** * Enable or disable fullscreen mode for this window. * <p> - * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}. + * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}. * </p> * @param fullscreen enable or disable fullscreen mode * @return success @@ -393,14 +393,14 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * <p> * Disable fullscreen via {@link #setFullscreen(boolean)}. * </p> - * @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s, + * @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s, * otherwise across the given list of {@link MonitorDevice}. * @return success * @see #setFullscreen(boolean) * @see #isFullscreen() */ boolean setFullscreen(List<MonitorDevice> monitors); - + boolean isFullscreen(); static interface FocusRunnable { @@ -429,7 +429,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * and to perform focus traversal with a 3rd party toolkit. * </p> * <p> - * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events. + * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events. * </p> * @param l */ @@ -469,7 +469,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { /** * Send a {@link WindowEvent} to all {@link WindowListener}. - * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}. + * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}. */ public void sendWindowEvent(int eventType); @@ -585,8 +585,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * Returns all {@link MouseListener} */ MouseListener[] getMouseListeners(); - - /** Enable or disable default {@link GestureHandler}. Default is enabled. */ + + /** Enable or disable default {@link GestureHandler}. Default is enabled. */ void setDefaultGesturesEnabled(boolean enable); /** Return true if default {@link GestureHandler} are enabled. */ boolean areDefaultGesturesEnabled(); @@ -627,5 +627,5 @@ public interface Window extends NativeWindow, WindowClosingProtocol { /** * Removes the given {@link GestureHandler.GestureListener} from the list. */ - void removeGestureListener(GestureHandler.GestureListener gl); + void removeGestureListener(GestureHandler.GestureListener gl); } diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 13affdf49..de1b7224f 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.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 com.jogamp.newt.awt; @@ -84,11 +84,11 @@ import com.jogamp.opengl.util.TileRenderer; /** * AWT {@link java.awt.Canvas Canvas} containing a NEWT {@link Window} using native parenting. - * + * * <h5><A NAME="java2dgl">Offscreen Layer Remarks</A></h5> - * + * * {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)} - * maybe called to use an offscreen drawable (FBO or PBuffer) allowing + * maybe called to use an offscreen drawable (FBO or PBuffer) allowing * the underlying JAWT mechanism to composite the image, if supported. */ @SuppressWarnings("serial") @@ -104,7 +104,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto private AWTParentWindowAdapter awtAdapter = null; private AWTAdapter awtMouseAdapter = null; private AWTAdapter awtKeyAdapter = null; - + private AWTWindowClosingProtocol awtWindowClosingProtocol = new AWTWindowClosingProtocol(this, new Runnable() { public void run() { @@ -115,7 +115,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if( newtChild != null ) { newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY); } - } + } } ); /** @@ -147,36 +147,36 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto super(gc); setNEWTChild(child); } - + public void setShallUseOffscreenLayer(boolean v) { shallUseOffscreenLayer = v; } - + public final boolean getShallUseOffscreenLayer() { - return shallUseOffscreenLayer; + return shallUseOffscreenLayer; } - - public final boolean isOffscreenLayerSurfaceEnabled() { + + public final boolean isOffscreenLayerSurfaceEnabled() { return jawtWindow.isOffscreenLayerSurfaceEnabled(); } - - /** - * Returns true if the AWT component is parented to an {@link java.applet.Applet}, - * otherwise false. This information is valid only after {@link #addNotify()} is issued, - * ie. before adding the component to the AWT tree and make it visible. + + /** + * Returns true if the AWT component is parented to an {@link java.applet.Applet}, + * otherwise false. This information is valid only after {@link #addNotify()} is issued, + * ie. before adding the component to the AWT tree and make it visible. */ public boolean isApplet() { return jawtWindow.isApplet(); } boolean isParent() { - return null!=newtChild && jawtWindow == newtChild.getParent(); + return null!=newtChild && jawtWindow == newtChild.getParent(); } - + boolean isFullscreen() { return null != newtChild && newtChild.isFullscreen(); } - + class FocusAction implements Window.FocusRunnable { public boolean run() { final boolean isParent = isParent(); @@ -199,7 +199,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } private FocusAction focusAction = new FocusAction(); - + WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() { @Override public void windowResized(WindowEvent e) { @@ -224,15 +224,15 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto handleKey(e, true); } } - - void handleKey(KeyEvent evt, boolean onRelease) { + + void handleKey(KeyEvent evt, boolean onRelease) { if(null == keyboardFocusManager) { throw new InternalError("XXX"); } final AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(evt.getKeyCode(), evt.getModifiers(), onRelease); boolean suppress = false; if(null != ks) { - final Set<AWTKeyStroke> fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); + final Set<AWTKeyStroke> fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); final Set<AWTKeyStroke> bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); if(fwdKeys.contains(ks)) { final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this, true /* forward */); @@ -253,38 +253,38 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } if(suppress) { - evt.setConsumed(true); + evt.setConsumed(true); } if(DEBUG) { System.err.println("NewtCanvasAWT.focusKey: XXX: "+ks); } } } - private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener(); + private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener(); class FocusPropertyChangeListener implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent evt) { final Object oldF = evt.getOldValue(); final Object newF = evt.getNewValue(); final boolean isParent = isParent(); - final boolean isFullscreen = isFullscreen(); + final boolean isFullscreen = isFullscreen(); if(DEBUG) { System.err.println("NewtCanvasAWT.FocusProperty: "+evt.getPropertyName()+", src "+evt.getSource()+", "+oldF+" -> "+newF+", isParent "+isParent+", isFS "+isFullscreen); } if(isParent && !isFullscreen) { if(newF == NewtCanvasAWT.this) { - if(DEBUG) { + if(DEBUG) { System.err.println("NewtCanvasAWT.FocusProperty: AWT focus -> NEWT focus traversal"); } requestFocusNEWTChild(); } else if(oldF == NewtCanvasAWT.this && newF == null) { // focus traversal to NEWT - NOP - if(DEBUG) { + if(DEBUG) { System.err.println("NewtCanvasAWT.FocusProperty: NEWT focus"); } } else if(null != newF && newF != NewtCanvasAWT.this) { // focus traversal to another AWT component - if(DEBUG) { + if(DEBUG) { System.err.println("NewtCanvasAWT.FocusProperty: lost focus - clear focus"); } if(newtChild.getDelegatedWindow() instanceof DriverClearFocus) { @@ -292,7 +292,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } } - } + } } private final FocusPropertyChangeListener focusPropertyChangeListener = new FocusPropertyChangeListener(); private volatile KeyboardFocusManager keyboardFocusManager = null; @@ -300,7 +300,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto private final void requestFocusNEWTChild() { if(null!=newtChild) { newtChild.setFocusAction(null); - if(isOnscreen) { + if(isOnscreen) { KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); } newtChild.requestFocus(); @@ -308,17 +308,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } - /** + /** * Sets a new NEWT child, provoking reparenting. * <p> * A previously detached <code>newChild</code> will be released to top-level status - * and made invisible. + * and made invisible. * </p> * <p> - * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code> - * produced much cleaner visual results. + * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code> + * produced much cleaner visual results. * </p> - * @return the previous attached newt child. + * @return the previous attached newt child. */ public Window setNEWTChild(Window newChild) { final Window prevChild = newtChild; @@ -336,17 +336,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto updateLayoutSize(); // will be done later at paint/display/..: attachNewtChild(cont); - + return prevChild; } - + private final void updateLayoutSize() { if( null != newtChild ) { // use NEWT child's size for min/pref size! java.awt.Dimension minSize = new java.awt.Dimension(newtChild.getWidth(), newtChild.getHeight()); setMinimumSize(minSize); setPreferredSize(minSize); - } + } } /** @return the current NEWT child */ @@ -357,7 +357,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** @return this AWT Canvas NativeWindow representation, may be null in case {@link #removeNotify()} has been called, * or {@link #addNotify()} hasn't been called yet.*/ public NativeWindow getNativeWindow() { return jawtWindow; } - + public WindowClosingMode getDefaultCloseOperation() { return awtWindowClosingProtocol.getDefaultCloseOperation(); } @@ -373,16 +373,16 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } else { // before native peer is valid: X11 disableBackgroundErase(); - + // creates the native peer super.addNotify(); - + // after native peer is valid: Windows disableBackgroundErase(); - - jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null); + + jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null); jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer); - + if(DEBUG) { // if ( isShowing() == false ) -> Container was not visible yet. // if ( isShowing() == true ) -> Container is already visible. @@ -397,7 +397,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto @Override public void removeNotify() { awtWindowClosingProtocol.removeClosingListener(); - + if( Beans.isDesignTime() ) { super.removeNotify(); } else { @@ -419,7 +419,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto public final void destroy() { destroyImpl(false /* removeNotify */, false /* windowClosing */); } - + private final void destroyImpl(boolean removeNotify, boolean windowClosing) { if( null !=newtChild ) { java.awt.Container cont = AWTMisc.getContainer(this); @@ -427,7 +427,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto System.err.println("NewtCanvasAWT.destroy(removeNotify "+removeNotify+", windowClosing "+windowClosing+"): nw "+newtWinHandleToHexString(newtChild)+", from "+cont); } detachNewtChild(cont); - + if( !removeNotify ) { final Window cWin = newtChild; final Window dWin = cWin.getDelegatedWindow(); @@ -437,14 +437,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } else { cWin.destroy(); } - } + } } if( ( removeNotify || windowClosing ) && null!=jawtWindow ) { NewtFactoryAWT.destroyNativeWindow(jawtWindow); jawtWindow=null; - } + } } - + @Override public void paint(Graphics g) { if( validateComponent(true) && !printActive ) { @@ -469,9 +469,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } } - + private volatile boolean printActive = false; - private GLAnimatorControl printAnimator = null; + private GLAnimatorControl printAnimator = null; private GLAutoDrawable printGLAD = null; private AWTTilePainter printAWTTiles = null; @@ -481,15 +481,15 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } return null; } - + @Override public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { - printActive = true; + printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG); AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, setupPrintOnEDT); - } + } private final Runnable setupPrintOnEDT = new Runnable() { @Override public void run() { @@ -497,14 +497,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if(DEBUG) { System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet"); } - printActive = false; + printActive = false; return; // not yet available .. } if( !isVisible() ) { if(DEBUG) { System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible"); } - printActive = false; + printActive = false; return; // not yet available .. } final GLAutoDrawable glad = getGLAD(); @@ -512,14 +512,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if( DEBUG ) { System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild); } - printActive = false; + printActive = false; return; } printAnimator = glad.getAnimator(); if( null != printAnimator ) { printAnimator.remove(glad); } - printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD + printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable(); final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); @@ -527,7 +527,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() || printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight(); final boolean reqNewGLADOnscrn = caps.isOnscreen(); - + // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context. // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize ); @@ -546,8 +546,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto caps.setNumSamples(printNumSamples); } final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, - printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, + printGLAD = factory.createOffscreenAutoDrawable(null, caps, null, + printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE, printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE, null); GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD); @@ -634,7 +634,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto System.err.println("AWT print.X: "+printAWTTiles); } } - + private final boolean validateComponent(boolean attachNewtChild) { if( Beans.isDesignTime() || !isDisplayable() ) { return false; @@ -645,14 +645,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if( 0 >= getWidth() || 0 >= getHeight() ) { return false; } - + if( attachNewtChild && !newtChildAttached && null != newtChild ) { attachNewtChild(); } return true; } - + private final void configureNewtChild(boolean attach) { if(null!=awtAdapter) { awtAdapter.removeFrom(this); @@ -670,13 +670,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto keyboardFocusManager.removePropertyChangeListener("focusOwner", focusPropertyChangeListener); keyboardFocusManager = null; } - + if( null != newtChild ) { newtChild.setKeyboardFocusHandler(null); if(attach) { if(null == jawtWindow.getGraphicsConfiguration()) { throw new InternalError("XXX"); - } + } isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this); awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction! @@ -733,13 +733,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto newtChild.reparentWindow(jawtWindow); newtChild.addSurfaceUpdatedListener(jawtWindow); if( jawtWindow.isOffscreenLayerSurfaceEnabled() && - 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) { + 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) { AWTEDTExecutor.singleton.invoke(false, forceRelayout); } newtChild.setVisible(true); configureNewtChild(true); newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener - + if(DEBUG) { System.err.println("NewtCanvasAWT.attachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this); } @@ -759,7 +759,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto System.err.println("NewtCanvasAWT.forceRelayout.X"); } } }; - + private final void detachNewtChild(java.awt.Container cont) { if( null == newtChild || null == jawtWindow || !newtChildAttached ) { return; // nop @@ -773,14 +773,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto ", cont "+cont); } - newtChild.removeSurfaceUpdatedListener(jawtWindow); + newtChild.removeSurfaceUpdatedListener(jawtWindow); newtChildAttached = false; newtChild.setFocusAction(null); // no AWT focus traversal .. configureNewtChild(false); newtChild.setVisible(false); - + newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer - + if(DEBUG) { System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this); } @@ -837,7 +837,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } protected static String getThreadName() { return Thread.currentThread().getName(); } - + static String newtWinHandleToHexString(Window w) { return null != w ? toHexString(w.getWindowHandle()) : "nil"; } diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index c7153840f..9b1b82297 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -47,12 +47,12 @@ import jogamp.nativewindow.jawt.JAWTUtil; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; -/** +/** * Simple GLEventListener deployment as an applet using JOGL. This demo must be * referenced from a web page via an <applet> tag. - * + * * <p> - * Example of an applet tag using GearsES2 within the applet area (normal case): + * Example of an applet tag using GearsES2 within the applet area (normal case): * <pre> <applet width=100 height=100> <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> @@ -65,9 +65,9 @@ import com.jogamp.newt.opengl.GLWindow; </applet>Hello Gears ! * </pre> * </p> - * + * * <p> - * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window: + * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window: * <pre> <applet width=1 height=1> <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> @@ -95,12 +95,12 @@ import com.jogamp.newt.opengl.GLWindow; @SuppressWarnings("serial") public class JOGLNewtApplet1Run extends Applet { public static final boolean DEBUG = JOGLNewtAppletBase.DEBUG; - + GLWindow glWindow = null; NewtCanvasAWT newtCanvasAWT = null; JOGLNewtAppletBase base = null; /** if valid glStandalone:=true (own window) ! */ - int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE; + int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE; public void init() { if(DEBUG) { @@ -135,7 +135,7 @@ public class JOGLNewtApplet1Run extends Applet { glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable); glOpaque = JOGLNewtAppletBase.str2Bool(getParameter("gl_opaque"), glOpaque); glAlphaBits = JOGLNewtAppletBase.str2Int(getParameter("gl_alpha"), glAlphaBits); - glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer); + glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer); glXd = JOGLNewtAppletBase.str2Int(getParameter("gl_dx"), glXd); glYd = JOGLNewtAppletBase.str2Int(getParameter("gl_dy"), glYd); glWidth = JOGLNewtAppletBase.str2Int(getParameter("gl_width"), glWidth); @@ -168,8 +168,8 @@ public class JOGLNewtApplet1Run extends Applet { System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer); System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener); } - - base = new JOGLNewtAppletBase(glEventListenerClazzName, + + base = new JOGLNewtAppletBase(glEventListenerClazzName, glSwapInterval, glNoDefaultKeyListener, glCloseable, @@ -252,9 +252,9 @@ public class JOGLNewtApplet1Run extends Applet { System.err.println("GLWindow: "+glWindow); } base.start(); - if( null != newtCanvasAWT && + if( null != newtCanvasAWT && newtCanvasAWT.isOffscreenLayerSurfaceEnabled() && - 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) { + 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) { // force relayout final int cW = newtCanvasAWT.getWidth(); final int cH = newtCanvasAWT.getHeight(); diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java index 1004adb8e..a6a30a8bf 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -57,7 +57,7 @@ import com.jogamp.opengl.util.Animator; public class JOGLNewtAppletBase implements KeyListener, GLEventListener { public static final boolean DEBUG = Debug.debug("Applet"); - + String glEventListenerClazzName; int glSwapInterval; boolean noDefaultKeyListener; @@ -71,13 +71,13 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { boolean isValid = false; NativeWindow awtParent; - public JOGLNewtAppletBase(String glEventListenerClazzName, + public JOGLNewtAppletBase(String glEventListenerClazzName, int glSwapInterval, boolean noDefaultKeyListener, boolean glClosable, boolean glDebug, boolean glTrace) { - + this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; this.noDefaultKeyListener = noDefaultKeyListener; @@ -174,8 +174,8 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { glWindow.reparentWindow(awtParent); } } - }).start(); - } + }).start(); + } } } } ); @@ -203,7 +203,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { if(glEventListener instanceof KeyListener) { glWindow.addKeyListener((KeyListener)glEventListener); } - + if(!noDefaultKeyListener) { glWindow.addKeyListener(this); } @@ -216,7 +216,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { glAnimator.setThreadGroup(tg); glAnimator.add(glWindow); glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null); - + } catch (Throwable t) { throw new RuntimeException(t); } @@ -262,14 +262,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { if(glDebug) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) {e.printStackTrace();} } if(glSwapInterval>=0) { @@ -317,9 +317,9 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { } } } - + @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(KeyEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java index bc67cbee6..7dda47534 100644 --- a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java @@ -41,15 +41,15 @@ import jogamp.newt.Debug; * * - touchSlop (scaled in pixels): * - Min. movement w/ 2 pointer within ScaledDoubleTapSlop starting 'scroll' mode - * + * * - Avoid computation if not within gesture, especially for MOVE/DRAG - * + * * - Only allow gesture to start with PRESS - * - * - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop - * + * + * - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop + * * - Tolerate temporary lift 1 of 2 pointer - * + * * - Always validate pointer-id * </pre> * </p> @@ -74,27 +74,27 @@ public class DoubleTapScrollGesture implements GestureHandler { public static final int SCROLL_SLOP_PIXEL; /** Two pointer 'double tap' slop in pixels (fallback), defaults to 104 pixels. Can be overriden by integer property <code>newt.event.double_tap_slop_pixel</code>.*/ public static final int DOUBLE_TAP_SLOP_PIXEL; - + /** Scroll threshold in millimeter, defaults to 3 mm. Can be overriden by integer property <code>newt.event.scroll_slop_mm</code>.*/ public static final float SCROLL_SLOP_MM; /** Two pointer 'double tap' slop in millimeter, defaults to 20 mm. Can be overriden by integer property <code>newt.event.double_tap_slop_mm</code>.*/ public static final float DOUBLE_TAP_SLOP_MM; - + static { Debug.initSingleton(); - + SCROLL_SLOP_PIXEL = Debug.getIntProperty("newt.event.scroll_slop_pixel", true, 16); DOUBLE_TAP_SLOP_PIXEL = Debug.getIntProperty("newt.event.double_tap_slop_pixel", true, 104); SCROLL_SLOP_MM = Debug.getIntProperty("newt.event.scroll_slop_mm", true, 3); DOUBLE_TAP_SLOP_MM = Debug.getIntProperty("newt.event.double_tap_slop_mm", true, 20); } - + private static final int ST_NONE = 0; private static final int ST_1PRESS = 1; private static final int ST_2PRESS_T = 2; private static final int ST_2PRESS_C = 3; private static final int ST_SCROLL = 4; - + private final int scrollSlop, scrollSlopSquare, doubleTapSlop, doubleTapSlopSquare; private final float[] scrollDistance = new float[] { 0f, 0f }; private int[] pIds = new int[] { -1, -1 }; @@ -104,18 +104,18 @@ public class DoubleTapScrollGesture implements GestureHandler { private int lastX, lastY; private int pointerDownCount; private MouseEvent hitGestureEvent; - + private static final int getSquareDistance(float x1, float y1, float x2, float y2) { final int deltaX = (int) x1 - (int) x2; final int deltaY = (int) y1 - (int) y2; return deltaX * deltaX + deltaY * deltaY; } - + private int gesturePointers(final MouseEvent e, final int excludeIndex) { - int j = 0; + int j = 0; for(int i=e.getPointerCount()-1; i>=0; i--) { if( excludeIndex != i ) { - final int id = e.getPointerId(i); + final int id = e.getPointerId(i); if( pIds[0] == id || pIds[1] == id ) { j++; } @@ -123,10 +123,10 @@ public class DoubleTapScrollGesture implements GestureHandler { } return j; } - + /** * scaledScrollSlop < scaledDoubleTapSlop - * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in <i>pixels</i>. + * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in <i>pixels</i>. * @param scaledDoubleTapSlop Distance in <i>pixels</i> between the first touch and second touch to still be considered a double tap. */ public DoubleTapScrollGesture(int scaledScrollSlop, int scaledDoubleTapSlop) { @@ -137,9 +137,9 @@ public class DoubleTapScrollGesture implements GestureHandler { pointerDownCount = 0; clear(true); if(DEBUG) { - System.err.println("DoubleTapScroll scrollSlop (scaled) "+scrollSlop); - System.err.println("DoubleTapScroll doubleTapSlop (scaled) "+doubleTapSlop); - } + System.err.println("DoubleTapScroll scrollSlop (scaled) "+scrollSlop); + System.err.println("DoubleTapScroll doubleTapSlop (scaled) "+doubleTapSlop); + } } public String toString() { @@ -160,17 +160,17 @@ public class DoubleTapScrollGesture implements GestureHandler { lastY = 0; } } - + @Override public boolean isWithinGesture() { return ST_2PRESS_C <= gestureState; } - + @Override public boolean hasGesture() { return null != hitGestureEvent; } - + @Override public InputEvent getGestureEvent() { if( null != hitGestureEvent ) { @@ -184,17 +184,17 @@ public class DoubleTapScrollGesture implements GestureHandler { modifiers |= com.jogamp.newt.event.InputEvent.SHIFT_MASK; } return new MouseEvent(MouseEvent.EVENT_MOUSE_WHEEL_MOVED, ge.getSource(), ge.getWhen(), modifiers, - ge.getAllPointerTypes(), ge.getAllPointerIDs(), - ge.getAllX(), ge.getAllY(), ge.getAllPressures(), ge.getMaxPressure(), + ge.getAllPointerTypes(), ge.getAllPointerIDs(), + ge.getAllX(), ge.getAllY(), ge.getAllPressures(), ge.getMaxPressure(), ge.getButton(), ge.getClickCount(), rotationXYZ, scrollSlop); } return null; } - + public final float[] getScrollDistanceXY() { return scrollDistance; } - + @Override public boolean process(final InputEvent in) { if( null != hitGestureEvent || !(in instanceof MouseEvent) ) { @@ -220,7 +220,7 @@ public class DoubleTapScrollGesture implements GestureHandler { final int y1 = pe.getY(1); final int xm = (x0+x1)/2; final int ym = (y0+y1)/2; - + if( ST_1PRESS == gestureState ) { final int sqDist = getSquareDistance(x0, y0, x1, y1); final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare; @@ -254,7 +254,7 @@ public class DoubleTapScrollGesture implements GestureHandler { System.err.println(this+".pressed: gPtr "+gPtr+", this "+lastX+"/"+lastY+", "+pe); } } break; - + case MouseEvent.EVENT_MOUSE_RELEASED: { pointerDownCount--; // lifted final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer @@ -269,7 +269,7 @@ public class DoubleTapScrollGesture implements GestureHandler { System.err.println(this+".released: gPtr "+gPtr+", "+pe); } } break; - + case MouseEvent.EVENT_MOUSE_DRAGGED: { if( 2 == pointerDownCount && ST_1PRESS < gestureState ) { final int gPtr = gesturePointers(pe, -1); @@ -289,11 +289,11 @@ public class DoubleTapScrollGesture implements GestureHandler { gestureState = ST_SCROLL; } } break; - + case ST_2PRESS_C: gestureState = ST_SCROLL; break; - + case ST_SCROLL: scrollDistance[0] = lastX - xm; scrollDistance[1] = lastY - ym; @@ -338,7 +338,7 @@ public class DoubleTapScrollGesture implements GestureHandler { } } } break; - + default: } return null != hitGestureEvent; diff --git a/src/newt/classes/com/jogamp/newt/event/GestureHandler.java b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java index 2c8f29bb7..2e98a8a01 100644 --- a/src/newt/classes/com/jogamp/newt/event/GestureHandler.java +++ b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java @@ -30,7 +30,7 @@ package com.jogamp.newt.event; import jogamp.newt.Debug; /** - * Generic gesture handler interface designed to allow pass-through + * Generic gesture handler interface designed to allow pass-through * filtering of {@link InputEvent}s. * <p> * To avoid negative impact on event processing, @@ -44,18 +44,18 @@ import jogamp.newt.Debug; */ public interface GestureHandler { public static final boolean DEBUG = Debug.debug("Window.MouseEvent"); - + /** A custom gesture event */ @SuppressWarnings("serial") public static class GestureEvent extends InputEvent { /** A gesture has been detected. */ public static final short EVENT_GESTURE_DETECTED = 400; - + private final GestureHandler handler; - + /** * Creates a gesture event with default type {@link #EVENT_GESTURE_DETECTED}. - * + * * @param source * @param when * @param modifiers @@ -65,7 +65,7 @@ public interface GestureHandler { super(EVENT_GESTURE_DETECTED, source, when, modifiers); this.handler = handler; } - + /** * Creates a gesture event with custom <i>event_type</i> ! * @param event_type must lie within [400..599] @@ -78,14 +78,14 @@ public interface GestureHandler { super(event_type, source, when, modifiers); this.handler = handler; } - + /** Return the {@link GestureHandler}, which produced the event. */ public final GestureHandler getHandler() { return handler; } } - + /** * Listener for {@link GestureEvent}s. - * + * * @see GestureEvent */ public static interface GestureListener extends NEWTEventListener @@ -93,50 +93,50 @@ public interface GestureHandler { /** {@link GestureHandler} {@link GestureHandler#hasGesture() has detected} the gesture. */ public void gestureDetected(GestureEvent gh); } - - /** - * Clears state of handler, i.e. resets all states incl. previous detected gesture. + + /** + * Clears state of handler, i.e. resets all states incl. previous detected gesture. * @param clearStarted if true, also clears {@link #isWithinGesture() started} state, * otherwise stay within gesture - if appropriate. - * Staying within a gesture allows fluent continuous gesture sequence, - * e.g. for scrolling. + * Staying within a gesture allows fluent continuous gesture sequence, + * e.g. for scrolling. */ public void clear(boolean clearStarted); - - /** + + /** * Returns true if a previous {@link #process(InputEvent)} command produced a gesture, - * which has not been {@link #clear(boolean) cleared}. + * which has not been {@link #clear(boolean) cleared}. * Otherwise returns false. - */ + */ public boolean hasGesture(); - - /** + + /** * Returns the corresponding {@link InputEvent} for the gesture as detected by * a previous {@link #process(InputEvent)}, which has not been {@link #clear(boolean) cleared}. * Otherwise returns null. * <p> * Only implemented for gestures mapping to {@link InputEvent}s. - * </p> - */ + * </p> + */ public InputEvent getGestureEvent(); - - /** + + /** * Returns true if within a gesture as detected by a previous {@link #process(InputEvent)} command, - * which has not been {@link #clear(boolean) cleared}. + * which has not been {@link #clear(boolean) cleared}. * Otherwise returns false. - */ + */ public boolean isWithinGesture(); /** * Process the given {@link InputEvent} and returns true if it produced the gesture. * Otherwise returns false. * <p> - * If a gesture was already detected previously and has not been cleared, - * method does not process the event and returns true. + * If a gesture was already detected previously and has not been cleared, + * method does not process the event and returns true. * </p> * <p> - * Besides validation of the event's details, - * the handler may also validate the {@link InputEvent.InputClass} and/or {@link InputEvent.InputType}. + * Besides validation of the event's details, + * the handler may also validate the {@link InputEvent.InputClass} and/or {@link InputEvent.InputType}. * </p> */ public boolean process(InputEvent e); diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java index 1bd67efa5..6520dafcf 100644 --- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.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. - * + * */ package com.jogamp.newt.event; @@ -43,17 +43,17 @@ public abstract class InputEvent extends NEWTEvent /** Interface marking class of input types */ public static interface InputClass { } - + /** Interface marking type of input devices */ public static interface InputType { } - + public static final int SHIFT_MASK = 1 << 0; public static final int CTRL_MASK = 1 << 1; public static final int META_MASK = 1 << 2; public static final int ALT_MASK = 1 << 3; public static final int ALT_GRAPH_MASK = 1 << 4; - + public static final int BUTTON1_MASK = 1 << 5; public static final int BUTTON2_MASK = 1 << 6; public static final int BUTTON3_MASK = 1 << 7; @@ -63,23 +63,23 @@ public abstract class InputEvent extends NEWTEvent public static final int BUTTON7_MASK = 1 << 11; public static final int BUTTON8_MASK = 1 << 12; public static final int BUTTON9_MASK = 1 << 13; - + public static final int BUTTONLAST_MASK = 1 << 20; // 16 buttons public static final int BUTTONALL_MASK = 0xffff << 5 ; // 16 buttons - + /** Event is caused by auto-repeat. */ public static final int AUTOREPEAT_MASK = 1 << 29; - + /** Pointer is confined, see {@link Window#confinePointer(boolean)}. */ public static final int CONFINED_MASK = 1 << 30; - + /** Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */ public static final int INVISIBLE_MASK = 1 << 31; - /** + /** * Returns the corresponding button mask for the given button. * <p> - * In case the given button lies outside + * In case the given button lies outside * of the valid range [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON_COUNT}], * null is returned. * </p> @@ -90,7 +90,7 @@ public abstract class InputEvent extends NEWTEvent } return 0; } - + protected InputEvent(short eventType, Object source, long when, int modifiers) { super(eventType, source, when); this.modifiers=modifiers; @@ -128,11 +128,11 @@ public abstract class InputEvent extends NEWTEvent public boolean isConfined() { return (modifiers&CONFINED_MASK)!=0; } - /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */ + /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */ public boolean isInvisible() { return (modifiers&INVISIBLE_MASK)!=0; } - + public StringBuilder getModifiersString(StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); @@ -141,7 +141,7 @@ public abstract class InputEvent extends NEWTEvent boolean isFirst = true; if(isShiftDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("shift"); } if(isControlDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("ctrl"); } - if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); } + if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); } if(isAltDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("alt"); } if(isAltGraphDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("altgr"); } if(isAutoRepeat()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("repeat"); } @@ -151,18 +151,18 @@ public abstract class InputEvent extends NEWTEvent if(isConfined()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("confined"); } if(isInvisible()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("invisible"); } sb.append("]"); - + return sb; } /** * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>. - * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}]. + * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}]. * If none is down, the resulting array is of length 0. */ public final short[] getButtonsDown() { final int len = getButtonDownCount(); - + final short[] res = new short[len]; int j = 0; for(int i=1; i<=MouseEvent.BUTTON_COUNT; i++) { @@ -174,13 +174,13 @@ public abstract class InputEvent extends NEWTEvent /** * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>. * @param button the button to test - * @return true if the given button is down + * @return true if the given button is down */ public final boolean isButtonDown(int button) { return ( modifiers & getButtonMask(button) ) != 0; } - /** + /** * Returns the number of pressed buttons by counting the set bits: * <pre> * getBitCount(modifiers & BUTTONALL_MASK); @@ -194,8 +194,8 @@ public abstract class InputEvent extends NEWTEvent public final int getButtonDownCount() { return IntBitfield.getBitCount(modifiers & BUTTONALL_MASK); } - - /** + + /** * Returns true if at least one button is pressed, otherwise false: * <pre> * 0 != ( modifiers & BUTTONALL_MASK ) @@ -209,11 +209,11 @@ public abstract class InputEvent extends NEWTEvent public final boolean isAnyButtonDown() { return 0 != ( modifiers & BUTTONALL_MASK ); } - + public String toString() { return toString(null).toString(); } - + public StringBuilder toString(StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java index 42ebea722..a89148574 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java @@ -4,14 +4,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 @@ -21,12 +21,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 com.jogamp.newt.event; public abstract class KeyAdapter implements KeyListener diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java index 085f598dc..81680bf32 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.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. - * + * */ package com.jogamp.newt.event; @@ -37,8 +37,8 @@ package com.jogamp.newt.event; import com.jogamp.common.util.IntBitfield; /** - * <a name="eventDelivery"><h5>KeyEvent Delivery</h5></a> - * + * <a name="eventDelivery"><h5>KeyEvent Delivery</h5></a> + * * Key events are delivered in the following order: * <p> * <table border="0"> @@ -48,10 +48,10 @@ import com.jogamp.common.util.IntBitfield; * </table> * </p> * In case the native platform does not - * deliver keyboard events in the above order or skip events, - * the NEWT driver will reorder and inject synthetic events if required. + * deliver keyboard events in the above order or skip events, + * the NEWT driver will reorder and inject synthetic events if required. * <p> - * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc., + * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc., * the {@link InputEvent#AUTOREPEAT_MASK} bit is added if repetition is detected, following above constraints. * </p> * <p> @@ -60,38 +60,38 @@ import com.jogamp.common.util.IntBitfield; P = pressed, R = released 0 = normal, 1 = auto-repeat - P(0), [ R(1), P(1), R(1), ..], R(0) + P(0), [ R(1), P(1), R(1), ..], R(0) * </pre> * The idea is if you mask out auto-repeat in your event listener * you just get one long pressed P/R tuple for {@link #isPrintableKey() printable} and {@link #isActionKey() Action} keys. * </p> * <p> - * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed} + * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed} * and {@link #EVENT_KEY_RELEASED released} events including {@link #isAutoRepeat() auto-repeat}. * </p> * <p> * {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events. * </p> * <p> - * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events + * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events * excluding {@link #isAutoRepeat() auto-repeat}. * They will also influence subsequent event's {@link #getModifiers() modifier} bits while pressed. * </p> - * + * * <a name="unicodeMapping"><h5>Unicode Mapping</h5></a> * <p> - * {@link #getKeyChar() Key-chars}, as well as + * {@link #getKeyChar() Key-chars}, as well as * {@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols} - * use the UTF-16 unicode space w/o collision. - * + * use the UTF-16 unicode space w/o collision. + * * </p> * <p> - * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols}, + * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols}, * i.e. {@link #isModifierKey() modifier-} and {@link #isActionKey() action-}keys, * are mapped to unicode's control and private range and do not collide w/ {@link #isPrintableKey() printable} unicode values * with the following exception. * </p> - * + * * <a name="unicodeCollision"><h5>Unicode Collision</h5></a> * <p> * The following {@link #getKeyCode() Key-code}s and {@link #getKeySymbol() key-symbol}s collide w/ unicode space:<br/> @@ -103,9 +103,9 @@ import com.jogamp.common.util.IntBitfield; * <p> * Collision was chosen for {@link #getKeyCode() Key-code} and {@link #getKeySymbol() key-symbol} mapping * to allow a minimal code range, i.e. <code>[0..255]</code>. - * The reduced code range in turn allows the implementation to utilize fast and small lookup tables, - * e.g. to implement a key-press state tracker. - * </p> + * The reduced code range in turn allows the implementation to utilize fast and small lookup tables, + * e.g. to implement a key-press state tracker. + * </p> * <pre> * http://www.utf8-chartable.de/unicode-utf8-table.pl * http://www.unicode.org/Public/5.1.0/ucd/PropList.txt @@ -136,7 +136,7 @@ public class KeyEvent extends InputEvent } } flags = _flags; - + // // Validate flags // @@ -147,12 +147,12 @@ public class KeyEvent extends InputEvent } } } - + public static KeyEvent create(short eventType, Object source, long when, int modifiers, short keyCode, short keySym, char keyChar) { return new KeyEvent(eventType, source, when, modifiers, keyCode, keySym, getModifierMask(keySym), keyChar); } - /** + /** * Returns the <i>UTF-16</i> character reflecting the {@link #getKeySymbol() key symbol} * incl. active {@link #isModifierKey() modifiers}. * @see #getKeySymbol() @@ -162,12 +162,12 @@ public class KeyEvent extends InputEvent return keyChar; } - /** + /** * Returns the virtual <i>key symbol</i> reflecting the current <i>keyboard layout</i>. * <p> * For {@link #isPrintableKey() printable keys}, the <i>key symbol</i> is the {@link #isModifierKey() unmodified} - * representation of the UTF-16 {@link #getKeyChar() key char}.<br/> - * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'. + * representation of the UTF-16 {@link #getKeyChar() key char}.<br/> + * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'. * </p> * @see #isPrintableKey() * @see #getKeyChar() @@ -176,18 +176,18 @@ public class KeyEvent extends InputEvent public final short getKeySymbol() { return keySym; } - - /** + + /** * Returns the virtual <i>key code</i> using a fixed mapping to the <i>US keyboard layout</i>. * <p> - * In contrast to {@link #getKeySymbol() key symbol}, <i>key code</i> - * uses a fixed <i>US keyboard layout</i> and therefore is keyboard layout independent. + * In contrast to {@link #getKeySymbol() key symbol}, <i>key code</i> + * uses a fixed <i>US keyboard layout</i> and therefore is keyboard layout independent. * </p> * <p> - * E.g. <i>virtual key code</i> {@link #VK_Y} denotes the same physical key - * regardless whether <i>keyboard layout</i> <code>QWERTY</code> or + * E.g. <i>virtual key code</i> {@link #VK_Y} denotes the same physical key + * regardless whether <i>keyboard layout</i> <code>QWERTY</code> or * <code>QWERTZ</code> is active. The {@link #getKeySymbol() key symbol} of the former is - * {@link #VK_Y}, where the latter produces {@link #VK_Y}. + * {@link #VK_Y}, where the latter produces {@link #VK_Y}. * </p> * @see #getKeyChar() * @see #getKeySymbol() @@ -228,9 +228,9 @@ public class KeyEvent extends InputEvent } return (short) keyChar; } - - /** - * Returns <code>true</code> if the given <code>virtualKey</code> represents a modifier key, otherwise <code>false</code>. + + /** + * Returns <code>true</code> if the given <code>virtualKey</code> represents a modifier key, otherwise <code>false</code>. * <p> * A modifier key is one of {@link #VK_SHIFT}, {@link #VK_CONTROL}, {@link #VK_ALT}, {@link #VK_ALT_GRAPH}, {@link #VK_META}. * </p> @@ -247,10 +247,10 @@ public class KeyEvent extends InputEvent return false; } } - + /** * If <code>vKey</code> is a {@link #isModifierKey() modifier key}, method returns the corresponding modifier mask, - * otherwise 0. + * otherwise 0. */ public static int getModifierMask(short vKey) { switch (vKey) { @@ -266,10 +266,10 @@ public class KeyEvent extends InputEvent } return 0; } - - /** + + /** * Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a modifier key, - * otherwise <code>false</code>. + * otherwise <code>false</code>. * <p> * See {@link #isModifierKey(short)} for details. * </p> @@ -280,8 +280,8 @@ public class KeyEvent extends InputEvent public final boolean isModifierKey() { return 0 != ( F_MODIFIER_MASK & flags ) ; } - - /** + + /** * Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a non-printable and * non-{@link #isModifierKey(short) modifier} action key, otherwise <code>false</code>. * <p> @@ -289,12 +289,12 @@ public class KeyEvent extends InputEvent * <code> A = U - ( P + M ) </code> * </p> * @see #isPrintableKey() - * @see #isModifierKey() + * @see #isModifierKey() */ public final boolean isActionKey() { return 0 != ( F_ACTION_MASK & flags ) ; } - + /** * Returns <code>true</code> if given <code>uniChar</code> represents a printable character, * i.e. a value other than {@link #VK_UNDEFINED} and not a control or non-printable private code. @@ -307,7 +307,7 @@ public class KeyEvent extends InputEvent * <p> * Distinction of key character and virtual key code is made due to <a href="#unicodeCollision">unicode collision</a>. * </p> - * + * * @param uniChar the UTF-16 unicode value, which maybe a virtual key code or key character. * @param isKeyChar true if <code>uniChar</code> is a key character, otherwise a virtual key code */ @@ -333,9 +333,9 @@ public class KeyEvent extends InputEvent return VK_UNDEFINED != uniChar; } - /** - * Returns <code>true</code> if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char} - * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED} + /** + * Returns <code>true</code> if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char} + * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED} * and not a control or non-printable private code. * <p> * A printable character is neither a {@link #isModifierKey(short) modifier key}, nor an {@link #isActionKey(short) action key}. @@ -347,7 +347,7 @@ public class KeyEvent extends InputEvent public final boolean isPrintableKey() { return 0 != ( F_PRINTABLE_MASK & flags ) ; } - + private final short keyCode; private final short keySym; private final char keyChar; @@ -370,7 +370,7 @@ public class KeyEvent extends InputEvent public static class NonPrintableRange { /** min. unicode value, inclusive */ - public short min; + public short min; /** max. unicode value, inclusive */ public short max; /** true if valid for keyChar values as well, otherwise only valid for keyCode and keySym due to collision. */ @@ -381,7 +381,7 @@ public class KeyEvent extends InputEvent this.inclKeyChar = inclKeyChar; } }; - /** + /** * Non printable key ranges, currently fixed to an array of size 4. * <p> * Not included, queried upfront: @@ -390,98 +390,98 @@ public class KeyEvent extends InputEvent * <li>{@link #VK_TAB}</li> * <li>{@link #VK_ENTER}</li> * </ul> - * </p> + * </p> */ - public final static NonPrintableRange[] nonPrintableKeys = { + public final static NonPrintableRange[] nonPrintableKeys = { new NonPrintableRange( (short)0x0000, (short)0x001F, true ), // Unicode: Non printable controls: [0x00 - 0x1F], see exclusion above new NonPrintableRange( (short)0x0061, (short)0x0078, false), // Small 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym - Re-used for Fn (collision) - new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable! + new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable! new NonPrintableRange( (short)0xE000, (short)0xF8FF, true ) // Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable) }; - + // // Unicode: Non printable controls: [0x00 - 0x1F] // - + /** * This value, {@value}, is used to indicate that the keyCode is unknown. */ public static final short VK_UNDEFINED = (short) 0x0; - + static final short VK_FREE01 = (short) 0x01; - + /** Constant for the HOME function key. ASCII: Start Of Text. */ public static final short VK_HOME = (short) 0x02; - + /** Constant for the END function key. ASCII: End Of Text. */ public static final short VK_END = (short) 0x03; - + /** Constant for the END function key. ASCII: End Of Transmission. */ public static final short VK_FINAL = (short) 0x04; /** Constant for the PRINT function key. ASCII: Enquiry. */ public static final short VK_PRINTSCREEN = (short) 0x05; - + static final short VK_FREE06 = (short) 0x06; static final short VK_FREE07 = (short) 0x07; - + /** Constant for the BACK SPACE key "\b", matching ASCII. Printable! */ public static final short VK_BACK_SPACE = (short) 0x08; - + /** Constant for the HORIZ TAB key "\t", matching ASCII. Printable! */ public static final short VK_TAB = (short) 0x09; - + /** LINE_FEED "\n", matching ASCII, n/a on keyboard. */ static final short VK_FREE0A = (short) 0x0A; - + /** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */ public static final short VK_PAGE_DOWN = (short) 0x0B; - + /** Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. */ public static final short VK_CLEAR = (short) 0x0C; - + /** Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. Printable! */ public static final short VK_ENTER = (short) 0x0D; - + static final short VK_FREE0E = (short) 0x0E; - + /** Constant for the CTRL function key. ASCII: shift-in. */ public static final short VK_SHIFT = (short) 0x0F; /** Constant for the PAGE UP function key. ASCII: Data Link Escape. */ public static final short VK_PAGE_UP = (short) 0x10; - + /** Constant for the CTRL function key. ASCII: device-ctrl-one. */ public static final short VK_CONTROL = (short) 0x11; - + /** Constant for the left ALT function key. ASCII: device-ctrl-two. */ public static final short VK_ALT = (short) 0x12; - + /** Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII: device-ctrl-three. */ public static final short VK_ALT_GRAPH = (short) 0x13; - + /** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */ public static final short VK_CAPS_LOCK = (short) 0x14; - + static final short VK_FREE15 = (short) 0x15; - + /** Constant for the PAUSE function key. ASCII: sync-idle. */ public static final short VK_PAUSE = (short) 0x16; - + /** <b>scroll lock</b> key. ASCII: End Of Transmission Block. */ public static final short VK_SCROLL_LOCK = (short) 0x17; - + /** Constant for the CANCEL function key. ASCII: Cancel. */ public static final short VK_CANCEL = (short) 0x18; - + static final short VK_FREE19 = (short) 0x19; - + /** Constant for the INSERT function key. ASCII: Substitute. */ public static final short VK_INSERT = (short) 0x1A; - + /** Constant for the ESCAPE function key. ASCII: Escape. */ public static final short VK_ESCAPE = (short) 0x1B; - + /** Constant for the Convert function key, Japanese "henkan". ASCII: File Separator. */ public static final short VK_CONVERT = (short) 0x1C; @@ -496,48 +496,48 @@ public class KeyEvent extends InputEvent // // Unicode: Printable [0x20 - 0x7E] - // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys + // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys // - + /** Constant for the SPACE function key. ASCII: SPACE. */ public static final short VK_SPACE = (short) 0x20; - + /** Constant for the "!" key. */ public static final short VK_EXCLAMATION_MARK = (short) 0x21; /** Constant for the """ key. */ public static final short VK_QUOTEDBL = (short) 0x22; - + /** Constant for the "#" key. */ public static final short VK_NUMBER_SIGN = (short) 0x23; /** Constant for the "$" key. */ public static final short VK_DOLLAR = (short) 0x24; - + /** Constant for the "%" key. */ public static final short VK_PERCENT = (short) 0x25; - + /** Constant for the "&" key. */ public static final short VK_AMPERSAND = (short) 0x26; - + /** Constant for the "'" key. */ public static final short VK_QUOTE = (short) 0x27; - + /** Constant for the "(" key. */ public static final short VK_LEFT_PARENTHESIS = (short) 0x28; - + /** Constant for the ")" key. */ public static final short VK_RIGHT_PARENTHESIS = (short) 0x29; - + /** Constant for the "*" key */ public static final short VK_ASTERISK = (short) 0x2A; - + /** Constant for the "+" key. */ public static final short VK_PLUS = (short) 0x2B; - + /** Constant for the comma key, "," */ public static final short VK_COMMA = (short) 0x2C; - + /** Constant for the minus key, "-" */ public static final short VK_MINUS = (short) 0x2D; @@ -582,13 +582,13 @@ public class KeyEvent extends InputEvent /** Constant for the equals key, ">" */ public static final short VK_GREATER = (short) 0x3E; - + /** Constant for the equals key, "?" */ public static final short VK_QUESTIONMARK = (short) 0x3F; - + /** Constant for the equals key, "@" */ public static final short VK_AT = (short) 0x40; - + /** VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A) */ public static final short VK_A = (short) 0x41; /** See {@link #VK_A}. */ @@ -656,17 +656,17 @@ public class KeyEvent extends InputEvent /** Constant for the "_" key */ public static final short VK_UNDERSCORE = (short) 0x5F; - + /** Constant for the "`" key */ public static final short VK_BACK_QUOTE = (short) 0x60; - + /** Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym. */ - - /** - * Constant for the F<i>n</i> function keys. + + /** + * Constant for the F<i>n</i> function keys. * <p> * F1..F24, i.e. F<i>n</i>, are mapped from on <code>0x60+n</code> -> <code>[0x61 .. 0x78]</code>. - * </p> + * </p> * <p> * <b>Warning:</b> The F<i>n</i> function keys <b>do collide</b> with unicode characters small 'a' thru 'x'!<br/> * See <a href="#unicodeCollision">Unicode Collision</a> for details. @@ -743,26 +743,26 @@ public class KeyEvent extends InputEvent /** Constant for the F24 function key. See {@link #VK_F1}. */ public static final short VK_F24 = (short) ( 0x60+24 ); - + /** Constant for the "{" key */ public static final short VK_LEFT_BRACE = (short) 0x7B; /** Constant for the "|" key */ public static final short VK_PIPE = (short) 0x7C; /** Constant for the "}" key */ public static final short VK_RIGHT_BRACE = (short) 0x7D; - + /** Constant for the "~" key, matching ASCII */ public static final short VK_TILDE = (short) 0x7E; - + // // Unicode: Non printable controls: [0x7F - 0x9F] // // Numpad keys [0x7F - 0x8E] are printable // - + /** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */ public static final short VK_SEPARATOR = (short) 0x7F; - + /** Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control. */ public static final short VK_NUMPAD0 = (short) 0x80; /** See {@link #VK_NUMPAD0}. */ @@ -783,28 +783,28 @@ public class KeyEvent extends InputEvent public static final short VK_NUMPAD8 = (short) 0x88; /** See {@link #VK_NUMPAD0}. */ public static final short VK_NUMPAD9 = (short) 0x89; - + /** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */ public static final short VK_DECIMAL = (short) 0x8A; - + /** Numeric keypad <b>add</b> key. Non printable UTF control. */ public static final short VK_ADD = (short) 0x8B; /** Numeric keypad <b>subtract</b> key. Non printable UTF control. */ public static final short VK_SUBTRACT = (short) 0x8C; - + /** Numeric keypad <b>multiply</b> key. Non printable UTF control. */ public static final short VK_MULTIPLY = (short) 0x8D; - + /** Numeric keypad <b>divide</b> key. Non printable UTF control. */ public static final short VK_DIVIDE = (short) 0x8E; - + /** Constant for the DEL key, matching ASCII. Non printable UTF control. */ public static final short VK_DELETE = (short) 0x93; - + /** Numeric keypad <b>num lock</b> key. Non printable UTF control. */ public static final short VK_NUM_LOCK = (short) 0x94; - + /** Constant for the cursor- or numerical-pad <b>left</b> arrow key. Non printable UTF control. */ public static final short VK_LEFT = (short) 0x95; @@ -816,22 +816,22 @@ public class KeyEvent extends InputEvent /** Constant for the cursor- or numerical pad <b>down</b> arrow key. Non printable UTF control. */ public static final short VK_DOWN = (short) 0x98; - + /** Constant for the Context Menu key. Non printable UTF control. */ public static final short VK_CONTEXT_MENU = (short) 0x99; /** * Constant for the MS "Windows" function key. - * It is used for both the left and right version of the key. + * It is used for both the left and right version of the key. */ public static final short VK_WINDOWS = (short) 0x9A; /** Constant for the Meta function key. */ public static final short VK_META = (short) 0x9B; - + /** Constant for the Help function key. */ public static final short VK_HELP = (short) 0x9C; - + /** Constant for the Compose function key. */ public static final short VK_COMPOSE = (short) 0x9D; @@ -840,21 +840,21 @@ public class KeyEvent extends InputEvent /** Constant for the Stop function key. */ public static final short VK_STOP = (short) 0x9F; - + // // Unicode: Printable [0x00A0 - 0xDFFF] // - + /** Constant for the inverted exclamation mark key. */ public static final short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1; - + /** Constant for the Euro currency sign key. */ public static final short VK_EURO_SIGN = (short) 0x20AC; // // Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable) // - + /* for Sun keyboards */ public static final short VK_CUT = (short) 0xF879; public static final short VK_COPY = (short) 0xF87A; @@ -871,7 +871,7 @@ public class KeyEvent extends InputEvent */ /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */ public static final short VK_INPUT_METHOD_ON_OFF = (short) 0xF890; - + /** * Constant for the Code Input function key. */ diff --git a/src/newt/classes/com/jogamp/newt/event/KeyListener.java b/src/newt/classes/com/jogamp/newt/event/KeyListener.java index b3927d81a..4b16ab61e 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyListener.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyListener.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,22 +29,22 @@ * 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 com.jogamp.newt.event; /** * Listener for {@link KeyEvent}s. - * + * * @see KeyEvent */ public interface KeyListener extends NEWTEventListener { /** A key has been {@link KeyEvent#EVENT_KEY_PRESSED pressed}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}. */ public void keyPressed(KeyEvent e); - - /** + + /** * A key has been {@link KeyEvent#EVENT_KEY_RELEASED released}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}. * <p> * To simulated the removed <code>keyTyped(KeyEvent e)</code> semantics, @@ -52,9 +52,9 @@ public interface KeyListener extends NEWTEventListener * <pre> if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; - } + } * </pre> - * </p> + * </p> */ public void keyReleased(KeyEvent e); } diff --git a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java index c47936a7a..77c66a2da 100644 --- a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java @@ -35,19 +35,19 @@ import com.jogamp.newt.MonitorMode; public class MonitorEvent extends OutputEvent { public static final short EVENT_MONITOR_MODE_CHANGE_NOTIFY = 600; public static final short EVENT_MONITOR_MODE_CHANGED = 601; - + private final MonitorMode mode; - + public MonitorEvent (short eventType, MonitorDevice source, long when, MonitorMode mode) { super(eventType, source, when); this.mode = mode; } - + /** Returns the {@link #getSource() source}, which is a {@link MonitorDevice}. */ public final MonitorDevice getMonitor() { return (MonitorDevice)source; } - + public final MonitorMode getMode() { return mode; } - + public static String getEventTypeString(short type) { switch(type) { case EVENT_MONITOR_MODE_CHANGE_NOTIFY: return "EVENT_MONITOR_MODE_CHANGE_NOTIFY"; @@ -55,7 +55,7 @@ public class MonitorEvent extends OutputEvent { default: return "unknown (" + type + ")"; } } - + public final String toString() { return toString(null).toString(); } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java index 3607ae634..652f87d5b 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.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 com.jogamp.newt.event; public abstract class MouseAdapter implements MouseListener diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 57dd7e68c..4d7cc3b36 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.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. - * + * */ package com.jogamp.newt.event; @@ -37,12 +37,12 @@ package com.jogamp.newt.event; /** * Pointer event of type {@link PointerType}. * <p> - * The historical misleading class name may change in the future to <code>PointerEvent</code>. + * The historical misleading class name may change in the future to <code>PointerEvent</code>. * </p> * <p> * http://www.w3.org/Submission/pointer-events/#pointerevent-interface * </p> - * <a name="multiPtrEvent"><h5>Multiple-Pointer Events</h5></a> + * <a name="multiPtrEvent"><h5>Multiple-Pointer Events</h5></a> * <p> * In case an instance represents a multiple-pointer event, i.e. {@link #getPointerCount()} is > 1, * the first data element of the multiple-pointer fields represents the pointer triggering this event.<br/> @@ -62,10 +62,10 @@ package com.jogamp.newt.event; * </p> * <p> * If representing a multiple-pointer event, the {@link #getButton() button number} is mapped to the <i>first {@link #getPointerId(int) pointer ID}</i> - * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers} + * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers} * field represent the pressed pointer IDs.<br> * Hence users can query the pressed button count as well as the pressed pointer count via {@link InputEvent#getButtonDownCount()} - * or use the simple query {@link InputEvent#isAnyButtonDown()}. + * or use the simple query {@link InputEvent#isAnyButtonDown()}. * </p> */ @SuppressWarnings("serial") @@ -75,7 +75,7 @@ public class MouseEvent extends InputEvent public static enum PointerClass implements InputEvent.InputClass { Offscreen, Onscreen, Undefined; } - + /** Type of pointer devices */ public static enum PointerType implements InputEvent.InputType { /** {@link PointerClass#Offscreen} mouse. Ordinal 0. */ @@ -88,10 +88,10 @@ public class MouseEvent extends InputEvent Pen(PointerClass.Onscreen), /** {@link PointerClass#Undefined} ?. Ordinal 4. */ Undefined(PointerClass.Undefined); - + public PointerClass getPointerClass() { return pc; } - - /** + + /** * Returns the matching PointerType value corresponding to the given PointerType's integer ordinal. * <pre> * given: @@ -108,8 +108,8 @@ public class MouseEvent extends InputEvent } throw new IllegalArgumentException("Ordinal "+ordinal+" out of range of PointerType.values()[0.."+(all.length-1)+"]"); } - - /** + + /** * Returns the PointerType array of matching PointerType values corresponding to the given PointerType's integer ordinal values. * <p> * See {@link #valueOf(int)}. @@ -124,13 +124,13 @@ public class MouseEvent extends InputEvent } return types; } - + private PointerType(PointerClass pc) { this.pc = pc; } PointerClass pc; } - + /** ID for button 1, value <code>1</code> */ public static final short BUTTON1 = 1; /** ID for button 2, value <code>2</code> */ @@ -149,17 +149,17 @@ public class MouseEvent extends InputEvent public static final short BUTTON8 = 8; /** ID for button 6, value <code>9</code> */ public static final short BUTTON9 = 9; - + /** Maximum number of buttons, value <code>16</code> */ public static final short BUTTON_COUNT = 16; - /** + /** * Maximum number of buttons, value <code>16</code>. * @deprecated Use {@link #BUTTON_COUNT} .. semantics. */ public static final short BUTTON_NUMBER = 16; - - /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */ + + /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */ public static final float[] getRotationXYZ(final float rotationXorY, final int mods) { final float[] rotationXYZ = new float[] { 0f, 0f, 0f }; if( 0 != ( mods & InputEvent.SHIFT_MASK ) ) { @@ -169,14 +169,14 @@ public class MouseEvent extends InputEvent } return rotationXYZ; } - - public static final short getClickTimeout() { - return 300; + + public static final short getClickTimeout() { + return 300; } - - /** + + /** * Constructor for traditional one-pointer event. - * + * * @param eventType * @param source * @param when @@ -193,7 +193,7 @@ public class MouseEvent extends InputEvent int modifiers, int x, int y, short clickCount, short button, float[] rotationXYZ, float rotationScale) { - super(eventType, source, when, modifiers); + super(eventType, source, when, modifiers); this.x = new int[]{x}; this.y = new int[]{y}; switch(eventType) { @@ -214,15 +214,15 @@ public class MouseEvent extends InputEvent this.pointerType = constMousePointerTypes; } - /** + /** * Constructor for a multiple-pointer event. * <p> * First element of multiple-pointer arrays represents the pointer which triggered the event! * </p> - * <p> + * <p> * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * </p> - * + * * @param eventType * @param source * @param when @@ -239,12 +239,12 @@ public class MouseEvent extends InputEvent * @param rotationXYZ Rotation of all axis * @param rotationScale Rotation scale */ - public MouseEvent(short eventType, Object source, long when, int modifiers, - PointerType pointerType[], short[] pointerID, - int[] x, int[] y, float[] pressure, float maxPressure, + public MouseEvent(short eventType, Object source, long when, int modifiers, + PointerType pointerType[], short[] pointerID, + int[] x, int[] y, float[] pressure, float maxPressure, short button, short clickCount, float[] rotationXYZ, float rotationScale) { - super(eventType, source, when, modifiers); + super(eventType, source, when, modifiers); this.x = x; this.y = y; final int pointerCount = pointerType.length; @@ -266,12 +266,12 @@ public class MouseEvent extends InputEvent this.rotationScale = rotationScale; this.pointerType = pointerType; } - + public MouseEvent createVariant(short newEventType) { return new MouseEvent(newEventType, source, getWhen(), getModifiers(), pointerType, pointerID, x, y, pressure, maxPressure, button, clickCount, rotationXYZ, rotationScale); } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return the count of pointers involved in this event @@ -279,7 +279,7 @@ public class MouseEvent extends InputEvent public final int getPointerCount() { return pointerType.length; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return the {@link PointerType} for the data at index or null if index not available. @@ -290,7 +290,7 @@ public class MouseEvent extends InputEvent } return pointerType[index]; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return array of all {@link PointerType}s for all pointers @@ -298,10 +298,10 @@ public class MouseEvent extends InputEvent public final PointerType[] getAllPointerTypes() { return pointerType; } - + /** * Return the pointer id for the given index or -1 if index not available. - * <p> + * <p> * IDs start w/ 0 and are consecutive numbers. * </p> * <p> @@ -317,7 +317,7 @@ public class MouseEvent extends InputEvent } return pointerID[index]; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return the pointer index for the given pointer id or -1 if id not available. @@ -332,7 +332,7 @@ public class MouseEvent extends InputEvent } return -1; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return array of all pointer IDs for all pointers. IDs start w/ 0 and are consecutive numbers. @@ -340,15 +340,15 @@ public class MouseEvent extends InputEvent public final short[] getAllPointerIDs() { return pointerID; } - - /** + + /** * Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1]. * <p> * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move. * </p> * <p> * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. - * </p> + * </p> */ public final short getButton() { return button; @@ -357,16 +357,16 @@ public class MouseEvent extends InputEvent public final short getClickCount() { return clickCount; } - + public final int getX() { return x[0]; } - + public final int getY() { return y[0]; } - /** + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @param index pointer-index within [0 .. {@link #getPointerCount()}-1] * @return X-Coord associated with the pointer-index. @@ -376,7 +376,7 @@ public class MouseEvent extends InputEvent return x[index]; } - /** + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @param index pointer-index within [0 .. {@link #getPointerCount()}-1] * @return Y-Coord associated with the pointer-index. @@ -385,7 +385,7 @@ public class MouseEvent extends InputEvent public final int getY(int index) { return y[index]; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return array of all X-Coords for all pointers @@ -393,7 +393,7 @@ public class MouseEvent extends InputEvent public final int[] getAllX() { return x; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return array of all Y-Coords for all pointers @@ -401,9 +401,9 @@ public class MouseEvent extends InputEvent public final int[] getAllY() { return y; } - + /** - * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code> + * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code> * @return The pressure associated with the pointer-index 0. * The value of zero is return if not available. * @see #getMaxPressure() @@ -411,11 +411,11 @@ public class MouseEvent extends InputEvent public final float getPressure(boolean normalized){ return normalized ? pressure[0] / maxPressure : pressure[0]; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @param index pointer-index within [0 .. {@link #getPointerCount()}-1] - * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code> + * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code> * @return The pressure associated with the pointer-index. * The value of zero is return if not available. * @see #getMaxPressure() @@ -423,7 +423,7 @@ public class MouseEvent extends InputEvent public final float getPressure(int index, boolean normalized){ return normalized ? pressure[index] / maxPressure : pressure[index]; } - + /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @return array of all raw, un-normalized pressures for all pointers @@ -431,12 +431,12 @@ public class MouseEvent extends InputEvent public final float[] getAllPressures() { return pressure; } - - /** + + /** * Returns the maximum pressure known for the input device generating this event. * <p> * This value may be self calibrating on devices/OS, where no known maximum pressure is known. - * Hence subsequent events may return a higher value. + * Hence subsequent events may return a higher value. * </p> * <p> * Self calibrating maximum pressure is performed on: @@ -448,25 +448,25 @@ public class MouseEvent extends InputEvent public final float getMaxPressure() { return maxPressure; } - + /** * Returns a 3-component float array filled with the values of the rotational axis * in the following order: horizontal-, vertical- and z-axis. - * <p> + * <p> * A vertical rotation of <b>> 0.0f is up</b> and <b>< 0.0f is down</b>. * </p> * <p> - * A horizontal rotation of <b>> 0.0f is left</b> and <b>< 0.0f is right</b>. + * A horizontal rotation of <b>> 0.0f is left</b> and <b>< 0.0f is right</b>. * </p> * <p> - * A z-axis rotation of <b>> 0.0f is back</b> and <b>< 0.0f is front</b>. + * A z-axis rotation of <b>> 0.0f is back</b> and <b>< 0.0f is front</b>. * </p> * <p> * <i>However</i>, on some OS this might be flipped due to the OS <i>default</i> behavior. * The latter is true for OS X 10.7 (Lion) for example. * </p> * <p> - * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens}, + * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens}, * rotation events are usually produced by a 2-finger movement, where horizontal and vertical rotation values are filled. * </p> * <p> @@ -475,13 +475,13 @@ public class MouseEvent extends InputEvent * </p> * <p> * The {@link InputEvent#SHIFT_MASK} modifier is set in case <b>|horizontal| > |vertical|</b> value.<br/> - * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it. + * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it. * </p> * <p> * In case the pointer type is {@link PointerType#Mouse mouse}, * events are usually send in steps of one, ie. <i>-1.0f</i> and <i>1.0f</i>. * Higher values may result due to fast scrolling. - * Fractional values may result due to slow scrolling with high resolution devices.<br/> + * Fractional values may result due to slow scrolling with high resolution devices.<br/> * Here the button number refers to the wheel number. * </p> * <p> @@ -492,24 +492,24 @@ public class MouseEvent extends InputEvent public final float[] getRotation() { return rotationXYZ; } - - /** + + /** * Returns the scale used to determine the {@link #getRotation() rotation value}, * which semantics depends on the {@link #getPointerType() pointer type's} {@link PointerClass}. * <p> * For {@link PointerClass#Offscreen}, the scale is usually <code>1.0f</code> and denominates * an abstract value without association to a physical value. - * </p> + * </p> * <p> * For {@link PointerClass#Onscreen}, the scale varies and denominates - * the divisor of the distance the finger[s] have moved on the screen. - * Hence <code>scale * rotation</code> reproduces the screen distance in pixels the finger[s] have moved. - * </p> + * the divisor of the distance the finger[s] have moved on the screen. + * Hence <code>scale * rotation</code> reproduces the screen distance in pixels the finger[s] have moved. + * </p> */ public final float getRotationScale() { return rotationScale; } - + public final String toString() { return toString(null).toString(); } @@ -533,7 +533,7 @@ public class MouseEvent extends InputEvent .append("p[").append(pressure[i]).append("/").append(maxPressure).append("=").append(pressure[i]/maxPressure).append("]"); } sb.append("]"); - } + } sb.append(", "); return super.toString(sb).append("]"); } @@ -551,14 +551,14 @@ public class MouseEvent extends InputEvent default: return "unknown (" + type + ")"; } } - + /** PointerType for each pointer (multiple pointer) */ private final PointerType pointerType[]; - /** + /** * Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers. - * <p> + * <p> * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move. - * </p> + * </p> */ private final short pointerID[]; /** X-axis for each pointer (multiple pointer) */ @@ -581,11 +581,11 @@ public class MouseEvent extends InputEvent /** Rotation scale */ private final float rotationScale; private final float maxPressure; - + private static final float[] constMousePressure0 = new float[]{0f}; private static final float[] constMousePressure1 = new float[]{1f}; private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse }; - + public static final short EVENT_MOUSE_CLICKED = 200; public static final short EVENT_MOUSE_ENTERED = 201; public static final short EVENT_MOUSE_EXITED = 202; diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java index ce6796081..5378080b9 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.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. - * + * */ package com.jogamp.newt.event; @@ -38,7 +38,7 @@ import com.jogamp.newt.event.MouseEvent.PointerType; /** * Listener for {@link MouseEvent}s. - * + * * @see MouseEvent */ public interface MouseListener extends NEWTEventListener @@ -50,13 +50,13 @@ public interface MouseListener extends NEWTEventListener public void mouseReleased(MouseEvent e); public void mouseMoved(MouseEvent e); public void mouseDragged(MouseEvent e); - + /** * Traditional event name originally produced by a {@link PointerType#Mouse mouse} pointer type. * <p> * Triggered for any rotational pointer events, see - * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}. - * </p> + * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}. + * </p> */ public void mouseWheelMoved(MouseEvent e); } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java index 02bb4f929..022e2d0e1 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.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. - * + * */ package com.jogamp.newt.event; @@ -50,7 +50,7 @@ package com.jogamp.newt.event; */ @SuppressWarnings("serial") public class NEWTEvent extends java.util.EventObject { - /** + /** * See {@link #setConsumed(boolean)} for description. */ public static final Object consumedTag = new Object(); @@ -78,11 +78,11 @@ public class NEWTEvent extends java.util.EventObject { return when; } - /** + /** * Attach the passed object to this event.<br> * If an object was previously attached, it will be replaced.<br> * Attachments to NEWT events allow users to pass on information - * from one custom listener to another, ie custom listener to listener + * from one custom listener to another, ie custom listener to listener * communication. * @param attachment User application specific object */ @@ -90,14 +90,14 @@ public class NEWTEvent extends java.util.EventObject { this.attachment = attachment; } - /** + /** * @return The user application specific attachment, or null */ public final Object getAttachment() { return attachment; } - - /** + + /** * Returns <code>true</code> if this events has been {@link #setConsumed(boolean) consumed}, * otherwise <code>false</code>. * @see #setConsumed(boolean) @@ -105,8 +105,8 @@ public class NEWTEvent extends java.util.EventObject { public final boolean isConsumed() { return consumedTag == attachment; } - - /** + + /** * If <code>consumed</code> is <code>true</code>, this event is marked as consumed, * ie. the event will not be propagated any further to potential <i>other</i> event listener. * Otherwise the event will be propagated to other event listener, the default. @@ -130,7 +130,7 @@ public class NEWTEvent extends java.util.EventObject { setAttachment( null ); } } - + public String toString() { return toString(null).toString(); } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java index 6aa19e5f8..14fba6742 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.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,18 +20,18 @@ * 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 com.jogamp.newt.event; public interface NEWTEventConsumer { - /** - * Consume the event + /** + * Consume the event * * @return true if the event has been consumed, * otherwise it returns false for later propagation. diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java index fe224bba6..7dd56ad1e 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.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 com.jogamp.newt.event; import java.util.LinkedList; diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java index 677136573..f7ee3d739 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.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. - * + * */ package com.jogamp.newt.event; diff --git a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java index 86fa95877..80c7780f8 100644 --- a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java @@ -39,7 +39,7 @@ public abstract class OutputEvent extends NEWTEvent public String toString() { return toString(null).toString(); } - + public StringBuilder toString(StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java index eceea053d..d275eab46 100644 --- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java @@ -35,7 +35,7 @@ import jogamp.newt.Debug; * 2 pointer zoom, a.k.a. <i>pinch to zoom</i>, gesture handler processing {@link MouseEvent}s * while producing {@link ZoomEvent}s if gesture is completed. * <p> - * Zoom value lies within [0..2], with 1 as <i>1:1</i>. + * Zoom value lies within [0..2], with 1 as <i>1:1</i>. * </p> * <pre> * - choosing the smallest surface edge (width/height -> x/y) @@ -44,7 +44,7 @@ import jogamp.newt.Debug; */ public class PinchToZoomGesture implements GestureHandler { public static final boolean DEBUG = Debug.debug("Window.MouseEvent"); - + /** A {@link GestureHandler.GestureEvent} denominating zoom. */ @SuppressWarnings("serial") public static class ZoomEvent extends GestureEvent { @@ -57,10 +57,10 @@ public class PinchToZoomGesture implements GestureHandler { } /** Triggering {@link MouseEvent} */ public final MouseEvent getTrigger() { return pe; } - /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */ + /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */ public final float getZoom() { return zoom; } } - + private final NativeSurface surface; private float zoom; private int zoomLastEdgeDist; @@ -68,7 +68,7 @@ public class PinchToZoomGesture implements GestureHandler { private boolean zoomMode; private ZoomEvent zoomEvent; private short[] pIds = new short[] { -1, -1 }; - + public PinchToZoomGesture(NativeSurface surface) { clear(true); this.surface = surface; @@ -80,10 +80,10 @@ public class PinchToZoomGesture implements GestureHandler { } private int gesturePointers(final MouseEvent e, final int excludeIndex) { - int j = 0; + int j = 0; for(int i=e.getPointerCount()-1; i>=0; i--) { if( excludeIndex != i ) { - final int id = e.getPointerId(i); + final int id = e.getPointerId(i); if( pIds[0] == id || pIds[1] == id ) { j++; } @@ -91,7 +91,7 @@ public class PinchToZoomGesture implements GestureHandler { } return j; } - + @Override public void clear(boolean clearStarted) { zoomEvent = null; @@ -103,31 +103,31 @@ public class PinchToZoomGesture implements GestureHandler { pIds[1] = -1; } } - + @Override public boolean isWithinGesture() { return zoomMode; } - + @Override public boolean hasGesture() { return null != zoomEvent; } - + @Override public InputEvent getGestureEvent() { return zoomEvent; } - - /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */ + + /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */ public final float getZoom() { return zoom; } - /** Set zoom value within [0..2], with 1 as <i>1:1</i>. */ + /** Set zoom value within [0..2], with 1 as <i>1:1</i>. */ public final void setZoom(float zoom) { this.zoom=zoom; } - + @Override public boolean process(final InputEvent in) { if( null != zoomEvent || !(in instanceof MouseEvent) ) { @@ -137,15 +137,15 @@ public class PinchToZoomGesture implements GestureHandler { if( pe.getPointerType(0).getPointerClass() != MouseEvent.PointerClass.Onscreen ) { return false; } - + final int pointerDownCount = pe.getPointerCount(); final int eventType = pe.getEventType(); final boolean useY = surface.getWidth() >= surface.getHeight(); // use smallest dimension switch ( eventType ) { case MouseEvent.EVENT_MOUSE_PRESSED: { if( 1 == pointerDownCount ) { - pIds[0] = pe.getPointerId(0); - pIds[1] = -1; + pIds[0] = pe.getPointerId(0); + pIds[1] = -1; } else if ( 2 <= pointerDownCount ) { // && 1 == gesturePointers(pe, 0) /* w/o pressed pointer */) { pIds[0] = pe.getPointerId(0); pIds[1] = pe.getPointerId(1); @@ -155,13 +155,13 @@ public class PinchToZoomGesture implements GestureHandler { System.err.println(this+".pressed: down "+pointerDownCount+", gPtr "+gesturePointers(pe, -1)+", event "+pe); } } break; - + case MouseEvent.EVENT_MOUSE_RELEASED: { final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer if ( 1 == gPtr ) { zoomFirstTouch = true; zoomMode = false; - } else if( 0 == gPtr ) { + } else if( 0 == gPtr ) { // all lifted clear(true); } @@ -169,7 +169,7 @@ public class PinchToZoomGesture implements GestureHandler { System.err.println(this+".released: down "+pointerDownCount+", gPtr "+gPtr+", event "+pe); } } break; - + case MouseEvent.EVENT_MOUSE_DRAGGED: { if( 2 <= pointerDownCount ) { final int gPtr = gesturePointers(pe, -1); @@ -187,13 +187,13 @@ public class PinchToZoomGesture implements GestureHandler { zoomMode = true; } else if( zoomMode ) { final int d = Math.abs(edge0-edge1); - final int dd = d - zoomLastEdgeDist; + final int dd = d - zoomLastEdgeDist; final float screenEdge = useY ? surface.getHeight() : surface.getWidth(); final float incr = (float)dd / screenEdge; // [-1..1] if(DEBUG) { System.err.println("XXX2: id0 "+pIds[0]+" -> idx0 "+p0Idx+", id1 "+pIds[1]+" -> idx1 "+p1Idx); System.err.println("XXX3: d "+d+", ld "+zoomLastEdgeDist+", dd "+dd+", screen "+screenEdge+" -> incr "+incr+", zoom "+zoom+" -> "+(zoom+incr)); - } + } zoom += incr; // clip value if( 2f < zoom ) { @@ -211,7 +211,7 @@ public class PinchToZoomGesture implements GestureHandler { } } } break; - + default: } return null != zoomEvent; diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java index 629dc50d7..e826f4a6a 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.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 com.jogamp.newt.event; public class TraceKeyAdapter implements KeyListener { diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java index 14ee633a0..d035091c4 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.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 com.jogamp.newt.event; public class TraceMouseAdapter implements MouseListener { diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java index 8542820c4..630e85303 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.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 com.jogamp.newt.event; public class TraceWindowAdapter implements WindowListener { diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java index b9e487e9b..e237c0d80 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.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 com.jogamp.newt.event; public abstract class WindowAdapter implements WindowListener diff --git a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java index 24b3b380a..8c7abfe99 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowEvent.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. - * + * */ package com.jogamp.newt.event; @@ -42,7 +42,7 @@ package com.jogamp.newt.event; @SuppressWarnings("serial") public class WindowEvent extends NEWTEvent { public static final short EVENT_WINDOW_RESIZED = 100; - public static final short EVENT_WINDOW_MOVED = 101; + public static final short EVENT_WINDOW_MOVED = 101; public static final short EVENT_WINDOW_DESTROY_NOTIFY = 102; public static final short EVENT_WINDOW_GAINED_FOCUS = 103; public static final short EVENT_WINDOW_LOST_FOCUS = 104; @@ -65,7 +65,7 @@ public class WindowEvent extends NEWTEvent { default: return "unknown (" + type + ")"; } } - + public String toString() { return toString(null).toString(); } diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java index dde182510..e097edf23 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.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. - * + * */ package com.jogamp.newt.event; @@ -44,17 +44,17 @@ public interface WindowListener extends NEWTEventListener { /** Window has been moved. */ public void windowMoved(WindowEvent e); - /** + /** * Window destruction has been requested. * <p> * Depending on the {@link WindowClosingProtocol#getDefaultCloseOperation() default close operation}, * the window maybe destroyed or not. * </p> - * In case the window will be destroyed (see above), release of resources is recommended. + * In case the window will be destroyed (see above), release of resources is recommended. **/ public void windowDestroyNotify(WindowEvent e); - /** + /** * Window has been destroyed. */ public void windowDestroyed(WindowEvent e); diff --git a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java index a0f6e2cb4..8a204d234 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.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 com.jogamp.newt.event; import javax.media.nativewindow.util.Rectangle; diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java index 6de2eee45..e3bf18448 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.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 com.jogamp.newt.event.awt; import jogamp.newt.Debug; @@ -48,10 +48,10 @@ import jogamp.newt.Debug; * Common:<br> * <pre> // your demo/render code - javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ; + javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ; // your AWT agnostic NEWT mouse listener code - com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ; + com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ; * </pre> </p> * <p> * Default NEWT use case, without using the AWTAdapter:<br> @@ -96,7 +96,7 @@ import jogamp.newt.Debug; <br> new AWTMouseAdapter(mouseListener, glWindow).addTo(comp);<br> * </pre> </p> - * + * * Last but not least, the AWTAdapter maybe used as a general AWT event forwarder to NEWT.<br> * * <p> @@ -108,7 +108,7 @@ import jogamp.newt.Debug; <br> new AWTMouseAdapter(glWindow).addTo(comp); // forward all AWT events to glWindow, as NEWT events<br> * </pre> </p> - * + * * @see #attachTo */ public abstract class AWTAdapter implements java.util.EventListener @@ -118,7 +118,7 @@ public abstract class AWTAdapter implements java.util.EventListener com.jogamp.newt.event.NEWTEventListener newtListener; com.jogamp.newt.Window newtWindow; - /** + /** * Simply wrap aroung a NEWT EventListener, exposed as an AWT EventListener.<br> * The NEWT EventListener will be called when an event happens.<br> */ @@ -130,7 +130,7 @@ public abstract class AWTAdapter implements java.util.EventListener this.newtWindow = null; } - /** + /** * Wrap aroung a NEWT EventListener, exposed as an AWT EventListener,<br> * where the given NEWT Window impersonates as the event's source. * The NEWT EventListener will be called when an event happens.<br> @@ -146,7 +146,7 @@ public abstract class AWTAdapter implements java.util.EventListener this.newtWindow = newtProxy; } - /** + /** * Create a pipeline adapter, AWT EventListener.<br> * Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br> * This is only supported with EDT enabled! @@ -162,15 +162,15 @@ public abstract class AWTAdapter implements java.util.EventListener } } - public final com.jogamp.newt.Window getNewtWindow() { - return newtWindow; + public final com.jogamp.newt.Window getNewtWindow() { + return newtWindow; } - + public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() { - return newtListener; + return newtListener; } - - /** + + /** * Due to the fact that some NEWT {@link com.jogamp.newt.event.NEWTEventListener} * are mapped to more than one {@link java.util.EventListener}, * this method is for your convenience to use this Adapter as a listener for all types.<br> diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java index bef2e5d0f..1b53671ba 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.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,18 +20,18 @@ * 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 com.jogamp.newt.event.awt; import jogamp.newt.awt.event.AWTNewtEventFactory; /** - * AWT: + * AWT: * printable: PRESSED (t0), TYPED (t0), RELEASED (t1) * non-printable: PRESSED (t0), RELEASED (t1) */ diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java index 115743a0d..ab4bf7a3f 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.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 com.jogamp.newt.event.awt; import jogamp.newt.awt.event.AWTNewtEventFactory; -public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, +public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener { diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java index e91bb2f82..8c9781b77 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.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,20 +20,20 @@ * 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 com.jogamp.newt.event.awt; import java.awt.Dimension; import jogamp.newt.awt.event.AWTNewtEventFactory; -public class AWTWindowAdapter - extends AWTAdapter +public class AWTWindowAdapter + extends AWTAdapter implements java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener { WindowClosingListener windowClosingListener; @@ -63,17 +63,17 @@ public class AWTWindowAdapter if(awtComponent instanceof java.awt.Window) { ((java.awt.Window)awtComponent).addWindowListener(this); } - return this; + return this; } - + public AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) { java.awt.Window win = getWindow(awtComponent); if( null != win && null != windowClosingListener ) { win.removeWindowListener(windowClosingListener); } - return this; + return this; } - + public AWTAdapter removeFrom(java.awt.Component awtComponent) { awtComponent.removeFocusListener(this); awtComponent.removeComponentListener(this); @@ -225,7 +225,7 @@ public class AWTWindowAdapter enqueueEvent(true, event); } } - public void windowClosed(java.awt.event.WindowEvent e) { + public void windowClosed(java.awt.event.WindowEvent e) { com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow); if(null!=newtListener) { ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event); diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index cae1a06a2..ac81e8469 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -127,7 +127,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public void windowResized(WindowEvent e) { + public void windowResized(WindowEvent e) { defaultWindowResizedOp(getWidth(), getHeight()); } @@ -139,7 +139,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final Object getUpstreamWidget() { return window; } - + /** * Creates a new GLWindow attaching a new Window referencing a * new default Screen and default Display with the given GLCapabilities. @@ -218,7 +218,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind @Override public final CapabilitiesImmutable getChosenCapabilities() { final GLDrawable _drawable = drawable; - return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities(); + return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities(); } @Override @@ -339,7 +339,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final int getY() { return window.getY(); } - + @Override public final int getWidth() { return window.getWidth(); @@ -349,7 +349,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final int getHeight() { return window.getHeight(); } - + @Override public final void setPosition(int x, int y) { window.setPosition(x, y); @@ -363,7 +363,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final boolean setFullscreen(boolean fullscreen) { return window.setFullscreen(fullscreen); } - + @Override public boolean setFullscreen(List<MonitorDevice> monitors) { return window.setFullscreen(monitors); @@ -418,7 +418,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public void setWindowDestroyNotifyAction(Runnable r) { window.setWindowDestroyNotifyAction(r); } - + @Override public final void setVisible(boolean visible) { window.setVisible(visible); @@ -450,7 +450,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public void preserveGLStateAtDestroy(boolean value) { GLWindow.this.preserveGLStateAtDestroy(value); } - + @Override public synchronized void destroyActionPreLock() { // nop @@ -464,7 +464,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind //Exception e1 = new Exception(msg); //e1.printStackTrace(); } - + destroyImplInLock(); if(Window.DEBUG_IMPLEMENTATION) { @@ -493,7 +493,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } else { t0 = 0; } - + if (null == drawable && visible && 0 != window.getWindowHandle() && 0<getWidth()*getHeight()) { if( ( null != context ) ) { throw new InternalError("GLWindow.LifecycleHook.setVisiblePost: "+WindowImpl.getThreadName()+" - Null drawable, but valid context - "+GLWindow.this); @@ -509,7 +509,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } drawable = (GLDrawableImpl) factory.createGLDrawable(ns); drawable.setRealized(true); - + if( !GLWindow.this.pushGLEventListenerState() ) { context = (GLContextImpl) drawable.createContext(sharedContext); context.setContextCreationFlags(additionalCtxCreationFlags); @@ -538,7 +538,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind savedAnimator.resume(); } } - + @SuppressWarnings("deprecation") @Override public void shutdownRenderingAction() { @@ -572,12 +572,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // private GLContext sharedContext = null; - + @Override protected final RecursiveLock getLock() { return window.getLock(); } - + /** * Specifies an {@link javax.media.opengl.GLContext OpenGL context} to share with.<br> * At native creation, {@link #setVisible(boolean) setVisible(true)}, @@ -619,7 +619,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind setVisible(true); } } - + /** * {@inheritDoc} * <p> @@ -643,7 +643,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final void swapBuffers() throws GLException { defaultSwapBuffers(); } - + //---------------------------------------------------------------------- // NEWTEventConsumer // @@ -807,7 +807,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind public final void removeGestureListener(GestureHandler.GestureListener gl) { window.removeGestureListener(gl); } - + //---------------------------------------------------------------------- // NativeWindow completion // @@ -893,7 +893,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind _forceGL3 = true; } else if(args[i].equals("-gl4es3")) { _forceGL4ES3 = true; - } + } } } forceES2 = _forceES2; @@ -905,7 +905,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind System.err.println("forceES3 "+forceES3); System.err.println("forceGL3 "+forceGL3); System.err.println("forceGL4ES3 "+forceGL4ES3); - + System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); System.err.println(JoglVersion.getInstance()); diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index a2135273b..a25b43777 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.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. @@ -71,9 +71,9 @@ import com.jogamp.newt.util.EDTUtil; public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { private static final boolean DEBUG = Debug.debug("Window"); private static final boolean isOSX = NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false); - - private final AbstractGraphicsScreen screen; - + + private final AbstractGraphicsScreen screen; + private WindowClosingMode newtChildCloseOp = WindowClosingMode.DISPOSE_ON_CLOSE; private volatile Rectangle clientArea; @@ -82,22 +82,22 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { private volatile boolean newtChildReady = false; // ready if SWTEDTUtil is set and newtChild parented private volatile boolean postSetSize = false; // pending resize - /** - * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)} + /** + * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)} * on the SWT thread. - * + * * <p> * Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation - * via {@link Display#setEDTUtil(EDTUtil)}. + * via {@link Display#setEDTUtil(EDTUtil)}. * </p> - * + * * @param parent the SWT composite - * @param style additional styles to SWT#NO_BACKGROUND - * @param child optional preassigned {@link #Window}, maybe null + * @param style additional styles to SWT#NO_BACKGROUND + * @param child optional preassigned {@link #Window}, maybe null * @return a new instance */ public static NewtCanvasSWT create(final Composite parent, final int style, final Window child) { - final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null }; + final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null }; parent.getDisplay().syncExec( new Runnable() { public void run() { res[0] = new NewtCanvasSWT( parent, style, child); @@ -105,22 +105,22 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { }); return res[0]; } - + /** * Instantiates a NewtCanvas with a NEWT child. - * + * * <p> * Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation - * via {@link Display#setEDTUtil(EDTUtil)}. + * via {@link Display#setEDTUtil(EDTUtil)}. * </p> - * + * * @param parent the SWT composite - * @param style additional styles to SWT#NO_BACKGROUND - * @param child optional preassigned {@link #Window}, maybe null + * @param style additional styles to SWT#NO_BACKGROUND + * @param child optional preassigned {@link #Window}, maybe null */ public NewtCanvasSWT(final Composite parent, final int style, Window child) { super(parent, style | SWT.NO_BACKGROUND); - + SWTAccessor.setRealized(this, true); clientArea = getClientArea(); @@ -128,7 +128,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { final AbstractGraphicsDevice device = SWTAccessor.getDevice(this); screen = SWTAccessor.getScreen(device, -1 /* default */); nativeWindow = null; - + if(null != child) { setNEWTChild(child); } @@ -161,12 +161,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { addListener (SWT.Paint, listener); addListener (SWT.Dispose, listener); } - + /** assumes nativeWindow == null ! */ protected final boolean validateNative() { updateSizeCheck(); final Rectangle nClientArea = clientArea; - if(0 >= nClientArea.width || 0 >= nClientArea.height) { + if(0 >= nClientArea.width || 0 >= nClientArea.height) { return false; } screen.getDevice().open(); @@ -177,9 +177,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { final boolean visualIDValid = NativeWindowFactory.isNativeVisualIDValidForProcessing(visualID); if(DEBUG) { System.err.println("NewtCanvasSWT.validateNative() windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", valid "+visualIDValid); - } + } if( visualIDValid ) { - /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite). + /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite). * Note: SWT is owner of the native handle, hence no closing operation will be a NOP. */ final CapabilitiesImmutable caps = new Capabilities(); final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(screen.getDevice(), caps); @@ -187,7 +187,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { if(DEBUG) { System.err.println("NewtCanvasSWT.validateNative() factory: "+factory+", windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", chosen config: "+config); // Thread.dumpStack(); - } + } if (null == config) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } @@ -198,11 +198,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { return null != nativeWindow; } - + protected final void updateSizeCheck() { final Rectangle oClientArea = clientArea; final Rectangle nClientArea = getClientArea(); - if ( nClientArea != null && + if ( nClientArea != null && ( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height ) ) { clientArea = nClientArea; // write back new value @@ -217,12 +217,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } } } - + @Override public void update() { // don't paint background etc .. nop avoids flickering } - + /** * Destroys this resource: * <ul> @@ -248,12 +248,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } screen.getDevice().close(); nativeWindow = null; - super.dispose(); + super.dispose(); } - + /** @return this SWT Canvas NativeWindow representation, may be null in case it has not been realized. */ public NativeWindow getNativeWindow() { return nativeWindow; } - + public WindowClosingMode getDefaultCloseOperation() { return newtChildCloseOp; // TODO: implement ?! } @@ -264,28 +264,28 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { boolean isParent() { - return null!=newtChild ; + return null!=newtChild ; } boolean isFullscreen() { return null != newtChild && newtChild.isFullscreen(); } - /** + /** * Sets a new NEWT child, provoking reparenting. * <p> * A previously detached <code>newChild</code> will be released to top-level status - * and made invisible. + * and made invisible. * </p> * <p> - * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code> - * produced much cleaner visual results. + * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code> + * produced much cleaner visual results. * </p> * <p> * Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation - * via {@link Display#setEDTUtil(EDTUtil)}. + * via {@link Display#setEDTUtil(EDTUtil)}. * </p> - * @return the previous attached newt child. + * @return the previous attached newt child. */ public Window setNEWTChild(final Window newChild) { final Window prevChild = newtChild; @@ -302,14 +302,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { if(null != nativeWindow && null != newChild) { reparentWindow( true ); } - return prevChild; + return prevChild; } - + /** @return the current NEWT child */ public Window getNEWTChild() { return newtChild; } - + @Override public boolean setParent(Composite parent) { return super.setParent(parent); @@ -319,11 +319,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { newtChildReady = attach; if( null != newtChild ) { newtChild.setKeyboardFocusHandler(null); - if(attach) { - newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE); + if(attach) { + newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE); } else { newtChild.setFocusAction(null); - newtChild.setDefaultCloseOperation(newtChildCloseOp); + newtChild.setDefaultCloseOperation(newtChildCloseOp); } } } @@ -335,13 +335,13 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { if(DEBUG) { System.err.println("NewtCanvasSWT.reparentWindow.0: add="+add+", win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()); } - + newtChild.setFocusAction(null); // no AWT focus traversal .. if(add) { updateSizeCheck(); final int w = clientArea.width; final int h = clientArea.height; - + // set SWT EDT and start it { final Display newtDisplay = newtChild.getScreen().getDisplay(); @@ -349,14 +349,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { edtUtil.start(); newtDisplay.setEDTUtil( edtUtil ); } - - newtChild.setSize(w, h); + + newtChild.setSize(w, h); newtChild.reparentWindow(nativeWindow); newtChild.setVisible(true); - configureNewtChild(true); + configureNewtChild(true); newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener - - // force this SWT Canvas to be focus-able, + + // force this SWT Canvas to be focus-able, // since it is completely covered by the newtChild (z-order). setEnabled(true); } else { @@ -375,19 +375,19 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { newtChild.requestFocus(); } } - + @Override public boolean forceFocus() { final boolean res = NewtCanvasSWT.super.forceFocus(); requestFocusNEWTChild(); - return res; + return res; } - + private class SWTNativeWindow implements NativeWindow { private final AbstractGraphicsConfiguration config; private final long nativeWindowHandle; private final InsetsImmutable insets; // only required to allow proper client position calculation on OSX - + public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) { this.config = config; this.nativeWindowHandle = nativeWindowHandle; @@ -397,7 +397,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { this.insets = new Insets(0, 0, 0, 0); } } - + @Override public int lockSurface() throws NativeWindowException, RuntimeException { return NativeSurface.LOCK_SUCCESS; @@ -432,7 +432,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { } @Override - public long getSurfaceHandle() { + public long getSurfaceHandle() { return 0; } @@ -462,7 +462,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { } + public void surfaceUpdated(Object updater, NativeSurface ns, long when) { } @Override public void destroy() { } @@ -497,7 +497,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { if( isOSX ) { final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0); // top-level position -> client window position - los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight()); + los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight()); if(null!=point) { return point.translate(los); } else { @@ -506,7 +506,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } else { // client position on 'normal' windowing systems is 0/0 if(null == point) { - point = new Point(0, 0); + point = new Point(0, 0); } return point; } @@ -515,7 +515,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { @Override public boolean hasFocus() { return isFocusControl(); - } + } }; static String newtWinHandleToHexString(Window w) { diff --git a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java index 52ca95682..582dc3e1f 100644 --- a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java @@ -63,17 +63,17 @@ public interface EDTUtil { * @param ms poll period in milliseconds */ public void setPollPeriod(long ms); - + /** * Starts the EDT after it's creation or after {@link #invokeStop(boolean, Runnable) stopping}. * <p> * If the EDT is running, it must be {@link #invokeStop(boolean, Runnable) stopped} first * and the caller should wait {@link #waitUntilStopped() until it's stopped}. * </p> - * + * * @return true if EDT has been successfully restarted, otherwise false * @throws IllegalStateException if EDT is running and not subject to be stopped, i.e. {@link #isRunning()} returns true - * + * * @see #invokeStop(boolean, java.lang.Runnable) * @see #waitUntilStopped() */ @@ -82,11 +82,11 @@ public interface EDTUtil { /** * Returns true if the current thread is the event dispatch thread (EDT). * <p> - * The EDT is the platform specific thread dispatching toolkit-events + * The EDT is the platform specific thread dispatching toolkit-events * and executing toolkit-tasks enqueued via {@link #invoke(boolean, Runnable)}. * </p> * <p> - * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()}, + * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()}, * however, this may differ, e.g. SWT and AWT implementation. * </p> */ @@ -95,28 +95,28 @@ public interface EDTUtil { /** * Returns true if the current thread is the internal NEWT event dequeue thread (NEDT). * <p> - * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally + * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally * via {@link DisplayImpl#enqueueEvent(boolean, NEWTEvent)}. * </p> * <p> - * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()}, + * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()}, * however, this may differ, e.g. SWT and AWT implementation. * </p> */ public boolean isCurrentThreadNEDT(); - + /** * Returns <code>true</code> if either {@link #isCurrentThreadEDT()} or {@link #isCurrentThreadNEDT()} is <code>true</code>, * otherwise <code>false</code>. */ public boolean isCurrentThreadEDTorNEDT(); - + /** * @return True if EDT is running and not subject to be stopped. */ public boolean isRunning(); - /** + /** * Append the final task to the EDT task queue, * signals EDT to stop. * <p> @@ -133,22 +133,22 @@ public interface EDTUtil { * <li>{@link #start()} may follow immediately, ie creating a new EDT</li> * </ul> * </p> - * @return true if <code>task</code> has been executed or queued for later execution, otherwise false + * @return true if <code>task</code> has been executed or queued for later execution, otherwise false */ public boolean invokeStop(boolean wait, Runnable finalTask); - /** + /** * Appends task to the EDT task queue if current thread is not EDT, - * otherwise execute task immediately. + * otherwise execute task immediately. * <p> * Wait until execution is finished if <code>wait == true</code>. * </p> * Can be issued from within EDT, ie from within an enqueued task.<br> - * @return true if <code>task</code> has been executed or queued for later execution, otherwise false + * @return true if <code>task</code> has been executed or queued for later execution, otherwise false */ public boolean invoke(boolean wait, Runnable task); - /** + /** * Wait until the EDT task queue is empty.<br> * The last task may still be in execution when this method returns. * @return true if waited for idle, otherwise false, i.e. in case of current thread is EDT or NEDT diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 5e79e9b49..049320b21 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.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. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -54,13 +54,13 @@ import jogamp.newt.NEWTJNILibLoader; * NEWT Utility class MainThread<P> * * <p> - * FIXME: Update this documentation! + * FIXME: Update this documentation! * This class just provides a main-thread utility, forking of a main java class * on another thread while being able to continue doing platform specific things * on the main-thread. The latter is essential for eg. MacOSX, where we continue * to run NSApp.run(). * </p> - * + * * This class provides a startup singleton <i>main thread</i>, * from which a new thread with the users main class is launched.<br> * @@ -72,17 +72,17 @@ import jogamp.newt.NEWTJNILibLoader; * use a NEWT multithreaded application with window handling within the different threads, * even on these restricted platforms.<br> * - * To support your NEWT Window platform, + * To support your NEWT Window platform, * you have to pass your <i>main thread</i> actions to {@link #invoke invoke(..)}, * have a look at the {@link jogamp.newt.driver.macosx.WindowDriver NEWT Mac OSX Window} driver implementation.<br> - * <i>TODO</i>: Some hardcoded dependencies exist in this implementation, + * <i>TODO</i>: Some hardcoded dependencies exist in this implementation, * where you have to patch this code or factor it out. <P> - * + * * If your platform is not Mac OS X, but you want to test your code without modifying * this class, you have to set the system property <code>newt.MainThread.force</code> to <code>true</code>.<P> * * The code is compatible with all other platform, which support multithreaded windowing handling. - * Since those platforms won't trigger the <i>main thread</i> serialization, the main method + * Since those platforms won't trigger the <i>main thread</i> serialization, the main method * will be simply executed, in case you haven't set <code>newt.MainThread.force</code> to <code>true</code>.<P> * * Test case on Mac OS X (or any other platform): @@ -96,35 +96,35 @@ public class MainThread { private static final Platform.OSType osType; private static final boolean isMacOSX; private static final ThreadGroup rootThreadGroup; - + /** if true, use the main thread EDT, otherwise AWT's EDT */ public static final boolean HINT_USE_MAIN_THREAD; - + static { NativeWindowFactory.initSingleton(); NEWTJNILibLoader.loadNEWT(); - HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() || + HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() || Debug.getBooleanProperty("newt.MainThread.force", true); osType = Platform.getOSType(); isMacOSX = osType == Platform.OSType.MACOS; rootThreadGroup = getRootThreadGroup(); } - + public static boolean useMainThread = false; - + protected static final boolean DEBUG = Debug.debug("MainThread"); private static final MainThread singletonMainThread = new MainThread(); // one singleton MainThread - + private static final ThreadGroup getRootThreadGroup() { ThreadGroup rootGroup = Thread.currentThread( ).getThreadGroup( ); ThreadGroup parentGroup; while ( ( parentGroup = rootGroup.getParent() ) != null ) { rootGroup = parentGroup; } - return rootGroup; + return rootGroup; } - + private static final Thread[] getAllThreads(int[] count) { int tn; Thread[] threads = new Thread[ rootThreadGroup.activeCount() ]; @@ -149,17 +149,17 @@ public class MainThread { t.printStackTrace(); } } - return res; + return res; } private static final int getNonDaemonThreadCount(List<Thread> ignoreThreads) { int res = 0; int[] tn = { 0 }; Thread[] threads = getAllThreads(tn); - + for(int i = tn[0] - 1; i >= 0; i--) { final Thread thread = threads[i]; try { - if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) { + if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) { res++; if(DEBUG) System.err.println("MainAction.run(): non daemon thread: "+thread); } @@ -167,9 +167,9 @@ public class MainThread { t.printStackTrace(); } } - return res; + return res; } - + static class UserApp extends Thread { private final String mainClassNameShort; private final String mainClassName; @@ -181,7 +181,7 @@ public class MainThread { super(); this.mainClassName=mainClassName; this.mainClassArgs=mainClassArgs; - + final Class<?> mainClass = ReflectionUtil.getClass(mainClassName, true, getClass().getClassLoader()); if(null==mainClass) { throw new ClassNotFoundException("MainAction couldn't find main class "+mainClassName); @@ -192,7 +192,7 @@ public class MainThread { setName(getName()+"-UserApp-"+mainClassNameShort); setDaemon(false); - + if(DEBUG) System.err.println("MainAction(): instantiated: "+getName()+", is daemon "+isDaemon()+", main-class: "+mainClass.getName()); } @@ -230,32 +230,32 @@ public class MainThread { if(isMacOSX) { try { if(DEBUG) { - System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0"); + System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0"); } - ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication", + ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication", null, null, MainThread.class.getClassLoader()); if(DEBUG) { - System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X"); + System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X"); } } catch (Exception e) { e.printStackTrace(); } } else { if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" MainAction fin - System.exit(0)"); - System.exit(0); - } + System.exit(0); + } } } } private static UserApp mainAction; - /** Your new java application main entry, which pipelines your application - * @throws ClassNotFoundException - * @throws NoSuchMethodException + /** Your new java application main entry, which pipelines your application + * @throws ClassNotFoundException + * @throws NoSuchMethodException * @throws SecurityException */ public static void main(String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException { final Thread cur = Thread.currentThread(); - + useMainThread = HINT_USE_MAIN_THREAD; if(DEBUG) { @@ -268,7 +268,7 @@ public class MainThread { if(!useMainThread && !NativeWindowFactory.isAWTAvailable()) { throw new RuntimeException("!USE_MAIN_THREAD and no AWT available"); } - + if(args.length==0) { return; } @@ -282,7 +282,7 @@ public class MainThread { mainAction = new UserApp(mainClassName, mainClassArgs); if(isMacOSX) { - ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton", + ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton", null, null, MainThread.class.getClassLoader()); } @@ -290,24 +290,24 @@ public class MainThread { try { cur.setName(cur.getName()+"-MainThread"); } catch (Exception e) {} - + // dispatch user's main thread .. mainAction.start(); - + if(isMacOSX) { try { if(DEBUG) { - System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp"); + System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp"); } - ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication", + ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication", null, null, MainThread.class.getClassLoader()); } catch (Exception e) { e.printStackTrace(); } - } - if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); } + } + if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); } } else { - // run user's main in this thread + // run user's main in this thread mainAction.run(); } } diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java index c30b427d6..fdd7985fe 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java @@ -42,7 +42,7 @@ import javax.media.nativewindow.util.SurfaceSize; * filters etc. */ public class MonitorModeUtil { - + public static int getIndex(List<MonitorMode> monitorModes, MonitorMode search) { return monitorModes.indexOf(search); } @@ -69,7 +69,7 @@ public class MonitorModeUtil { } return null; } - + /** Sort the given {@link MonitorMode} collection w/ {@link MonitorMode#compareTo(MonitorMode)} function. */ public static void sort(List<MonitorMode> monitorModes, boolean ascendingOrder) { if( ascendingOrder ) { @@ -78,9 +78,9 @@ public class MonitorModeUtil { Collections.sort(monitorModes, MonitorMode.monitorModeComparatorInv); } } - + /** - * + * * @param monitorModes * @param surfaceSize * @return modes with exact {@link SurfaceSize}. May return zero sized list for non. @@ -99,7 +99,7 @@ public class MonitorModeUtil { } /** - * + * * @param monitorModes * @param rotation * @return modes with exact rotation. May return zero sized list for non. @@ -118,7 +118,7 @@ public class MonitorModeUtil { } /** - * + * * @param monitorModes * @param bitsPerPixel * @return modes with exact bpp. May return zero sized list for non. @@ -137,7 +137,7 @@ public class MonitorModeUtil { } /** - * + * * @param monitorModes * @param flags * @return modes with exact flags. May return zero sized list for non. @@ -165,7 +165,7 @@ public class MonitorModeUtil { if( null!=monitorModes && monitorModes.size()>0 ) { final int resolution_sq = resolution.getHeight()*resolution.getWidth(); int mode_dsq=Integer.MAX_VALUE, mode_dsq_idx=0; - + for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { final MonitorMode mode = monitorModes.get(i); final DimensionImmutable res = mode.getSurfaceSize().getResolution(); @@ -236,7 +236,7 @@ public class MonitorModeUtil { } /** - * + * * @param monitorModes * @return modes with highest available refresh rate. May return zero sized list for non. */ diff --git a/src/newt/classes/jogamp/newt/Debug.java b/src/newt/classes/jogamp/newt/Debug.java index 4b0a98216..46a354d4a 100644 --- a/src/newt/classes/jogamp/newt/Debug.java +++ b/src/newt/classes/jogamp/newt/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("newt."); return null; } } ); - + verbose = isPropertyDefined("newt.verbose", true); debugAll = isPropertyDefined("newt.debug", true); if (verbose) { diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java index 3d1037ad5..f33b4744e 100644 --- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java +++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.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. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. @@ -51,7 +51,7 @@ public class DefaultEDTUtil implements EDTUtil { public static final boolean DEBUG = Debug.debug("EDT"); private final Object edtLock = new Object(); // locking the EDT start/stop state - private /* final */ ThreadGroup threadGroup; + private /* final */ ThreadGroup threadGroup; private final String name; private final Runnable dispatchMessages; private NEDT edt = null; @@ -75,7 +75,7 @@ public class DefaultEDTUtil implements EDTUtil { final public void setPollPeriod(long ms) { pollPeriod = ms; } - + @Override public final boolean start() throws IllegalStateException { synchronized(edtLock) { @@ -117,7 +117,7 @@ public class DefaultEDTUtil implements EDTUtil { public final boolean isCurrentThreadEDT() { return edt == Thread.currentThread(); // EDT == NEDT } - + @Override public final boolean isCurrentThreadNEDT() { return edt == Thread.currentThread(); // EDT == NEDT @@ -126,8 +126,8 @@ public class DefaultEDTUtil implements EDTUtil { @Override public final boolean isCurrentThreadEDTorNEDT() { return edt == Thread.currentThread(); // EDT == NEDT - } - + } + @Override public final boolean isRunning() { return edt.isRunning() ; @@ -149,9 +149,9 @@ public class DefaultEDTUtil implements EDTUtil { private static Runnable nullTask = new Runnable() { @Override - public void run() { } + public void run() { } }; - + private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) { Throwable throwable = null; RunnableTask rTask = null; @@ -201,7 +201,7 @@ public class DefaultEDTUtil implements EDTUtil { synchronized(edt.tasks) { rTask = new RunnableTask(task, wait ? rTaskLock : null, - true /* always catch and report Exceptions, don't disturb EDT */, + true /* always catch and report Exceptions, don't disturb EDT */, wait ? null : System.err); if(stop) { rTask.setAttachment(new Boolean(true)); // mark final task, will imply shouldStop:=true @@ -305,8 +305,8 @@ public class DefaultEDTUtil implements EDTUtil { throw new InternalError("XXX"); } } - - /** + + /** * Utilizing locking only on tasks and its execution, * not for event dispatching. */ @@ -315,7 +315,7 @@ public class DefaultEDTUtil implements EDTUtil { if(DEBUG) { System.err.println(getName()+": Default-EDT run() START "+ getName()); } - if(Lock.DEBUG) { + if(Lock.DEBUG) { validateNoRecursiveLocksHold(); } RuntimeException error = null; @@ -368,7 +368,7 @@ public class DefaultEDTUtil implements EDTUtil { } finally { if(DEBUG) { RunnableTask rt = ( tasks.size() > 0 ) ? tasks.get(0) : null ; - System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error); + System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error); } synchronized(edtLock) { isRunning = false; diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 0f47c87a0..c6cb706a4 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.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. - * + * */ package jogamp.newt; @@ -60,16 +60,16 @@ public abstract class DisplayImpl extends Display { } }); } - + /** Ensure static init has been run. */ /* pp */static void initSingleton() { } - - private static Class<?> getDisplayClass(String type) - throws ClassNotFoundException + + private static Class<?> getDisplayClass(String type) + throws ClassNotFoundException { final Class<?> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver"); if(null==displayClass) { - throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>"); + throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>"); } return displayClass; } @@ -100,7 +100,7 @@ public abstract class DisplayImpl extends Display { display.setEDTUtil( display.edtUtil ); // device's default if EDT is used, or null Display.addDisplay2List(display); } - + if(DEBUG) { System.err.println("Display.create() NEW: "+display+" "+getThreadName()); } @@ -109,7 +109,7 @@ public abstract class DisplayImpl extends Display { throw new RuntimeException(e); } } - + @Override public boolean equals(Object obj) { if (obj == null) { @@ -168,7 +168,7 @@ public abstract class DisplayImpl extends Display { protected EDTUtil createEDTUtil() { final EDTUtil def; if(NewtFactory.useEDT()) { - def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable); + def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable); if(DEBUG) { System.err.println("Display.createEDTUtil("+getFQName()+"): "+def.getClass().getName()); } @@ -271,7 +271,7 @@ public abstract class DisplayImpl extends Display { if(DEBUG) { System.err.println("Display.destroy(): "+this+", active "+displaysActive+" "+getThreadName()); } - } + } final DisplayImpl f_dpy = this; final AbstractGraphicsDevice f_aDevice = aDevice; aDevice = null; @@ -287,10 +287,10 @@ public abstract class DisplayImpl extends Display { dumpDisplayList("Display.destroy("+getFQName()+") END"); } } - + /** May be utilized at a shutdown hook, impl. does not block. */ /* pp */ static final void shutdownAll() { - final int dCount = displayList.size(); + final int dCount = displayList.size(); if(DEBUG) { dumpDisplayList("Display.shutdownAll "+dCount+" instances, on thread "+getThreadName()); } @@ -306,7 +306,7 @@ public abstract class DisplayImpl extends Display { final EDTUtil edtUtil = d.getEDTUtil(); final AbstractGraphicsDevice f_aDevice = d.aDevice; d.aDevice = null; - d.refCount=0; + d.refCount=0; final Runnable closeNativeTask = new Runnable() { public void run() { if ( null != d.getGraphicsDevice() ) { @@ -381,7 +381,7 @@ public abstract class DisplayImpl extends Display { public final String getFQName() { return fqname; } - + @Override public final boolean isExclusive() { return exclusive; @@ -438,7 +438,7 @@ public abstract class DisplayImpl extends Display { @Override public String toString() { final EDTUtil _edtUtil = edtUtil; - final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false; + final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false; return "NEWT-Display["+getFQName()+", excl "+exclusive+", refCount "+refCount+", hasEDT "+(null!=_edtUtil)+", edtRunning "+_edtUtilRunning+", "+aDevice+"]"; } @@ -455,8 +455,8 @@ public abstract class DisplayImpl extends Display { } }; final void dispatchMessage(final NEWTEvent event) { - try { - final Object source = event.getSource(); + try { + final Object source = event.getSource(); if(source instanceof NEWTEventConsumer) { final NEWTEventConsumer consumer = (NEWTEventConsumer) source ; if(!consumer.consumeEvent(event)) { @@ -476,10 +476,10 @@ public abstract class DisplayImpl extends Display { throw re; } } - + final void dispatchMessage(final NEWTEventTask eventTask) { final NEWTEvent event = eventTask.get(); - try { + try { if(null == event) { // Ooops ? System.err.println("Warning: event of eventTask is NULL"); @@ -495,15 +495,15 @@ public abstract class DisplayImpl extends Display { throw re; } } - eventTask.notifyCaller(); + eventTask.notifyCaller(); } - + @Override public void dispatchMessages() { // System.err.println("Display.dispatchMessages() 0 "+this+" "+getThreadName()); - if(0==refCount || // no screens + if(0==refCount || // no screens null==getGraphicsDevice() // no native device - ) + ) { return; } @@ -541,13 +541,13 @@ public abstract class DisplayImpl extends Display { } return; } - + // can't wait if we are on EDT or NEDT -> consume right away if(wait && _edtUtil.isCurrentThreadEDTorNEDT() ) { dispatchMessage(e); return; } - + final Object lock = new Object(); final NEWTEventTask eTask = new NEWTEventTask(e, wait?lock:null); synchronized(lock) { @@ -565,13 +565,13 @@ public abstract class DisplayImpl extends Display { if( null != eTask.getException() ) { throw eTask.getException(); } - } + } } } public interface DisplayRunnable<T> { T run(long dpy); - } + } public static final <T> T runWithLockedDevice(AbstractGraphicsDevice device, DisplayRunnable<T> action) { T res; device.lock(); @@ -589,7 +589,7 @@ public abstract class DisplayImpl extends Display { } return runWithLockedDevice(device, action); } - + protected volatile EDTUtil edtUtil = null; protected int id; protected String name; diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java index 43d558515..9e10879c4 100644 --- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java +++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.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.newt; import javax.media.nativewindow.util.DimensionImmutable; @@ -41,7 +41,7 @@ public class MonitorDeviceImpl extends MonitorDevice { public MonitorDeviceImpl(ScreenImpl screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewport, MonitorMode currentMode, ArrayHashSet<MonitorMode> supportedModes) { super(screen, nativeId, sizeMM, viewport, currentMode, supportedModes); } - + @Override public final MonitorMode queryCurrentMode() { final ScreenImpl screenImpl = (ScreenImpl)screen; @@ -54,7 +54,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } MonitorMode mmU = supportedModes.get(mm0); // unified instance if( null == mmU ) { - // add new mode avoiding exception! + // add new mode avoiding exception! mmU = sms.getMonitorModes().getOrAdd(mm0); mmU = supportedModes.getOrAdd(mmU); if( Screen.DEBUG ) { @@ -89,21 +89,21 @@ public class MonitorDeviceImpl extends MonitorDevice { if( mmU.equals( mmC ) ) { if(Screen.DEBUG) { System.err.println("Screen.setCurrentMode: 0.0 is-current (skip) "+mmU+" == "+mmC); - } + } return true; } final long tStart; if(Screen.DEBUG) { - tStart = System.currentTimeMillis(); + tStart = System.currentTimeMillis(); } else { tStart = 0; } - + sms.fireMonitorModeChangeNotify(this, mmU); if(Screen.DEBUG) { System.err.println("Screen.setCurrentMode ("+(System.currentTimeMillis()-tStart)+"ms): fireModeChangeNotify() "+mmU); } - + boolean success = screenImpl.setCurrentMonitorModeImpl(this, mmU); if(success) { if(Screen.DEBUG) { @@ -135,13 +135,13 @@ public class MonitorDeviceImpl extends MonitorDevice { private final void setCurrentModeValue(MonitorMode currentMode) { this.currentMode = currentMode; } - + /* pp */ final void setViewportValue(Rectangle viewport) { this.viewport = viewport; } - + /* pp */ ArrayHashSet<MonitorMode> getSupportedModesImpl() { return supportedModes; } - + } diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 820807e15..9d8f4919c 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -54,12 +54,12 @@ public class MonitorModeProps { * 1: bpp */ public static final int NUM_SURFACE_SIZE_PROPERTIES = 1; - + /** WARNING: must be synchronized with ScreenMode.h, native implementation * 2: refresh-rate (Hz*100), flags */ public static final int NUM_SIZEANDRATE_PROPERTIES = 2; - + /** WARNING: must be synchronized with ScreenMode.h, native implementation * 2: id, rotation */ @@ -69,7 +69,7 @@ public class MonitorModeProps { * count + all the above */ public static final int NUM_MONITOR_MODE_PROPERTIES_ALL = 8; - + public static final int IDX_MONITOR_MODE_BPP = 1 // count + MonitorModeProps.NUM_RESOLUTION_PROPERTIES ; @@ -79,7 +79,7 @@ public class MonitorModeProps { + MonitorModeProps.NUM_SIZEANDRATE_PROPERTIES + 1 // id of MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES ; - + /** WARNING: must be synchronized with ScreenMode.h, native implementation * 10: count + id, ScreenSizeMM[width, height], rotated Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ */ @@ -89,15 +89,15 @@ public class MonitorModeProps { + 1 // native mode + MonitorModeProps.NUM_RESOLUTION_PROPERTIES // sizeMM ; - + public static class Cache { public final ArrayHashSet<DimensionImmutable> resolutions = new ArrayHashSet<DimensionImmutable>(); public final ArrayHashSet<SurfaceSize> surfaceSizes = new ArrayHashSet<SurfaceSize>(); - public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>(); + public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>(); public final ArrayHashSet<MonitorMode> monitorModes = new ArrayHashSet<MonitorMode>(); public final ArrayHashSet<MonitorDevice> monitorDevices = new ArrayHashSet<MonitorDevice>(); } - + /** WARNING: must be synchronized with ScreenMode.h, native implementation */ private static DimensionImmutable streamInResolution(int[] resolutionProperties, int offset) { Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]); @@ -116,7 +116,7 @@ public class MonitorModeProps { final int flags = sizeAndRRateProperties[offset++]; return new MonitorMode.SizeAndRRate(surfaceSize, refreshRate, flags); } - + /** WARNING: must be synchronized with ScreenMode.h, native implementation */ private static MonitorMode streamInMonitorMode0(MonitorMode.SizeAndRRate sizeAndRate, int[] modeProperties, int offset) { final int id = modeProperties[offset++]; @@ -161,7 +161,7 @@ public class MonitorModeProps { if(null!=cache) { sizeAndRate = cache.sizeAndRates.getOrAdd(sizeAndRate); } - + MonitorMode monitorMode = MonitorModeProps.streamInMonitorMode0(sizeAndRate, modeProperties, offset); if(null!=cache) { monitorMode = cache.monitorModes.getOrAdd(monitorMode); @@ -193,12 +193,12 @@ public class MonitorModeProps { } return data; } - - /** + + /** * WARNING: must be synchronized with ScreenMode.h, native implementation * <p> * Note: This variant only works for impl. w/ a unique mode key pair <i>modeId, rotation</i>. - * </p> + * </p> * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. * @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates * @param modeProperties the input data @@ -218,7 +218,7 @@ public class MonitorModeProps { if(count > monitorProperties.length-offset) { throw new RuntimeException("properties array too short (count), should be >= "+count+", is "+(monitorProperties.length-offset)); } - final int limit = offset + count; + final int limit = offset + count; offset++; final List<MonitorMode> allMonitorModes = cache.monitorModes.getData(); final int id = monitorProperties[offset++]; @@ -252,7 +252,7 @@ public class MonitorModeProps { monitor_idx[0] = _monitorIdx; } return monitorDevice; - } + } private static MonitorMode getByNativeIdAndRotation(List<MonitorMode> monitorModes, int modeId, int rotation) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i<monitorModes.size(); i++) { @@ -264,12 +264,12 @@ public class MonitorModeProps { } return null; } - - /** + + /** * WARNING: must be synchronized with ScreenMode.h, native implementation * <p> * This variant expects <code>count</code> to be <code>{@link MIN_MONITOR_DEVICE_PROPERTIES} - 1 - {@link NUM_MONITOR_MODE_PROPERTIES}</code>, - * due to lack of supported mode and current mode. + * due to lack of supported mode and current mode. * </p> * * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}. @@ -310,7 +310,7 @@ public class MonitorModeProps { } return monitorDevice; } - + /** WARNING: must be synchronized with ScreenMode.h, native implementation */ public static int[] streamOutMonitorDevice (MonitorDevice monitorDevice) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ @@ -339,7 +339,7 @@ public class MonitorModeProps { } return data; } - + public final void swapRotatePair(int rotation, int[] pairs, int offset, int numPairs) { if( MonitorMode.ROTATE_0 == rotation || MonitorMode.ROTATE_180 == rotation ) { // nop @@ -347,9 +347,9 @@ public class MonitorModeProps { } for(int i=0; i<numPairs; i++, offset+=2) { final int tmp = pairs[offset]; - pairs[offset] = pairs[offset+1]; + pairs[offset] = pairs[offset+1]; pairs[offset+1] = tmp; } - } - + } + } diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java index bc12bf3ee..f1e212394 100644 --- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java +++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java @@ -1,21 +1,21 @@ /* * 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 @@ -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. */ @@ -48,7 +48,7 @@ import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempJarCache; -public class NEWTJNILibLoader extends JNILibLoaderBase { +public class NEWTJNILibLoader extends JNILibLoaderBase { public static boolean loadNEWT() { return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index 0a302d76b..eba844230 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.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. - * + * */ package jogamp.newt; @@ -50,7 +50,7 @@ import com.jogamp.newt.MonitorDevice; public class OffscreenWindow extends WindowImpl implements MutableSurface { long surfaceHandle; - + public OffscreenWindow() { surfaceHandle = 0; } @@ -72,7 +72,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { synchronized(OffscreenWindow.class) { setWindowHandle(nextWindowHandle++); } - visibleChanged(false, true); + visibleChanged(false, true); } protected void closeNativeImpl() { @@ -92,7 +92,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { @Override public long getSurfaceHandle() { return surfaceHandle; - } + } protected void requestFocusImpl(boolean reparented) { } @@ -101,7 +101,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { public void setPosition(int x, int y) { // nop } - + @Override public boolean setFullscreen(boolean fullscreen) { return false; // nop @@ -112,7 +112,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { return false; // nop } - + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { sizeChanged(false, width, height, false); if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { @@ -137,13 +137,13 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { } return new Point(0,0); } - + protected Point getLocationOnScreenImpl(int x, int y) { return new Point(x,y); } - + protected void updateInsetsImpl(Insets insets) { - // nop .. + // nop .. } } diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 7068d7464..d7e6c641c 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.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. - * + * */ package jogamp.newt; @@ -56,7 +56,7 @@ import com.jogamp.newt.util.MonitorModeUtil; public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED; - + static { Debug.initSingleton(); DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true); @@ -67,14 +67,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { public static final int default_sm_heightmm = 324; public static final int default_sm_rate = 60; public static final int default_sm_rotation = 0; - + static { DisplayImpl.initSingleton(); } - + /** Ensure static init has been run. */ /* pp */static void initSingleton() { } - + protected DisplayImpl display; protected int screen_idx; protected String fqname; @@ -85,14 +85,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight protected static volatile boolean usrSizeQueried = false; private ArrayList<MonitorModeListener> refMonitorModeListener = new ArrayList<MonitorModeListener>(); - + private long tCreated; // creationTime - private static Class<?> getScreenClass(String type) throws ClassNotFoundException + private static Class<?> getScreenClass(String type) throws ClassNotFoundException { final Class<?> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver"); if(null==screenClass) { - throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>"); + throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>"); } return screenClass; } @@ -104,7 +104,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if(!usrSizeQueried) { usrSizeQueried = true; final int w = Debug.getIntProperty("newt.ws.swidth", true, 0); - final int h = Debug.getIntProperty("newt.ws.sheight", true, 0); + final int h = Debug.getIntProperty("newt.ws.sheight", true, 0); if(w>0 && h>0) { usrSize = new Dimension(w, h); System.err.println("User screen size "+usrSize); @@ -135,7 +135,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { System.err.println("Screen.create() NEW: "+screen+" "+Display.getThreadName()); } return screen; - } + } } catch (Exception e) { throw new RuntimeException(e); } @@ -167,16 +167,16 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { @Override public synchronized final void createNative() throws NativeWindowException - { + { if(null == aScreen) { if(DEBUG) { tCreated = System.nanoTime(); System.err.println("Screen.createNative() START ("+DisplayImpl.getThreadName()+", "+this+")"); } else { tCreated = 0; - } + } display.addReference(); - + createNativeImpl(); if(null == aScreen) { throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen"); @@ -249,7 +249,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected abstract void createNativeImpl(); protected abstract void closeNativeImpl(); - + /** * Returns the validated screen index, which is either the passed <code>idx</code> * value or <code>0</code>. @@ -258,23 +258,23 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * </p> */ protected abstract int validateScreenIndex(int idx); - + /** * Stores the virtual origin and virtual <b>rotated</b> screen size. * <p> - * This method is called after the MonitorMode has been set or changed, + * This method is called after the MonitorMode has been set or changed, * hence you may utilize it. * </p> * <p> * Default implementation uses the union of all monitor's viewport, - * calculated via {@link #unionOfMonitorViewportSize()}. + * calculated via {@link #unionOfMonitorViewportSize()}. * </p> * @param vOriginSize storage for result */ - protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) { + protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) { unionOfMonitorViewportSize(vOriginSize); } - + @Override public final String getFQName() { return fqname; @@ -335,15 +335,15 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } // - // MonitorDevice and MonitorMode + // MonitorDevice and MonitorMode // - + /** * To be implemented by the native specification.<br> * Is called within a thread safe environment.<br> * Is called only to collect the {@link MonitorMode}s and {@link MonitorDevice}s, usually at startup setting up modes.<br> * <br> - * <b>WARNING</b>: must be synchronized with + * <b>WARNING</b>: must be synchronized with * <ul> * <li>{@link MonitorModeProps#NUM_SCREEN_MODE_PROPERTIES} and </li> * <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li> @@ -356,19 +356,19 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * @param cache memory pool caching the result */ protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache); - + protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) { return null; } - + /** * To be implemented by the native specification.<br> * Is called within a thread safe environment.<br> * <p> - * Implementation shall not unify the result w/ monitor's supported modes or a locally + * Implementation shall not unify the result w/ monitor's supported modes or a locally * saved {@link MonitorModeProps.Cache}, since caller will perform such tasks. * </p> */ protected abstract MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor); - + /** * To be implemented by the native specification.<br> * Is called within a thread safe environment.<br> @@ -378,13 +378,13 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { @Override public final List<MonitorMode> getMonitorModes() { final ScreenMonitorState sms = getScreenMonitorStatus(false); - return null != sms ? sms.getMonitorModes().getData() : null; + return null != sms ? sms.getMonitorModes().getData() : null; } - + @Override public final List<MonitorDevice> getMonitorDevices() { final ScreenMonitorState sms = getScreenMonitorStatus(false); - return null != sms ? sms.getMonitorDevices().getData() : null; + return null != sms ? sms.getMonitorDevices().getData() : null; } final ScreenMonitorState getScreenMonitorStatus(boolean throwException) { @@ -395,7 +395,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } return res; } - + @Override public void monitorModeChangeNotify(MonitorEvent me) { if(DEBUG) { @@ -417,9 +417,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if( null != newViewport ) { monitor.setViewportValue(newViewport); } - } + } } - + @Override public void monitorModeChanged(MonitorEvent me, boolean success) { if(success) { @@ -443,9 +443,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { public synchronized final void removeMonitorModeListener(MonitorModeListener sml) { refMonitorModeListener.remove(sml); } - + /** - * + * * @param cache optional .. * @param modeId * @return @@ -468,7 +468,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } /** - * + * * @param cache mandatory ! * @param monitorId * @param currentMode @@ -493,7 +493,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0); } - + /** * Utilizes {@link #getCurrentMonitorModeImpl()}, if the latter returns null it uses * the current screen size and dummy values. @@ -530,7 +530,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { sms = ScreenMonitorState.getScreenMonitorState(this.getFQName()); if(null==sms) { final MonitorModeProps.Cache cache = new MonitorModeProps.Cache(); - if( 0 >= collectNativeMonitorModes(cache) ) { + if( 0 >= collectNativeMonitorModes(cache) ) { updateVirtualScreenOriginAndSize(); vScrnSizeUpdated = true; final MonitorMode mode = getVirtualMonitorMode(cache, 0); @@ -557,7 +557,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { System.err.println("["+i+"]["+j+"]: "+iMode.next()); } } - } + } sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes); ScreenMonitorState.mapScreenMonitorState(this.getFQName(), sms); } @@ -580,7 +580,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * Collects {@link MonitorDevice}s and {@link MonitorMode}s within the given cache. * </p> */ - private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) { + private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) { if(!DEBUG_TEST_SCREENMODE_DISABLED) { collectNativeMonitorModesAndDevicesImpl(cache); } @@ -639,12 +639,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } finally { sms.unlock(); } - } + } } finally { ScreenMonitorState.unlockScreenMonitorState(); } } - + private final void shutdown() { ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName()); if(null != sms) { @@ -661,11 +661,11 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } } ScreenMonitorState.unmapScreenMonitorStateUnlocked(getFQName()); - } + } } - + /** pp */ static final void shutdownAll() { - final int sCount = screenList.size(); + final int sCount = screenList.size(); if(DEBUG) { System.err.println("Screen.shutdownAll "+sCount+" instances, on thread "+Display.getThreadName()); } diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java index 66e75be16..01e6cfee9 100644 --- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java +++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java @@ -42,7 +42,7 @@ import java.util.HashMap; public class ScreenMonitorState { private static boolean DEBUG = Screen.DEBUG; - + private final RecursiveLock lock = LockFactory.createRecursiveLock(); private final ArrayHashSet<MonitorDevice> allMonitors; private final ArrayHashSet<MonitorMode> allMonitorModes; @@ -105,21 +105,21 @@ public class ScreenMonitorState { protected static void unlockScreenMonitorState() { screen2ScreenMonitorState.unlock(); } - + public ScreenMonitorState(ArrayHashSet<MonitorDevice> allMonitors, ArrayHashSet<MonitorMode> allMonitorModes) { - this.allMonitors = allMonitors; + this.allMonitors = allMonitors; this.allMonitorModes = allMonitorModes; } - protected ArrayHashSet<MonitorDevice> getMonitorDevices() { + protected ArrayHashSet<MonitorDevice> getMonitorDevices() { return allMonitors; } - - protected ArrayHashSet<MonitorMode> getMonitorModes() { + + protected ArrayHashSet<MonitorMode> getMonitorModes() { return allMonitorModes; } - + protected final int addListener(MonitorModeListener l) { lock(); try { @@ -151,14 +151,14 @@ public class ScreenMonitorState { protected final MonitorDevice getMonitor(MonitorDevice monitor) { return allMonitors.get(monitor); } - + protected final void validateMonitor(MonitorDevice monitor) { final MonitorDevice md = allMonitors.get(monitor); if( null == md ) { throw new InternalError("Monitor unknown: "+monitor); } } - + protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) { lock(); try { diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index a35d89408..a0ef8816b 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.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. - * + * */ package jogamp.newt; @@ -87,19 +87,19 @@ import jogamp.nativewindow.SurfaceUpdatedHelper; public abstract class WindowImpl implements Window, NEWTEventConsumer { public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE; - + static { Debug.initSingleton(); DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true); - + ScreenImpl.initSingleton(); } - - protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>(); - + + protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>(); + /** Maybe utilized at a shutdown hook, impl. does not block. */ public static final void shutdownAll() { - final int wCount = windowList.size(); + final int wCount = windowList.size(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window.shutdownAll "+wCount+" instances, on thread "+getThreadName()); } @@ -132,25 +132,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - + /** Timeout of queued events (repaint and resize) */ - static final long QUEUED_EVENT_TO = 1200; // ms + static final long QUEUED_EVENT_TO = 1200; // ms private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse }; - + // // Volatile: Multithread Mutable Access - // + // private volatile long windowHandle = 0; // lifecycle critical private volatile boolean visible = false; // lifecycle critical - private volatile boolean hasFocus = false; + private volatile boolean hasFocus = false; private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user private volatile int x = 64, y = 64; // client-area pos w/o insets private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated) - + private RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock private int surfaceLockCount = 0; // surface lock recursion count - + private ScreenImpl screen; // never null after create - may change reference though (reparent) private boolean screenReferenceAdded = false; private NativeWindow parentWindow = null; @@ -162,7 +162,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private List<MonitorDevice> fullscreenMonitors = null; private boolean fullscreenUseMainMonitor = true; private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user) - + private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen) private String title = "Newt Window"; @@ -178,26 +178,26 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private KeyListener keyboardFocusHandler = null; private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper(); - + private Object childWindowsLock = new Object(); private ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>(); private ArrayList<MouseListener> mouseListeners = new ArrayList<MouseListener>(); - + /** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */ private static class PointerState0 { /** mouse entered window - is inside the window (may be synthetic) */ boolean insideWindow = false; - + /** last time when a mouse button was pressed */ long lastButtonPressTime = 0; - + void clearButton() { lastButtonPressTime = 0; } } private PointerState0 pState0 = new PointerState0(); - + /** from direct input: {@link WindowImpl#doPointerEvent(boolean, boolean, int[], short, int, int, boolean, short[], int[], int[], float[], float, float[], float)}. */ private static class PointerState1 extends PointerState0 { /** current pressed mouse button number */ @@ -206,15 +206,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int buttonPressedMask = 0; /** last mouse button click count */ short lastButtonClickCount = (short)0; - + final void clearButton() { super.clearButton(); lastButtonPressTime = 0; - lastButtonClickCount = (short)0; + lastButtonClickCount = (short)0; buttonPressed = 0; - buttonPressedMask = 0; + buttonPressedMask = 0; } - + /** last pointer-move position for 8 touch-down pointers */ final Point[] movePositions = new Point[] { new Point(), new Point(), new Point(), new Point(), @@ -227,16 +227,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } private PointerState1 pState1 = new PointerState1(); - + /** pointer names -> pointer ID (consecutive index, starting w/ 0) */ private final ArrayHashSet<Integer> pName2pID = new ArrayHashSet<Integer>(); - + private boolean defaultGestureHandlerEnabled = true; private DoubleTapScrollGesture gesture2PtrTouchScroll = null; private ArrayList<GestureHandler> pointerGestureHandler = new ArrayList<GestureHandler>(); - + private ArrayList<GestureHandler.GestureListener> gestureListeners = new ArrayList<GestureHandler.GestureListener>(); - + private ArrayList<KeyListener> keyListeners = new ArrayList<KeyListener>(); private ArrayList<WindowListener> windowListeners = new ArrayList<WindowListener>(); @@ -267,7 +267,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer { final Class<?> windowClass = NewtFactory.getCustomClass(type, "WindowDriver"); if(null==windowClass) { - throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>"); + throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>"); } return windowClass; } @@ -293,7 +293,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException(t); } } - + public static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) { try { Class<?> windowClass = getWindowClass(screen.getDisplay().getType()); @@ -329,11 +329,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer hasFocus = false; parentWindowHandle = 0; } - + protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) { config = cfg; } - + public static interface LifecycleHook { /** * Reset of internal state counter, ie totalFrames, etc. @@ -341,8 +341,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer */ public abstract void resetCounter(); - /** - * Invoked after Window setVisible, + /** + * Invoked after Window setVisible, * allows allocating resources depending on the native Window. * Called from EDT while window is locked. */ @@ -354,9 +354,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param value <code>true</code> to set the one-shot preservation if supported, otherwise clears it. */ void preserveGLStateAtDestroy(boolean value); - - /** - * Invoked before Window destroy action, + + /** + * Invoked before Window destroy action, * allows releasing of resources depending on the native Window.<br> * Surface not locked yet.<br> * Called not necessarily from EDT. @@ -388,12 +388,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @see #pauseRenderingAction() */ void resumeRenderingAction(); - + /** * Shutdown rendering action (thread) abnormally. * <p> * Should be called only at shutdown, if necessary. - * </p> + * </p> */ void shutdownRenderingAction(); } @@ -406,14 +406,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else { tStart = 0; } - - if( null != parentWindow && + + if( null != parentWindow && NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindow.lockSurface() ) { throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow); } - + // child window: position defaults to 0/0, no auto position, no negative position - if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) { + if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) { definePosition(0, 0); } boolean postParentlockFocus = false; @@ -556,28 +556,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** * Notifies the driver impl. that the instantiation is finished, - * ie. instance created and all fields set. + * ie. instance created and all fields set. */ protected void instantiationFinished() { // nop } - + protected boolean canCreateNativeImpl() { return true; // default: always able to be created } - - /** + + /** * The native implementation must set the native windowHandle.<br> * * <p> * The implementation shall respect the states {@link #isAlwaysOnTop()}/{@link #FLAG_IS_ALWAYSONTOP} and * {@link #isUndecorated()}/{@link #FLAG_IS_UNDECORATED}, ie. the created window shall reflect those settings. * </p> - * + * * <p> * The implementation should invoke the referenced java state callbacks * to notify this Java object of state changes.</p> - * + * * @see #windowDestroyNotify(boolean) * @see #focusChanged(boolean, boolean) * @see #visibleChanged(boolean, boolean) @@ -589,16 +589,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected abstract void closeNativeImpl(); - /** + /** * Async request which shall be performed within {@link #TIMEOUT_NATIVEWINDOW}. * <p> - * If if <code>force == false</code> the native implementation + * If if <code>force == false</code> the native implementation * may only request focus if not yet owner.</p> * <p> * {@link #focusChanged(boolean, boolean)} should be called - * to notify about the focus traversal. - * </p> - * + * to notify about the focus traversal. + * </p> + * * @param force if true, bypass {@link #focusChanged(boolean, boolean)} and force focus request */ protected abstract void requestFocusImpl(boolean force); @@ -608,7 +608,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public static final int FLAG_CHANGE_FULLSCREEN = 1 << 2; public static final int FLAG_CHANGE_ALWAYSONTOP = 1 << 3; public static final int FLAG_CHANGE_VISIBILITY = 1 << 4; - + public static final int FLAG_HAS_PARENT = 1 << 8; public static final int FLAG_IS_UNDECORATED = 1 << 9; public static final int FLAG_IS_FULLSCREEN = 1 << 10; @@ -619,12 +619,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** * The native implementation should invoke the referenced java state callbacks * to notify this Java object of state changes. - * + * * <p> * Implementations shall set x/y to 0, in case it's negative. This could happen due * to insets and positioning a decorated window to 0/0, which would place the frame * outside of the screen.</p> - * + * * @param x client-area position, or <0 if unchanged * @param y client-area position, or <0 if unchanged * @param width client-area size, or <=0 if unchanged @@ -635,12 +635,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @see #positionChanged(boolean,int, int) */ protected abstract boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags); - - /** + + /** * Tests whether a single reconfigure flag is supported by implementation. * <p> * Default is all but {@link #FLAG_IS_FULLSCREEN_SPAN} - * </p> + * </p> */ protected boolean isReconfigureFlagSupported(int changeFlags) { return 0 == ( changeFlags & FLAG_IS_FULLSCREEN_SPAN ); @@ -656,14 +656,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected static String getReconfigureFlagsAsString(StringBuilder sb, int flags) { if(null == sb) { sb = new StringBuilder(); } sb.append("["); - + if( 0 != ( FLAG_CHANGE_PARENTING & flags) ) { sb.append("*"); } sb.append("PARENT_"); sb.append(0 != ( FLAG_HAS_PARENT & flags)); sb.append(", "); - + if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) { sb.append("*"); } @@ -679,24 +679,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer sb.append("UNDECOR_"); sb.append(0 != ( FLAG_IS_UNDECORATED & flags)); sb.append(", "); - + if( 0 != ( FLAG_CHANGE_ALWAYSONTOP & flags) ) { sb.append("*"); } sb.append("ALWAYSONTOP_"); sb.append(0 != ( FLAG_IS_ALWAYSONTOP & flags)); sb.append(", "); - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { sb.append("*"); } sb.append("VISIBLE_"); sb.append(0 != ( FLAG_IS_VISIBLE & flags)); - + sb.append("]"); return sb.toString(); } - + protected void setTitleImpl(String title) {} /** @@ -713,11 +713,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @return if not null, the screen location of the given coordinates */ protected abstract Point getLocationOnScreenImpl(int x, int y); - + /** Triggered by user via {@link #getInsets()}.<br> - * Implementations may implement this hook to update the insets.<br> + * Implementations may implement this hook to update the insets.<br> * However, they may prefer the event driven path via {@link #insetsChanged(boolean, int, int, int, int)}. - * + * * @see #getInsets() * @see #insetsChanged(boolean, int, int, int, int) */ @@ -726,7 +726,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected boolean setPointerVisibleImpl(boolean pointerVisible) { return false; } protected boolean confinePointerImpl(boolean confine) { return false; } protected void warpPointerImpl(int x, int y) { } - + //---------------------------------------------------------------------- // NativeSurface // @@ -791,7 +791,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final RecursiveLock getLock() { return windowLock; } - + @Override public long getSurfaceHandle() { return windowHandle; // default: return window handle @@ -810,7 +810,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final long getDisplayHandle() { return config.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle(); - } + } @Override public final int getScreenIndex() { @@ -879,19 +879,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final Screen getScreen() { return screen; } - + @Override public final MonitorDevice getMainMonitor() { return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight())); } - + protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) { - reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible)); - } + reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible)); + } final void setVisibleActionImpl(boolean visible) { boolean nativeWindowCreated = false; boolean madeVisible = false; - + final RecursiveLock _lock = windowLock; _lock.lock(); try { @@ -911,7 +911,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer madeVisible = nativeWindowCreated; } // always flag visible, allowing a retry .. - WindowImpl.this.visible = true; + WindowImpl.this.visible = true; } else if(WindowImpl.this.visible != visible) { if(isNativeValid()) { setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight()); @@ -965,14 +965,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)); } - runOnEDTIfAvail(wait, new VisibleAction(visible)); + runOnEDTIfAvail(wait, new VisibleAction(visible)); } @Override public void setVisible(boolean visible) { setVisible(true, visible); } - + private class SetSizeAction implements Runnable { int width, height; boolean disregardFS; @@ -1024,11 +1024,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private void setFullscreenSize(int width, int height) { runOnEDTIfAvail(true, new SetSizeAction(width, height, true)); - } + } @Override public void setSize(int width, int height) { runOnEDTIfAvail(true, new SetSizeAction(width, height, false)); - } + } @Override public void setTopLevelSize(int width, int height) { setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight()); @@ -1049,10 +1049,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window DestroyAction() hasScreen "+(null != screen)+", isNativeValid "+isNativeValid()+" - "+getThreadName()); } - + // send synced destroy-notify notification sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY); - + // Childs first .. synchronized(childWindowsLock) { if(childWindows.size()>0) { @@ -1111,30 +1111,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(animatorPaused) { lifecycleHook.resumeRenderingAction(); } - + // these refs shall be kept alive - resurrection via setVisible(true) /** if(null!=parentWindow && parentWindow instanceof Window) { ((Window)parentWindow).removeChild(WindowImpl.this); - } + } childWindows = null; surfaceUpdatedListeners = null; mouseListeners = null; keyListeners = null; capsRequested = null; lifecycleHook = null; - - screen = null; + + screen = null; windowListeners = null; parentWindow = null; - */ + */ } } private final DestroyAction destroyAction = new DestroyAction(); @Override public void destroy() { - visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation + visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation runOnEDTIfAvail(true, destroyAction); } @@ -1144,15 +1144,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } destroy(); } - + /** * @param cWin child window, must not be null * @param pWin parent window, may be null - * @return true if at least one of both window's configurations is offscreen + * @return true if at least one of both window's configurations is offscreen */ protected static boolean isOffscreenInstance(NativeWindow cWin, NativeWindow pWin) { boolean ofs = false; - final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration(); + final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration(); if( null != cWinCfg ) { ofs = !cWinCfg.getChosenCapabilities().isOnscreen(); } @@ -1164,7 +1164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return ofs; } - + private class ReparentAction implements Runnable { final NativeWindow newParentWindow; final int topLevelX, topLevelY; @@ -1187,7 +1187,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer removeScreenReference(); screen = newScreen; } - + public final void run() { boolean animatorPaused = false; if(null!=lifecycleHook) { @@ -1198,7 +1198,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer lifecycleHook.resumeRenderingAction(); } } - + private void reparent() { // mirror pos/size so native change notification can get overwritten final int oldX = getX(); @@ -1209,7 +1209,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int width = oldWidth; int height = oldHeight; boolean wasVisible; - + final RecursiveLock _lock = windowLock; _lock.lock(); try { @@ -1217,7 +1217,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // force recreation if offscreen, since it may become onscreen forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow); } - + wasVisible = isVisible(); Window newParentWindowNEWT = null; @@ -1233,7 +1233,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(null!=newParentWindow) { // REPARENT TO CHILD WINDOW - + // reset position to 0/0 within parent space x = 0; y = 0; @@ -1278,7 +1278,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING; } } else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) { - // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again. + // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again. destroy( wasVisible ); if(null!=newParentWindowNEWT) { setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() ); @@ -1333,11 +1333,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if ( ReparentOperation.ACTION_INVALID == operation ) { throw new NativeWindowException("Internal Error: reparentAction not set"); } - + if(DEBUG_IMPLEMENTATION) { System.err.println("Window.reparent: ACTION ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", reparentAction "+operation+", pos/size "+x+"/"+y+" "+width+"x"+height+", visible "+wasVisible); } - + if( ReparentOperation.ACTION_NOP == operation ) { return; } @@ -1401,18 +1401,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(ok) { requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */); - display.dispatchMessagesNative(); // status up2date + display.dispatchMessagesNative(); // status up2date } } } if(!ok || !wasVisible) { - // make size and position persistent manual, + // make size and position persistent manual, // since we don't have a WM feedback (invisible or recreation) definePosition(x, y); defineSize(width, height); } - + if(!ok) { // native reparent failed -> try creation, while trying to preserve resources if becoming visible again. if(DEBUG_IMPLEMENTATION) { @@ -1430,7 +1430,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer definePosition(x, y); defineSize(width, height); } - + if(DEBUG_IMPLEMENTATION) { System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); } @@ -1451,7 +1451,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // This may run on the new Display/Screen connection, hence a new EDT task runOnEDTIfAvail(true, reparentActionRecreate); break; - + default: } } @@ -1566,7 +1566,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(WindowImpl.this.alwaysOnTop != alwaysOnTop) { // set current state WindowImpl.this.alwaysOnTop = alwaysOnTop; - + if( isNativeValid() ) { // Mirror pos/size so native change notification can get overwritten final int x = getX(); @@ -1591,12 +1591,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final void setAlwaysOnTop(boolean value) { runOnEDTIfAvail(true, new AlwaysOnTopAction(value)); } - + @Override public final boolean isAlwaysOnTop() { return alwaysOnTop; } - + @Override public String getTitle() { return title; @@ -1624,7 +1624,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer setVal = setPointerVisibleImpl(pointerVisible); } if(setVal) { - this.pointerVisible = pointerVisible; + this.pointerVisible = pointerVisible; } } } @@ -1632,7 +1632,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public boolean isPointerConfined() { return pointerConfined; } - + @Override public void confinePointer(boolean confine) { if(this.pointerConfined != confine) { @@ -1652,18 +1652,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(setVal) { - this.pointerConfined = confine; + this.pointerConfined = confine; } - } + } } - + @Override public void warpPointer(int x, int y) { if(0 != getWindowHandle()) { warpPointerImpl(x, y); } } - + @Override public final InsetsImmutable getInsets() { if(isUndecorated()) { @@ -1672,7 +1672,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer updateInsetsImpl(insets); return insets; } - + @Override public final int getWidth() { return width; @@ -1694,8 +1694,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } protected final boolean autoPosition() { return autoPosition; } - - /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */ + + /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */ protected final void definePosition(int x, int y) { if(DEBUG_IMPLEMENTATION) { System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y); @@ -1705,7 +1705,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer this.x = x; this.y = y; } - /** Sets the size fields {@link #width} and {@link #height} to the given values. */ + /** Sets the size fields {@link #width} and {@link #height} to the given values. */ protected final void defineSize(int width, int height) { if(DEBUG_IMPLEMENTATION) { System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height); @@ -1713,7 +1713,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } this.width = width; this.height = height; } - + @Override public final boolean isVisible() { return visible; @@ -1732,7 +1732,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final Window getDelegatedWindow() { return this; } - + //---------------------------------------------------------------------- // WindowImpl // @@ -1755,8 +1755,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return old; } - /** - * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit, + /** + * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit, * it will return such reference. Otherwise returns null. */ public NativeSurface getWrappedSurface() { @@ -1768,13 +1768,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer windowDestroyNotifyAction = r; } - /** - * Returns the non delegated {@link AbstractGraphicsConfiguration}, + /** + * Returns the non delegated {@link AbstractGraphicsConfiguration}, * see {@link #getGraphicsConfiguration()}. */ public final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() { return config; } - + protected final long getParentWindowHandle() { return isFullscreen() ? 0 : parentWindowHandle; } @@ -1864,7 +1864,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public void requestFocus(boolean wait) { requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */); } - + private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) { if( isNativeValid() && ( force || !hasFocus() ) && @@ -1872,7 +1872,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer runOnEDTIfAvail(wait, force ? requestFocusActionForced : requestFocusAction); } } - + /** Internally forcing request focus on current thread */ private void requestFocusInt(boolean skipFocusAction) { if( skipFocusAction || !focusAction() ) { @@ -1880,14 +1880,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): skipFocusAction "+skipFocusAction+", focus "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); } requestFocusImpl(true); - } + } } - + @Override public void setFocusAction(FocusRunnable focusAction) { this.focusAction = focusAction; } - + private boolean focusAction() { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.focusAction() START - "+getThreadName()+", focusAction: "+focusAction+" - windowHandle "+toHexString(getWindowHandle())); @@ -1903,16 +1903,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return res; } - + protected void setBrokenFocusChange(boolean v) { brokenFocusChange = v; } - + @Override public void setKeyboardFocusHandler(KeyListener l) { keyboardFocusHandler = l; } - + private class SetPositionAction implements Runnable { int x, y; @@ -1932,7 +1932,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(isNativeValid()) { // this.x/this.y will be set by sizeChanged, triggered by windowing event system reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible())); - + // Wait until custom position is reached within tolerances waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW); } else { @@ -1950,16 +1950,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer autoPosition = false; runOnEDTIfAvail(true, new SetPositionAction(x, y)); } - + @Override public void setTopLevelPosition(int x, int y) { setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight()); } - + private class FullScreenAction implements Runnable { boolean fullscreen; - private boolean init(boolean fullscreen) { + private boolean init(boolean fullscreen) { if(isNativeValid()) { this.fullscreen = fullscreen; return isFullscreen() != fullscreen; @@ -1967,7 +1967,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer WindowImpl.this.fullscreen = fullscreen; // set current state for createNative(..) return false; } - } + } public boolean fsOn() { return fullscreen; } public final void run() { @@ -1981,9 +1981,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final int oldY = getY(); final int oldWidth = getWidth(); final int oldHeight = getHeight(); - + int x,y,w,h; - + final RectangleImmutable sviewport = screen.getViewport(); final RectangleImmutable viewport; final int fs_span_flag; @@ -2007,7 +2007,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer nfs_y = oldY; nfs_width = oldWidth; nfs_height = oldHeight; - x = viewport.getX(); + x = viewport.getX(); y = viewport.getY(); w = viewport.getWidth(); h = viewport.getHeight(); @@ -2020,12 +2020,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer y = nfs_y; w = nfs_width; h = nfs_height; - + if(null!=parentWindow) { // reset position to 0/0 within parent space x = 0; y = 0; - + // refit if size is bigger than parent if( w > parentWindow.getWidth() ) { w = parentWindow.getWidth(); @@ -2044,7 +2044,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date final boolean wasVisible = isVisible(); - + // Lock parentWindow only during reparenting (attempt) final NativeWindow parentWindowLocked; if( null != parentWindow ) { @@ -2065,8 +2065,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer parentWindowLocked = null; } try { - reconfigureWindowImpl(x, y, w, h, - getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) | + reconfigureWindowImpl(x, y, w, h, + getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) | fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) ); } finally { if(null!=parentWindowLocked) { @@ -2074,7 +2074,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } display.dispatchMessagesNative(); // status up2date - + if(wasVisible) { setVisibleImpl(true, x, y, w, h); boolean ok = 0 <= WindowImpl.this.waitForVisible(true, false); @@ -2086,7 +2086,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(ok) { requestFocusInt(fullscreen /* skipFocusAction if fullscreen */); - display.dispatchMessagesNative(); // status up2date + display.dispatchMessagesNative(); // status up2date } if(DEBUG_IMPLEMENTATION) { System.err.println("Window fs done: ok " + ok + ", " + WindowImpl.this); @@ -2098,24 +2098,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener } } - private final FullScreenAction fullScreenAction = new FullScreenAction(); + private final FullScreenAction fullScreenAction = new FullScreenAction(); @Override public boolean setFullscreen(boolean fullscreen) { return setFullscreenImpl(fullscreen, true, null); } - + @Override public boolean setFullscreen(List<MonitorDevice> monitors) { return setFullscreenImpl(true, false, monitors); } - + private boolean setFullscreenImpl(boolean fullscreen, boolean useMainMonitor, List<MonitorDevice> monitors) { synchronized(fullScreenAction) { fullscreenMonitors = monitors; fullscreenUseMainMonitor = useMainMonitor; if( fullScreenAction.init(fullscreen) ) { - if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) { + if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) { // enable fullscreen on offscreen instance if(null != parentWindow) { nfs_parent = parentWindow; @@ -2124,19 +2124,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new InternalError("Offscreen instance w/o parent unhandled"); } } - + runOnEDTIfAvail(true, fullScreenAction); - + if(!fullScreenAction.fsOn() && null != nfs_parent) { // disable fullscreen on offscreen instance reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */); nfs_parent = null; } } - return this.fullscreen; + return this.fullscreen; } } - + private class MonitorModeListenerImpl implements MonitorModeListener { boolean animatorPaused = false; boolean hadFocus = false; @@ -2226,7 +2226,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer //---------------------------------------------------------------------- // Child Window Management - // + // @Override public final boolean removeChild(NativeWindow win) { @@ -2282,7 +2282,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); // Thread.dumpStack(); - } + } return discardTO; // discardTO:=true -> consumed } return true; @@ -2343,11 +2343,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // // MouseListener/Event Support // - + // // Native MouseEvents pre-processed to be enqueued or consumed directly // - + public final void sendMouseEvent(short eventType, int modifiers, int x, int y, short button, float rotation) { doMouseEvent(false, false, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f); @@ -2369,11 +2369,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int x, int y, short button, float[] rotationXYZ, float rotationScale) { doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale); } */ - + /** * Send mouse event (one-pointer) either to be directly consumed or to be enqueued - * - * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, + * + * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly. * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}. */ @@ -2383,7 +2383,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException("Invalid mouse button number" + button); } doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers, - 0 /*actionIdx*/, new short[] { (short)(button-1) }, + 0 /*actionIdx*/, new short[] { (short)(button-1) }, new int[]{x}, new int[]{y}, new float[]{0f} /*pressure*/, 1f /*maxPressure*/, rotationXYZ, rotationScale); } @@ -2396,11 +2396,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * </p> * <p> * The given pointer names, <code>pNames</code>, are mapped to consecutive pointer IDs starting w/ 0 - * using a hash-map if <code>normalPNames</code> is <code>false</code>. - * Otherwise a simple <code>int</code> to <code>short</code> type cast is performed. + * using a hash-map if <code>normalPNames</code> is <code>false</code>. + * Otherwise a simple <code>int</code> to <code>short</code> type cast is performed. * </p> - * - * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, + * + * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly. * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}. * @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer) @@ -2410,14 +2410,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param normalPNames see pName below. * @param pNames Pointer name for each pointer (multiple pointer). * We assume consecutive pointer names starting w/ 0 if <code>normalPIDs</code> is <code>true</code>. - * Otherwise we hash-map the values during state pressed to retrieve the normal ID. + * Otherwise we hash-map the values during state pressed to retrieve the normal ID. * @param pX X-axis for each pointer (multiple pointer) * @param pY Y-axis for each pointer (multiple pointer) * @param pPressure Pressure for each pointer (multiple pointer) * @param maxPressure Maximum pointer pressure for all pointer */ public final void doPointerEvent(boolean enqueue, boolean wait, - final PointerType[] pTypes, short eventType, int modifiers, + final PointerType[] pTypes, short eventType, int modifiers, int actionIdx, boolean normalPNames, final int[] pNames, final int[] pX, final int[] pY, float[] pPressure, float maxPressure, final float[] rotationXYZ, final float rotationScale) { @@ -2447,25 +2447,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer pIDs[i] = (short)pNames[i]; } } - doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs, + doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs, pX, pY, pPressure, maxPressure, rotationXYZ, rotationScale); } - + /** * Send multiple-pointer event either to be directly consumed or to be enqueued * <p> * The index for the element of multiple-pointer arrays represents the pointer which triggered the event * is passed via <i>actionIdx</i>. - * </p> - * - * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, + * </p> + * + * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued}, * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly. * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}. * @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer) * @param eventType * @param modifiers * @param pActionIdx index of multiple-pointer arrays representing the pointer which triggered the event - * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0. + * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0. * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move. * @param pX X-axis for each pointer (multiple pointer) * @param pY Y-axis for each pointer (multiple pointer) @@ -2473,14 +2473,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param maxPressure Maximum pointer pressure for all pointer */ public final void doPointerEvent(boolean enqueue, boolean wait, - final PointerType[] pTypes, short eventType, int modifiers, + final PointerType[] pTypes, short eventType, int modifiers, int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure, float maxPressure, final float[] rotationXYZ, float rotationScale) { final long when = System.currentTimeMillis(); final int pCount = pTypes.length; - + if( 0 > pActionIdx || pActionIdx >= pCount) { - throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]"); + throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]"); } if( 0 < pActionIdx ) { // swap values to make idx 0 the triggering pointer @@ -2518,11 +2518,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer button = com.jogamp.newt.event.MouseEvent.BUTTON1; } } - + // // - Determine ENTERED/EXITED state // - Remove redundant move/drag events - // - Reset states if applicable + // - Reset states if applicable // int x = pX[0]; int y = pY[0]; @@ -2537,7 +2537,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer movePositionP0.set(0, 0); } // Fall through intended! - + case MouseEvent.EVENT_MOUSE_ENTERED: // clip coordinates to window dimension x = Math.min(Math.max(x, 0), getWidth()-1); @@ -2545,11 +2545,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer pState1.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED; pState1.clearButton(); break; - + case MouseEvent.EVENT_MOUSE_MOVED: case MouseEvent.EVENT_MOUSE_DRAGGED: if( null != movePositionP0 ) { - if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) { + if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) { if(DEBUG_MOUSE_EVENT) { System.err.println("doPointerEvent: skip "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0); } @@ -2557,16 +2557,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } movePositionP0.set(x, y); } - + // Fall through intended ! - + default: if(!pState1.insideWindow) { - pState1.insideWindow = true; + pState1.insideWindow = true; pState1.clearButton(); } } - + if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) { if(DEBUG_MOUSE_EVENT) { System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+ @@ -2582,29 +2582,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final int buttonMask = InputEvent.getButtonMask(button); modifiers |= buttonMask; // Always add current button to modifier mask (Bug 571) modifiers |= pState1.buttonPressedMask; // Always add currently pressed mouse buttons to modifier mask - + if( isPointerConfined() ) { modifiers |= InputEvent.CONFINED_MASK; } if( !isPointerVisible() ) { modifiers |= InputEvent.INVISIBLE_MASK; } - + pX[0] = x; pY[0] = y; - + // // - Determine CLICK COUNT // - Ignore sent CLICKED // - Track buttonPressed incl. buttonPressedMask // - Fix MOVED/DRAGGED event // - final MouseEvent e; + final MouseEvent e; switch( eventType ) { case MouseEvent.EVENT_MOUSE_CLICKED: e = null; break; - + case MouseEvent.EVENT_MOUSE_PRESSED: if( 0 >= pPressure[0] ) { pPressure[0] = maxPressure; @@ -2618,16 +2618,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } pState1.lastButtonPressTime = when; pState1.buttonPressed = button; - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale); } else { - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale); } break; case MouseEvent.EVENT_MOUSE_RELEASED: if( 1 == pCount ) { - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale); if( when - pState1.lastButtonPressTime >= MouseEvent.getClickTimeout() ) { pState1.lastButtonClickCount = (short)0; @@ -2635,7 +2635,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } pState1.buttonPressed = 0; } else { - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale); } pState1.buttonPressedMask &= ~buttonMask; @@ -2645,10 +2645,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer break; case MouseEvent.EVENT_MOUSE_MOVED: if ( 0 != pState1.buttonPressedMask ) { // any button or pointer move -> drag - e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID, + e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, pState1.buttonPressed, (short)1, rotationXYZ, rotationScale); } else { - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale); } break; @@ -2658,12 +2658,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } // Fall through intended! default: - e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, + e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale); } doEvent(enqueue, wait, e); // actual mouse event } - + @Override public final void addMouseListener(MouseListener l) { addMouseListener(-1, l); @@ -2676,8 +2676,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @SuppressWarnings("unchecked") ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); - if(0>index) { - index = clonedListeners.size(); + if(0>index) { + index = clonedListeners.size(); } clonedListeners.add(index, l); mouseListeners = clonedListeners; @@ -2698,8 +2698,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final MouseListener getMouseListener(int index) { @SuppressWarnings("unchecked") ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); - if(0>index) { - index = clonedListeners.size()-1; + if(0>index) { + index = clonedListeners.size()-1; } return clonedListeners.get(index); } @@ -2717,7 +2717,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final boolean areDefaultGesturesEnabled() { return defaultGestureHandlerEnabled; } - + @Override public final void addGestureHandler(GestureHandler gh) { addGestureHandler(-1, gh); @@ -2729,7 +2729,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @SuppressWarnings("unchecked") ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone(); - if(0>index) { + if(0>index) { index = cloned.size(); } cloned.add(index, gh); @@ -2756,7 +2756,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @SuppressWarnings("unchecked") ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone(); - if(0>index) { + if(0>index) { index = cloned.size(); } cloned.add(index, gl); @@ -2772,11 +2772,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer cloned.remove(gl); gestureListeners= cloned; } - + private static int step(int lower, int edge, int value) { return value < edge ? lower : value; } - + /** * Consume the {@link MouseEvent}, i.e. * <pre> @@ -2786,18 +2786,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * - dispatch event to listener * </pre> */ - protected void consumePointerEvent(MouseEvent pe) { + protected void consumePointerEvent(MouseEvent pe) { int x = pe.getX(); int y = pe.getY(); - + if(DEBUG_MOUSE_EVENT) { System.err.println("consumePointerEvent.in: "+pe); } - + // // - Determine ENTERED/EXITED state // - Synthesize ENTERED event - // - Reset states if applicable + // - Reset states if applicable // final long when = pe.getWhen(); int eventType = pe.getEventType(); @@ -2812,7 +2812,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer pState0.clearButton(); eEntered = null; break; - + default: if(!pState0.insideWindow) { pState0.insideWindow = true; @@ -2833,12 +2833,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return; // .. invalid .. } - + // // Handle Default Gestures // if( defaultGestureHandlerEnabled && - pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen ) + pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen ) { if( null == gesture2PtrTouchScroll ) { final int scaledScrollSlop; @@ -2849,16 +2849,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final float pixWPerMM = (float)monitor.getCurrentMode().getRotatedWidth() / (float)mm.getWidth(); final float pixHPerMM = (float)monitor.getCurrentMode().getRotatedHeight() / (float)mm.getHeight(); final float pixPerMM = Math.min(pixHPerMM, pixWPerMM); - scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM); - scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM); + scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM); + scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM); if(DEBUG_MOUSE_EVENT) { System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor); } } else { scaledScrollSlop = DoubleTapScrollGesture.SCROLL_SLOP_PIXEL; - scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL; + scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL; } - gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop), + gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop), step(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL, DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL/2, scaledDoubleTapSlop)); } if( gesture2PtrTouchScroll.process(pe) ) { @@ -2903,11 +2903,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - + // // - Synthesize mouse CLICKED // - Ignore sent CLICKED - // + // final MouseEvent eClicked; switch( eventType ) { case MouseEvent.EVENT_MOUSE_PRESSED: @@ -2921,7 +2921,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer eClicked = pe.createVariant(MouseEvent.EVENT_MOUSE_CLICKED); } else { eClicked = null; - pState0.lastButtonPressTime = 0; + pState0.lastButtonPressTime = 0; } break; case MouseEvent.EVENT_MOUSE_CLICKED: @@ -2935,7 +2935,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer default: eClicked = null; } - + if( null != pe ) { if(DEBUG_MOUSE_EVENT) { System.err.println("consumePointerEvent.send.1: "+pe); @@ -2949,7 +2949,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer dispatchMouseEvent(eClicked); } } - + private final void dispatchMouseEvent(MouseEvent e) { for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) { MouseListener l = mouseListeners.get(i); @@ -2989,15 +2989,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // private static final int keyTrackingRange = 255; private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 ); - + protected final boolean isKeyCodeTracked(final short keyCode) { return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange; } - + /** * @param keyCode the keyCode to set pressed state * @param pressed true if pressed, otherwise false - * @return the previus pressed value + * @return the previus pressed value */ protected final boolean setKeyPressed(short keyCode, boolean pressed) { final int v = 0xFFFF & (int)keyCode; @@ -3008,7 +3008,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** * @param keyCode the keyCode to test pressed state - * @return true if pressed, otherwise false + * @return true if pressed, otherwise false */ protected final boolean isKeyPressed(short keyCode) { final int v = 0xFFFF & (int)keyCode; @@ -3017,7 +3017,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return false; } - + public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { // Always add currently pressed mouse buttons to modifier mask consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) ); @@ -3027,12 +3027,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Always add currently pressed mouse buttons to modifier mask enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) ); } - + @Override public final void setKeyboardVisible(boolean visible) { if(isNativeValid()) { // We don't skip the impl. if it seems that there is no state change, - // since we cannot assume the impl. reliably gives us it's current state. + // since we cannot assume the impl. reliably gives us it's current state. final boolean ok = setKeyboardVisibleImpl(visible); if(DEBUG_IMPLEMENTATION || DEBUG_KEY_EVENT) { System.err.println("setKeyboardVisible(native): visible "+keyboardVisible+" -- op[visible:"+visible +", ok "+ok+"] -> "+(visible && ok)); @@ -3046,13 +3046,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public final boolean isKeyboardVisible() { return keyboardVisible; } - /** + /** * Returns <code>true</code> if operation was successful, otherwise <code>false</code>. * <p> * We assume that a failed invisible operation is due to an already invisible keyboard, - * hence even if an invisible operation failed, the keyboard is considered invisible! - * </p> - */ + * hence even if an invisible operation failed, the keyboard is considered invisible! + * </p> + */ protected boolean setKeyboardVisibleImpl(boolean visible) { return false; // nop } @@ -3066,7 +3066,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } protected boolean keyboardVisible = false; - + @Override public void addKeyListener(KeyListener l) { addKeyListener(-1, l); @@ -3079,7 +3079,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @SuppressWarnings("unchecked") ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone(); - if(0>index) { + if(0>index) { index = clonedListeners.size(); } clonedListeners.add(index, l); @@ -3101,7 +3101,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public KeyListener getKeyListener(int index) { @SuppressWarnings("unchecked") ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone(); - if(0>index) { + if(0>index) { index = clonedListeners.size()-1; } return clonedListeners.get(index); @@ -3125,7 +3125,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return e.isConsumed(); } - + protected void consumeKeyEvent(KeyEvent e) { boolean consumedE = false; if( null != keyboardFocusHandler && !e.isAutoRepeat() ) { @@ -3164,7 +3164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public void addWindowListener(int index, WindowListener l) + public void addWindowListener(int index, WindowListener l) throws IndexOutOfBoundsException { if(l == null) { @@ -3172,8 +3172,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @SuppressWarnings("unchecked") ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone(); - if(0>index) { - index = clonedListeners.size(); + if(0>index) { + index = clonedListeners.size(); } clonedListeners.add(index, l); windowListeners = clonedListeners; @@ -3194,8 +3194,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public WindowListener getWindowListener(int index) { @SuppressWarnings("unchecked") ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone(); - if(0>index) { - index = clonedListeners.size()-1; + if(0>index) { + index = clonedListeners.size()-1; } return clonedListeners.get(index); } @@ -3234,7 +3234,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer l.windowRepaint((WindowUpdateEvent)e); break; default: - throw + throw new NativeWindowException("Unexpected window event type " + e.getEventType()); } @@ -3248,7 +3248,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); } hasFocus = focusGained; - final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ; + final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ; if(!defer) { sendWindowEvent(evt); } else { @@ -3256,7 +3256,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - + /** Triggered by implementation's WM events to update the visibility state. */ protected void visibleChanged(boolean defer, boolean visible) { if(this.visible != visible) { @@ -3282,7 +3282,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer display.dispatchMessagesNative(); // status up2date } if(this.visible != visible) { - final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible; + final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible; if(failFast) { throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { @@ -3297,7 +3297,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */ + /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */ protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { if(force || getWidth() != newWidth || getHeight() != newHeight) { if(DEBUG_IMPLEMENTATION) { @@ -3316,7 +3316,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - + private boolean waitForSize(int w, int h, boolean failFast, long timeOut) { final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date @@ -3338,8 +3338,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return true; } } - - /** Triggered by implementation's WM events to update the position. */ + + /** Triggered by implementation's WM events to update the position. */ protected void positionChanged(boolean defer, int newX, int newY) { if ( getX() != newX || getY() != newY ) { if(DEBUG_IMPLEMENTATION) { @@ -3352,7 +3352,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED); } } else { - autoPosition = false; // ensure it's off even w/ same position + autoPosition = false; // ensure it's off even w/ same position } } @@ -3396,10 +3396,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } return ok; } - + /** - * Triggered by implementation's WM events to update the insets. - * + * Triggered by implementation's WM events to update the insets. + * * @see #getInsets() * @see #updateInsetsImpl(Insets) */ @@ -3409,7 +3409,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.insetsChanged: skip insets change for undecoration mode"); } - } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() || + } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() || top != insets.getTopHeight() || bottom != insets.getBottomHeight() ) ) { insets.set(left, right, top, bottom); @@ -3419,10 +3419,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - + /** * Triggered by implementation's WM events or programmatic while respecting {@link #getDefaultCloseOperation()}. - * + * * @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE} * and hence force destruction. Otherwise is follows the user settings. * @return true if this window is no more valid and hence has been destroyed, otherwise false. @@ -3434,9 +3434,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this); // Thread.dumpStack(); } - + final boolean destroyed; - + if( isNativeValid() ) { if( WindowClosingMode.DISPOSE_ON_CLOSE == mode ) { if(force) { @@ -3457,7 +3457,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // send synced destroy notifications sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY); } - + destroyed = !isNativeValid(); } else { destroyed = true; @@ -3465,19 +3465,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+mode+") END "+getThreadName()+": destroyed "+destroyed+", "+this); - } - + } + return destroyed; } @Override public void windowRepaint(int x, int y, int width, int height) { - windowRepaint(false, x, y, width, height); + windowRepaint(false, x, y, width, height); } - + /** * Triggered by implementation's WM events to update the content - */ + */ protected void windowRepaint(boolean defer, int x, int y, int width, int height) { width = ( 0 >= width ) ? getWidth() : width; height = ( 0 >= height ) ? getHeight() : height; @@ -3542,7 +3542,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected final void shouldNotCallThis() { throw new NativeWindowException("Should not call this"); } - + public static String getThreadName() { return Display.getThreadName(); } diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index 861a6d6be..2ba5b3460 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.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.newt.awt; import javax.media.nativewindow.AbstractGraphicsConfiguration; @@ -76,12 +76,12 @@ public class NewtFactoryAWT extends NewtFactory { } return (JAWTWindow)nw; } - + public static void destroyNativeWindow(JAWTWindow jawtWindow) { final AbstractGraphicsConfiguration config = jawtWindow.getGraphicsConfiguration(); jawtWindow.destroy(); - config.getScreen().getDevice().close(); + config.getScreen().getDevice().close(); } - + } diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index d71ad175b..0ee3cc0cd 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.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,26 +20,26 @@ * 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.newt.awt.event; import com.jogamp.newt.event.MouseEvent; /** * - * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a> + * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a> * <pre> Modifier AWT Constant AWT Bit AWT Ex NEWT Constant NEWT Bit ------------- ------------------------------- ------- ------ ------------------------- -------- - Shift Event.SHIFT_MASK 0 - Ctrl Event.CTRL_MASK 1 - Meta Event.META_MASK 2 - Alt Event.ALT_MASK 3 + Shift Event.SHIFT_MASK 0 + Ctrl Event.CTRL_MASK 1 + Meta Event.META_MASK 2 + Alt Event.ALT_MASK 3 Button1 InputEvent.BUTTON1_MASK 4 Button2 InputEvent.BUTTON2_MASK 3 Button3 InputEvent.BUTTON3_MASK 2 @@ -88,10 +88,10 @@ public class AWTNewtEventFactory { Method _getMaskForButtonMethod = null; try { _getMaskForButtonMethod = ReflectionUtil.getMethod(java.awt.event.InputEvent.class, "getMaskForButton", int.class); - } catch(Throwable t) {} + } catch(Throwable t) {} getMaskForButtonMethod = _getMaskForButtonMethod; } */ - + awtButtonDownMasks = new int[com.jogamp.newt.event.MouseEvent.BUTTON_COUNT] ; // java.awt.MouseInfo.getNumberOfButtons() ; for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) { awtButtonDownMasks[n] = getAWTButtonDownMaskImpl(n+1); @@ -112,12 +112,12 @@ public class AWTNewtEventFactory { case java.awt.event.WindowEvent.WINDOW_LOST_FOCUS: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS; case java.awt.event.FocusEvent.FOCUS_LOST: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS; // n/a case java.awt.event.WindowEvent.WINDOW_STATE_CHANGED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_STATE_CHANGED; - + case java.awt.event.ComponentEvent.COMPONENT_MOVED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_MOVED; case java.awt.event.ComponentEvent.COMPONENT_RESIZED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_RESIZED; // n/a case java.awt.event.ComponentEvent.COMPONENT_SHOWN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_SHOWN; // n/a case java.awt.event.ComponentEvent.COMPONENT_HIDDEN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_HIDDEN; - + case java.awt.event.MouseEvent.MOUSE_CLICKED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED; case java.awt.event.MouseEvent.MOUSE_PRESSED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED; case java.awt.event.MouseEvent.MOUSE_RELEASED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED; @@ -126,17 +126,17 @@ public class AWTNewtEventFactory { case java.awt.event.MouseEvent.MOUSE_EXITED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_EXITED; case java.awt.event.MouseEvent.MOUSE_DRAGGED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED; case java.awt.event.MouseEvent.MOUSE_WHEEL: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_WHEEL_MOVED; - + case java.awt.event.KeyEvent.KEY_PRESSED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED; case java.awt.event.KeyEvent.KEY_RELEASED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED; } return (short)0; } - + private static int getAWTButtonDownMaskImpl(int button) { /** * java.awt.event.InputEvent.getMaskForButton(button); - * + * if(null != getMaskForButtonMethod) { Object r=null; try { @@ -157,16 +157,16 @@ public class AWTNewtEventFactory { m = 1 << ( 10 + button ) ; // b4 = 1<<14, b5 = 1<<15, etc } else { m = 0; - } + } } return m; } - + /** * <p> * See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>. * </p> - * + * * @param button * @return */ @@ -175,9 +175,9 @@ public class AWTNewtEventFactory { return awtButtonDownMasks[button-1]; } else { return 0; - } + } } - + public static final short awtButton2Newt(int awtButton) { if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) { return (short)awtButton; @@ -185,32 +185,32 @@ public class AWTNewtEventFactory { return (short)0; } } - + /** * Converts the specified set of AWT event modifiers and extended event * modifiers to the equivalent NEWT event modifiers. - * + * * <p> * See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>. * </p> - * + * * @param awtMods * The AWT event modifiers. - * + * * @param awtModsEx * The AWT extended event modifiers. * AWT passes mouse button specific bits here and are the preferred way check the mouse button state. */ public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx) { int newtMods = 0; - + /** Redundant old modifiers .. if ((awtMods & java.awt.event.InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK; if ((awtMods & java.awt.event.InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK; if ((awtMods & java.awt.event.InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK; if ((awtMods & java.awt.event.InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_MASK; if ((awtMods & java.awt.event.InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK; */ - + if ((awtModsEx & java.awt.event.InputEvent.SHIFT_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK; if ((awtModsEx & java.awt.event.InputEvent.CTRL_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK; if ((awtModsEx & java.awt.event.InputEvent.META_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK; @@ -221,7 +221,7 @@ public class AWTNewtEventFactory { // being ignored intentionally. The AWT docs say that the // BUTTON1_DOWN_MASK etc bits in the extended modifiers are // the preferred place to check current button state. - + if( 0 != awtModsEx ) { for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) { if ( (awtModsEx & awtButtonDownMasks[n]) != 0 ) { @@ -232,7 +232,7 @@ public class AWTNewtEventFactory { return newtMods; } - + public static short awtKeyCode2NewtKeyCode(final int awtKeyCode) { final short defNEWTKeyCode = (short)awtKeyCode; switch (awtKeyCode) { @@ -371,7 +371,7 @@ public class AWTNewtEventFactory { case java.awt.event.KeyEvent.VK_MULTIPLY : return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY; case java.awt.event.KeyEvent.VK_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE; case java.awt.event.KeyEvent.VK_NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK; - case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */ + case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */ case java.awt.event.KeyEvent.VK_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT; case java.awt.event.KeyEvent.VK_KP_UP : /** Fall through intended .. */ case java.awt.event.KeyEvent.VK_UP : return com.jogamp.newt.event.KeyEvent.VK_UP; @@ -381,7 +381,7 @@ public class AWTNewtEventFactory { case java.awt.event.KeyEvent.VK_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN; case java.awt.event.KeyEvent.VK_CONTEXT_MENU : return com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU; case java.awt.event.KeyEvent.VK_WINDOWS : return com.jogamp.newt.event.KeyEvent.VK_WINDOWS; - case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META; + case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META; case java.awt.event.KeyEvent.VK_HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP; case java.awt.event.KeyEvent.VK_COMPOSE : return com.jogamp.newt.event.KeyEvent.VK_COMPOSE; case java.awt.event.KeyEvent.VK_BEGIN : return com.jogamp.newt.event.KeyEvent.VK_BEGIN; @@ -558,7 +558,7 @@ public class AWTNewtEventFactory { case com.jogamp.newt.event.KeyEvent.VK_DOWN : return java.awt.event.KeyEvent.VK_DOWN; case com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU : return java.awt.event.KeyEvent.VK_CONTEXT_MENU; case com.jogamp.newt.event.KeyEvent.VK_WINDOWS : return java.awt.event.KeyEvent.VK_WINDOWS; - case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META; + case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META; case com.jogamp.newt.event.KeyEvent.VK_HELP : return java.awt.event.KeyEvent.VK_HELP; case com.jogamp.newt.event.KeyEvent.VK_COMPOSE : return java.awt.event.KeyEvent.VK_COMPOSE; case com.jogamp.newt.event.KeyEvent.VK_BEGIN : return java.awt.event.KeyEvent.VK_BEGIN; @@ -636,7 +636,7 @@ public class AWTNewtEventFactory { } return new com.jogamp.newt.event.MouseEvent( newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(), - mods, event.getX(), event.getY(), (short)event.getClickCount(), + mods, event.getX(), event.getY(), (short)event.getClickCount(), newtButton, MouseEvent.getRotationXYZ(rotation, mods), 1f); } return null; // no mapping .. @@ -650,11 +650,11 @@ public class AWTNewtEventFactory { if( (short)0 != newtType ) { final short newtKeyCode = awtKeyCode2NewtKeyCode( event.getKeyCode() ); return com.jogamp.newt.event.KeyEvent.create( - newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(), - awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()), + newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(), + awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()), newtKeyCode, newtKeyCode, event.getKeyChar()); } return null; // no mapping .. } - + } diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index fa494adca..325f17278 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.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.newt.awt.event; import java.awt.KeyboardFocusManager; @@ -45,7 +45,7 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter; public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener { NativeWindow downstreamParent; - + public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) { super(downstream); this.downstreamParent = downstreamParent; @@ -111,12 +111,12 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt public void componentMoved(java.awt.event.ComponentEvent e) { if(DEBUG_IMPLEMENTATION) { - System.err.println("AWT: componentMoved: "+e); + System.err.println("AWT: componentMoved: "+e); } final Window newtWindow = getNewtWindow(); if(newtWindow.getDelegatedWindow() instanceof DriverUpdatePosition) { ((DriverUpdatePosition)newtWindow.getDelegatedWindow()).updatePosition(0, 0); - } + } } public void windowActivated(java.awt.event.WindowEvent e) { @@ -130,7 +130,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt public void hierarchyChanged(java.awt.event.HierarchyEvent e) { if( null == getNewtEventListener() ) { long bits = e.getChangeFlags(); - final java.awt.Component changed = e.getChanged(); + final java.awt.Component changed = e.getChanged(); if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) { final boolean showing = changed.isShowing(); if(DEBUG_IMPLEMENTATION) { @@ -142,7 +142,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt getNewtWindow().setVisible(showing); } }}); - } + } if(DEBUG_IMPLEMENTATION) { if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) { final boolean displayability = changed.isDisplayable(); diff --git a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java index 0a824e83b..0ff86fe93 100644 --- a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java +++ b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java @@ -1,10 +1,10 @@ package jogamp.newt.driver; -/** +/** * Interface tagging driver requirement of clearing the focus. * <p> - * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus. - * </p> + * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus. + * </p> */ public interface DriverClearFocus { /** Programmatic clear the focus */ diff --git a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java index 2ec327187..e5f9b6a68 100644 --- a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java +++ b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java @@ -1,14 +1,14 @@ package jogamp.newt.driver; -/** +/** * Interface tagging driver requirement of absolute positioning, ie. depend on parent position. */ public interface DriverUpdatePosition { - /** + /** * Programmatic update the top-left corner * of the client area relative to it's parent. - * - * @param x x-component + * + * @param x x-component * @param y y-component **/ void updatePosition(int x, int y); diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java index 9a1632130..14cc9c69d 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.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. - * + * */ package jogamp.newt.driver.awt; @@ -100,7 +100,7 @@ public class AWTCanvas extends Canvas { @Override public void paint(Graphics g) { } - + public boolean hasDeviceChanged() { boolean res = displayConfigChanged; displayConfigChanged=false; @@ -154,12 +154,12 @@ public class AWTCanvas extends Canvas { public NativeWindow getNativeWindow() { final JAWTWindow _jawtWindow = jawtWindow; return (null != _jawtWindow) ? _jawtWindow : null; - } - + } + public boolean isOffscreenLayerSurfaceEnabled() { - return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false; + return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false; } - + public void removeNotify() { try { dispose(); @@ -188,7 +188,7 @@ public class AWTCanvas extends Canvas { } } } - + private String getThreadName() { return Thread.currentThread().getName(); } /** @@ -200,7 +200,7 @@ public class AWTCanvas extends Canvas { * Workaround for problems with Xinerama and java.awt.Component.checkGD * when adding to a container on a different graphics device than the * one that this Canvas is associated with. - * + * * GC will be null unless: * - A native peer has assigned it. This means we have a native * peer, and are already comitted to a graphics configuration. @@ -214,7 +214,7 @@ public class AWTCanvas extends Canvas { * chosen is only non-null on platforms where the GLDrawableFactory * returns a non-null GraphicsConfiguration (in the GLCanvas * constructor). - * + * * if gc is from this Canvas' native peer then it should equal chosen, * otherwise it is from an ancestor component that this Canvas is being * added to, and we go into this block. @@ -224,21 +224,21 @@ public class AWTCanvas extends Canvas { * Check for compatibility with gc. If they differ by only the * device then return a new GCconfig with the super-class' GDevice * (and presumably the same visual ID in Xinerama). - * + * */ if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) { /* * Here we select a GraphicsConfiguration on the alternate * device that is presumably identical to the chosen * configuration, but on the other device. - * + * * Should really check to ensure that we select a configuration * with the same X visual ID for Xinerama screens, otherwise the * GLDrawable may have the wrong visual ID (I don't think this * ever gets updated). May need to add a method to * X11GLDrawableFactory to do this in a platform specific * manner. - * + * * However, on platforms where we can actually get into this * block, both devices should have the same visual list, and the * same configuration should be selected here. @@ -265,7 +265,7 @@ public class AWTCanvas extends Canvas { chosen = compatible; if( !config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities())) { displayConfigChanged=true; - } + } awtConfig = config; } } @@ -275,7 +275,7 @@ public class AWTCanvas extends Canvas { * return the GC that was selected in the constructor (and might * cause an exception in Component.checkGD when adding to a * container, but in this case that would be the desired behavior). - * + * */ return chosen; } else if (gc == null) { @@ -299,7 +299,7 @@ public class AWTCanvas extends Canvas { CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, GraphicsDevice device) { - final AbstractGraphicsScreen aScreen = null != device ? + final AbstractGraphicsScreen aScreen = null != device ? AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT): AWTGraphicsScreen.createDefault(); AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java index 02f4be0cd..bddb43b30 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java @@ -40,9 +40,9 @@ import jogamp.newt.Debug; public class AWTEDTUtil implements EDTUtil { public static final boolean DEBUG = Debug.debug("EDT"); - + private final Object edtLock = new Object(); // locking the EDT start/stop state - private final ThreadGroup threadGroup; + private final ThreadGroup threadGroup; private final String name; private final Runnable dispatchMessages; private NEDT nedt = null; @@ -66,7 +66,7 @@ public class AWTEDTUtil implements EDTUtil { final public void setPollPeriod(long ms) { pollPeriod = ms; } - + @Override public final boolean start() throws IllegalStateException { synchronized(edtLock) { @@ -107,12 +107,12 @@ public class AWTEDTUtil implements EDTUtil { public final boolean isCurrentThreadNEDT() { return nedt == Thread.currentThread(); } - + @Override public final boolean isCurrentThreadEDTorNEDT() { - return EventQueue.isDispatchThread() || nedt == Thread.currentThread(); + return EventQueue.isDispatchThread() || nedt == Thread.currentThread(); } - + @Override final public boolean isRunning() { return nedt.isRunning() ; @@ -127,12 +127,12 @@ public class AWTEDTUtil implements EDTUtil { public final boolean invoke(boolean wait, Runnable task) { return invokeImpl(wait, task, false); } - + private static Runnable nullTask = new Runnable() { @Override - public void run() { } + public void run() { } }; - + private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) { Throwable throwable = null; RunnableTask rTask = null; @@ -145,7 +145,7 @@ public class AWTEDTUtil implements EDTUtil { if(DEBUG) { Thread.dumpStack(); } - return false; + return false; } if( isCurrentThreadEDT() ) { if(null != task) { @@ -181,7 +181,7 @@ public class AWTEDTUtil implements EDTUtil { if(null != task) { rTask = new RunnableTask(task, wait ? rTaskLock : null, - true /* always catch and report Exceptions, don't disturb EDT */, + true /* always catch and report Exceptions, don't disturb EDT */, wait ? null : System.err); AWTEDTExecutor.singleton.invoke(false, rTask); } @@ -205,7 +205,7 @@ public class AWTEDTUtil implements EDTUtil { } return true; } - } + } @Override final public boolean waitUntilIdle() { @@ -241,7 +241,7 @@ public class AWTEDTUtil implements EDTUtil { } } } - + class NEDT extends Thread { volatile boolean shouldStop = false; volatile boolean isRunning = false; @@ -261,7 +261,7 @@ public class AWTEDTUtil implements EDTUtil { super.start(); } - /** + /** * Utilizing locking only on tasks and its execution, * not for event dispatching. */ @@ -302,7 +302,7 @@ public class AWTEDTUtil implements EDTUtil { } } finally { if(DEBUG) { - System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error); + System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error); } synchronized(edtLock) { isRunning = false; @@ -317,7 +317,7 @@ public class AWTEDTUtil implements EDTUtil { } // finally } // run() } // EventDispatchThread - + } diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java index 30449f9bc..9e716d544 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.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. - * + * */ package jogamp.newt.driver.awt; @@ -57,7 +57,7 @@ public class DisplayDriver extends DisplayImpl { protected EDTUtil createEDTUtil() { final EDTUtil def; if(NewtFactory.useEDT()) { - def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable); + def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable); if(DEBUG) { System.err.println("Display.createNative("+getFQName()+") Create EDTUtil: "+def.getClass().getName()); } @@ -67,7 +67,7 @@ public class DisplayDriver extends DisplayImpl { return def; } - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index 126143e1e..a2430e2bb 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -1,21 +1,21 @@ /* * Copyright (c) 2008 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,7 +28,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.newt.driver.awt; @@ -66,10 +66,10 @@ public class ScreenDriver extends ScreenImpl { } protected void closeNativeImpl() { } - + protected int validateScreenIndex(int idx) { - return idx; // pass through ... - } + return idx; // pass through ... + } private static MonitorMode getModeProps(Cache cache, DisplayMode mode) { int rate = mode.getRefreshRate(); @@ -90,16 +90,16 @@ public class ScreenDriver extends ScreenImpl { props[i++] = 0; // flags props[i++] = 0; // mode_idx props[i++] = 0; // rotation - return MonitorModeProps.streamInMonitorMode(null, cache, props, 0); + return MonitorModeProps.streamInMonitorMode(null, cache, props, 0); } - + @Override protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) { final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice(); final DisplayMode[] awtModes = awtGD.getDisplayModes(); for(int i=0; i<awtModes.length; i++) { getModeProps(cache, awtModes[i]); - } + } final MonitorMode currentMode = getModeProps(cache, awtGD.getDisplayMode()); int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES]; @@ -116,7 +116,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { + protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { return null; } @@ -124,5 +124,5 @@ public class ScreenDriver extends ScreenImpl { protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) { return false; } - + } diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index 77daa556f..db71695b7 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.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. - * + * */ package jogamp.newt.driver.awt; @@ -109,33 +109,33 @@ public class WindowDriver extends WindowImpl { } else { owningFrame=false; defineSize(awtContainer.getWidth(), awtContainer.getHeight()); - definePosition(awtContainer.getX(), awtContainer.getY()); + definePosition(awtContainer.getX(), awtContainer.getY()); } if(null!=awtFrame) { awtFrame.setTitle(getTitle()); } awtContainer.setLayout(new BorderLayout()); - + if( null == awtCanvas ) { awtCanvas = new AWTCanvas(capsRequested, WindowDriver.this.capabilitiesChooser); // canvas.addComponentListener(listener); awtContainer.add(awtCanvas, BorderLayout.CENTER); - + // via EDT .. new AWTMouseAdapter(this).addTo(awtCanvas); // fwd all AWT Mouse events to here new AWTKeyAdapter(this).addTo(awtCanvas); // fwd all AWT Key events to here - + // direct w/o EDT new AWTWindowAdapter(new LocalWindowListener(), this).addTo(awtCanvas); // fwd all AWT Window events to here } reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); // throws exception if failed .. - + final NativeWindow nw = awtCanvas.getNativeWindow(); if( null != nw ) { - setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() ); + setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() ); setWindowHandle( nw.getWindowHandle() ); } } @@ -153,7 +153,7 @@ public class WindowDriver extends WindowImpl { owningFrame=false; } awtCanvas = null; - awtFrame = null; + awtFrame = null; awtContainer = null; } @@ -166,11 +166,11 @@ public class WindowDriver extends WindowImpl { throw new NativeWindowException("Error Device change null GraphicsConfiguration: "+this); } setGraphicsConfiguration(cfg); - + // propagate new info .. ((ScreenDriver)getScreen()).setAWTGraphicsScreen((AWTGraphicsScreen)cfg.getScreen()); ((DisplayDriver)getScreen().getDisplay()).setAWTGraphicsDevice((AWTGraphicsDevice)cfg.getScreen().getDevice()); - + ((ScreenDriver)getScreen()).updateVirtualScreenOriginAndSize(); } return res; @@ -213,7 +213,7 @@ public class WindowDriver extends WindowImpl { awtCanvas.invalidate(); awtContainer.validate(); } - + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { if(DEBUG_IMPLEMENTATION) { System.err.println("AWTWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ @@ -228,7 +228,7 @@ public class WindowDriver extends WindowImpl { } } } - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { if( 0 != ( FLAG_IS_VISIBLE & flags) ) { setCanvasSizeImpl(width, height); @@ -244,15 +244,15 @@ public class WindowDriver extends WindowImpl { } } defineSize(width, height); // we are on AWT-EDT .. change values immediately - + if( awtContainer.getX() != x || awtContainer.getY() != y ) { awtContainer.setLocation(x, y); } - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { if( 0 != ( FLAG_IS_VISIBLE & flags ) ) { if( !hasDeviceChanged() ) { - // oops ?? + // oops ?? final AWTGraphicsConfiguration cfg = awtCanvas.getAWTGraphicsConfiguration(); if(null == cfg) { throw new NativeWindowException("Error: !hasDeviceChanged && null == GraphicsConfiguration: "+this); @@ -262,7 +262,7 @@ public class WindowDriver extends WindowImpl { } visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + return true; } @@ -271,13 +271,13 @@ public class WindowDriver extends WindowImpl { ap.translate(x, y); return new Point((int)(ap.getX()+0.5),(int)(ap.getY()+0.5)); } - + @Override public NativeSurface getWrappedSurface() { return ( null != awtCanvas ) ? awtCanvas.getNativeWindow() : null; } - class LocalWindowListener implements com.jogamp.newt.event.WindowListener { + class LocalWindowListener implements com.jogamp.newt.event.WindowListener { @Override public void windowMoved(com.jogamp.newt.event.WindowEvent e) { if(null!=awtContainer) { @@ -304,11 +304,11 @@ public class WindowDriver extends WindowImpl { } @Override public void windowGainedFocus(WindowEvent e) { - WindowDriver.this.focusChanged(false, true); + WindowDriver.this.focusChanged(false, true); } @Override public void windowLostFocus(WindowEvent e) { - WindowDriver.this.focusChanged(false, false); + WindowDriver.this.focusChanged(false, false); } @Override public void windowRepaint(WindowUpdateEvent e) { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java index 112be2b04..1b73cb381 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.bcm.egl; diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index abe2908b0..269574adc 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.bcm.egl; @@ -60,9 +60,9 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected void closeNativeImpl() { } protected int validateScreenIndex(int idx) { - return 0; // only one screen available + return 0; // only one screen available } - + @Override protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; @@ -99,11 +99,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } - + protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { vOriginSize.set(0, 0, fixedWidth, fixedHeight); // FIXME } - + //---------------------------------------------------------------------- // Internals only // diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java index 49d3d98ba..bed0520ff 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.bcm.egl; @@ -56,7 +56,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { if(0!=getParentWindowHandle()) { throw new RuntimeException("Window parenting not supported (yet)"); } - // query a good configuration, however chose the final one by the native queried egl-cfg-id + // query a good configuration, however chose the final one by the native queried egl-cfg-id // after creation at {@link #windowCreated(int, int, int)}. final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED); @@ -89,8 +89,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } } - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { - if(0!=getWindowHandle()) { + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + if(0!=getWindowHandle()) { if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) { if( 0 != ( FLAG_IS_FULLSCREEN & flags) ) { // n/a in BroadcomEGL @@ -110,7 +110,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { if(x>=0 || y>=0) { System.err.println("BCEGL Window.setPositionImpl n/a in BroadcomEGL"); } - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } @@ -122,7 +122,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } protected void updateInsetsImpl(Insets insets) { - // nop .. + // nop .. } @Override diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index 4872a9071..52c92a5da 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.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. @@ -72,7 +72,7 @@ public class DisplayDriver extends DisplayImpl { DispatchMessages(); } - protected static native boolean initIDs(); + protected static native boolean initIDs(); private native void DispatchMessages(); } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index be99052d7..5a1917419 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.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. @@ -53,9 +53,9 @@ public class ScreenDriver extends ScreenImpl { protected void closeNativeImpl() { } protected int validateScreenIndex(int idx) { - return 0; // only one screen available - } - + return 0; // only one screen available + } + @Override protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; @@ -92,20 +92,20 @@ public class ScreenDriver extends ScreenImpl { protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } - + @Override protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { vOriginSize.set(0, 0, cachedWidth, cachedHeight); } - + /** Called from {@link #initNative()}. */ protected void setScreenSize(int width, int height) { cachedWidth = width; cachedHeight = height; } - + private static int cachedWidth = 0; - private static int cachedHeight = 0; + private static int cachedHeight = 0; protected static native boolean initIDs(); protected native void initNative(); diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java index e820439d0..560e49e96 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.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,7 +65,7 @@ public class WindowDriver extends WindowImpl { final EGLGraphicsDevice aDevice = (EGLGraphicsDevice) aScreen.getDevice(); final EGLGraphicsDevice eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(aDevice.getNativeDisplayID(), aDevice.getConnection(), aDevice.getUnitID()); final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex()); - + final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, eglScreen, VisualIDHolder.VID_UNDEFINED); if (null == cfg) { @@ -89,24 +89,24 @@ public class WindowDriver extends WindowImpl { windowHandleClose = nativeWindowHandle; addWindowListener(LinuxMouseTracker.getSingleton()); addWindowListener(LinuxEventDeviceTracker.getSingleton()); - focusChanged(false, true); + focusChanged(false, true); } protected void closeNativeImpl() { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) getGraphicsConfiguration().getScreen().getDevice(); - + removeWindowListener(LinuxMouseTracker.getSingleton()); removeWindowListener(LinuxEventDeviceTracker.getSingleton()); - + if(0!=windowHandleClose) { CloseWindow(windowHandleClose, windowUserData); windowUserData=0; } - + eglDevice.close(); } - protected void requestFocusImpl(boolean reparented) { + protected void requestFocusImpl(boolean reparented) { focusChanged(false, true); } @@ -115,7 +115,7 @@ public class WindowDriver extends WindowImpl { setVisible0(nativeWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags)); visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + if(0!=nativeWindowHandle) { if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) { final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ; @@ -135,11 +135,11 @@ public class WindowDriver extends WindowImpl { System.err.println("setPosition n/a in KD"); } } - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + return true; } @@ -148,9 +148,9 @@ public class WindowDriver extends WindowImpl { } protected void updateInsetsImpl(Insets insets) { - // nop .. + // nop .. } - + //---------------------------------------------------------------------- // Internals only // diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java index ee93eb932..4cb566bc2 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.intel.gdl; diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 27b776562..b5202aaf9 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.intel.gdl; @@ -62,9 +62,9 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected void closeNativeImpl() { } protected int validateScreenIndex(int idx) { - return 0; // only one screen available + return 0; // only one screen available } - + @Override protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; @@ -101,11 +101,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } - + protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { vOriginSize.set(0, 0, cachedWidth, cachedHeight); } - + //---------------------------------------------------------------------- // Internals only // @@ -118,7 +118,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { cachedWidth = width; cachedHeight = height; } - + private static int cachedWidth = 0; private static int cachedHeight = 0; } diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java index 98335f192..80821d4da 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.intel.gdl; @@ -108,7 +108,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + return true; } @@ -126,9 +126,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } protected void updateInsetsImpl(Insets insets) { - // nop .. + // nop .. } - + //---------------------------------------------------------------------- // Internals only // diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java index 3cd72e971..1b92ca586 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.kd; diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index f893275ca..17cc5dd2f 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.kd; @@ -58,9 +58,9 @@ public class ScreenDriver extends ScreenImpl { protected void closeNativeImpl() { } protected int validateScreenIndex(int idx) { - return 0; // only one screen available - } - + return 0; // only one screen available + } + @Override protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; @@ -97,16 +97,16 @@ public class ScreenDriver extends ScreenImpl { protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } - + protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { vOriginSize.set(0, 0, cachedWidth, cachedHeight); } - + protected void sizeChanged(int w, int h) { cachedWidth = w; cachedHeight = h; } - + private static int cachedWidth = 0; - private static int cachedHeight = 0; + private static int cachedHeight = 0; } diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java index c733a3e94..d30d4f025 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.kd; @@ -97,7 +97,7 @@ public class WindowDriver extends WindowImpl { setVisible0(eglWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags)); visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + if(0!=eglWindowHandle) { if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) { final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ; @@ -117,11 +117,11 @@ public class WindowDriver extends WindowImpl { System.err.println("setPosition n/a in KD"); } } - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } - + return true; } @@ -130,9 +130,9 @@ public class WindowDriver extends WindowImpl { } protected void updateInsetsImpl(Insets insets) { - // nop .. + // nop .. } - + //---------------------------------------------------------------------- // Internals only // diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java index e68b91d82..b7c86a26d 100644 --- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java +++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.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. @@ -126,7 +126,7 @@ public class LinuxEventDeviceTracker implements WindowListener { try { while(true) { Thread.sleep(1000); - } + } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -186,7 +186,7 @@ public class LinuxEventDeviceTracker implements WindowListener { /** * The Linux input event interface. * http://www.kernel.org/doc/Documentation/input/input.txt - * + * * struct input_event { * struct timeval time; * unsigned short type; @@ -262,7 +262,7 @@ public class LinuxEventDeviceTracker implements WindowListener { break; case 1: // EV_KEY keyCode = LinuxEVKey2NewtVKey(code); // The device independent code. - keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers. + keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers. if(Window.DEBUG_KEY_EVENT) { System.out.println("[EV_KEY: [time "+timeSeconds+":"+timeSecondFraction+"] type "+type+" / code "+code+" = value "+value); } @@ -946,7 +946,7 @@ public class LinuxEventDeviceTracker implements WindowListener { case 248: // mic mute break; // FIXME - default: + default: } if(Window.DEBUG_KEY_EVENT) { diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java index 0d6278bfb..1e314b7f4 100644 --- a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java +++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.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. @@ -48,16 +48,16 @@ import com.jogamp.newt.event.WindowUpdateEvent; * within it's own polling thread. */ public class LinuxMouseTracker implements WindowListener { - + private static final LinuxMouseTracker lmt; - + static { lmt = new LinuxMouseTracker(); final Thread t = new Thread(lmt.mouseDevicePoller, "NEWT-LinuxMouseTracker"); t.setDaemon(true); t.start(); } - + public static LinuxMouseTracker getSingleton() { return lmt; } @@ -71,7 +71,7 @@ public class LinuxMouseTracker implements WindowListener { private short old_buttonDown = 0; private WindowImpl focusedWindow = null; private MouseDevicePoller mouseDevicePoller = new MouseDevicePoller(); - + @Override public void windowResized(WindowEvent e) { } @@ -107,7 +107,7 @@ public class LinuxMouseTracker implements WindowListener { @Override public void windowRepaint(WindowUpdateEvent e) { } - + class MouseDevicePoller implements Runnable { @Override public void run() { @@ -150,17 +150,17 @@ public class LinuxMouseTracker implements WindowListener { yo=(b[0]&128)>0; xd=b[1]; yd=b[2]; - + x+=xd; y-=yd; - + if(x<0) { x=0; } if(y<0) { y=0; } - + buttonDown = 0; if(lb) { buttonDown = MouseEvent.BUTTON1; @@ -171,7 +171,7 @@ public class LinuxMouseTracker implements WindowListener { if(rb) { buttonDown = MouseEvent.BUTTON3; } - + if(null != focusedWindow) { if( x >= focusedWindow.getScreen().getWidth() ) { x = focusedWindow.getScreen().getWidth() - 1; @@ -179,31 +179,31 @@ public class LinuxMouseTracker implements WindowListener { if( y >= focusedWindow.getScreen().getHeight() ) { y = focusedWindow.getScreen().getHeight() - 1; } - int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY(); - + int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY(); + if(old_x != x || old_y != y) { // mouse moved - focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 ); + focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 ); } - + if(old_buttonDown != buttonDown) { // press/release if( 0 != buttonDown ) { - focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 ); + focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 ); } else { - focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 ); + focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 ); } - } + } } else { if(Window.DEBUG_MOUSE_EVENT) { System.out.println(x+"/"+y+", hs="+hs+",vs="+vs+",lb="+lb+",rb="+rb+",mb="+mb+",xo="+xo+",yo="+yo+"xd="+xd+",yd="+yd); } } - + old_x = x; old_y = y; old_buttonDown = buttonDown; - + } if(null != fis) { try { @@ -214,5 +214,5 @@ public class LinuxMouseTracker implements WindowListener { } } } - } + } } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index a99bc4f23..2dbdfdce7 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.macosx; @@ -60,19 +60,19 @@ public class DisplayDriver extends DisplayImpl { public static void initSingleton() { // just exist to ensure static init has been run } - + public DisplayDriver() { } protected void dispatchMessagesNative() { // nop } - + protected void createNativeImpl() { aDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java index baa94facd..a89150d7c 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.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,7 +30,7 @@ package jogamp.newt.driver.macosx; import com.jogamp.newt.event.KeyEvent; public class MacKeyUtil { - + // // KeyCodes (Layout Dependent) // @@ -64,17 +64,17 @@ public class MacKeyUtil { private static final short kVK_ANSI_8 = 0x1C; private static final short kVK_ANSI_0 = 0x1D; private static final short kVK_ANSI_RightBracket = 0x1E; - private static final short kVK_ANSI_O = 0x1F; + private static final short kVK_ANSI_O = 0x1F; private static final short kVK_ANSI_U = 0x20; private static final short kVK_ANSI_LeftBracket = 0x21; private static final short kVK_ANSI_I = 0x22; private static final short kVK_ANSI_P = 0x23; private static final short kVK_ANSI_L = 0x25; private static final short kVK_ANSI_J = 0x26; - private static final short kVK_ANSI_Quote = 0x27; + private static final short kVK_ANSI_Quote = 0x27; private static final short kVK_ANSI_K = 0x28; private static final short kVK_ANSI_Semicolon = 0x29; - private static final short kVK_ANSI_Backslash = 0x2A; + private static final short kVK_ANSI_Backslash = 0x2A; private static final short kVK_ANSI_Comma = 0x2B; private static final short kVK_ANSI_Slash = 0x2C; private static final short kVK_ANSI_N = 0x2D; @@ -99,7 +99,7 @@ public class MacKeyUtil { private static final short kVK_ANSI_Keypad7 = 0x59; private static final short kVK_ANSI_Keypad8 = 0x5B; private static final short kVK_ANSI_Keypad9 = 0x5C; - + // // KeyCodes (Layout Independent) // @@ -150,7 +150,7 @@ public class MacKeyUtil { private static final short kVK_RightArrow = 0x7C; private static final short kVK_DownArrow = 0x7D; private static final short kVK_UpArrow = 0x7E; - + // // Key constants handled differently on Mac OS X than other platforms // @@ -230,8 +230,8 @@ public class MacKeyUtil { private static final char NSHelpFunctionKey = 0xF746; private static final char NSModeSwitchFunctionKey = 0xF747; */ - - static short validateKeyCode(short keyCode, char keyChar) { + + static short validateKeyCode(short keyCode, char keyChar) { // OS X Virtual Keycodes switch(keyCode) { // @@ -267,17 +267,17 @@ public class MacKeyUtil { case kVK_ANSI_8: return KeyEvent.VK_8; case kVK_ANSI_0: return KeyEvent.VK_0; case kVK_ANSI_RightBracket: return KeyEvent.VK_CLOSE_BRACKET; - case kVK_ANSI_O: return KeyEvent.VK_O; + case kVK_ANSI_O: return KeyEvent.VK_O; case kVK_ANSI_U: return KeyEvent.VK_U; case kVK_ANSI_LeftBracket: return KeyEvent.VK_OPEN_BRACKET; case kVK_ANSI_I: return KeyEvent.VK_I; case kVK_ANSI_P: return KeyEvent.VK_P; case kVK_ANSI_L: return KeyEvent.VK_L; case kVK_ANSI_J: return KeyEvent.VK_J; - case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE; + case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE; case kVK_ANSI_K: return KeyEvent.VK_K; case kVK_ANSI_Semicolon: return KeyEvent.VK_SEMICOLON; - case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH; + case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH; case kVK_ANSI_Comma: return KeyEvent.VK_COMMA; case kVK_ANSI_Slash: return KeyEvent.VK_SLASH; case kVK_ANSI_N: return KeyEvent.VK_N; @@ -302,7 +302,7 @@ public class MacKeyUtil { case kVK_ANSI_Keypad7: return KeyEvent.VK_7; case kVK_ANSI_Keypad8: return KeyEvent.VK_8; case kVK_ANSI_Keypad9: return KeyEvent.VK_9; - + // // KeyCodes (Layout Independent) // @@ -321,7 +321,7 @@ public class MacKeyUtil { case kVK_RightControl: return KeyEvent.VK_CONTROL; // case kVK_Function: return KeyEvent.VK_F; case kVK_F17: return KeyEvent.VK_F17; - // case kVK_VolumeUp: + // case kVK_VolumeUp: // case kVK_VolumeDown: // case kVK_Mute: case kVK_F18: return KeyEvent.VK_F18; @@ -354,7 +354,7 @@ public class MacKeyUtil { case kVK_DownArrow: return KeyEvent.VK_DOWN; case kVK_UpArrow: return KeyEvent.VK_UP; } - + switch (keyChar) { case NSUpArrowFunctionKey: return KeyEvent.VK_UP; case NSDownArrowFunctionKey: return KeyEvent.VK_DOWN; @@ -422,5 +422,5 @@ public class MacKeyUtil { } return (short) keyChar; // let's hope for the best (compatibility of keyChar/keyCode's) - } + } } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java index a3bb26731..5d3b7287b 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2008 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,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.newt.driver.macosx; @@ -44,7 +44,7 @@ import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; public class ScreenDriver extends ScreenImpl { - + static { DisplayDriver.initSingleton(); } @@ -68,7 +68,7 @@ public class ScreenDriver extends ScreenImpl { } return res; } - + @Override protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { int crtIdx = 0; @@ -85,16 +85,16 @@ public class ScreenDriver extends ScreenImpl { final MonitorMode currentMode = getMonitorModeImpl(cache, crtIdx, -1); if ( null == currentMode ) { throw new InternalError("Could not gather current mode of device "+crtIdx+", but gathered "+modeIdx+" modes"); - } + } final int[] monitorProps = getMonitorProps0(crtIdx); if ( null == monitorProps ) { throw new InternalError("Could not gather device "+crtIdx+", but gathered "+modeIdx+" modes"); - } + } // merge monitor-props + supported modes MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0); - + // next monitor, 1st mode - supportedModes= new ArrayHashSet<MonitorMode>(); + supportedModes= new ArrayHashSet<MonitorMode>(); crtIdx++; modeIdx=0; } else { @@ -108,16 +108,16 @@ public class ScreenDriver extends ScreenImpl { protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { return getMonitorModeImpl(null, monitor.getId(), -1); } - + @Override protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) { return setMonitorMode0(monitor.getId(), mode.getId(), mode.getRotation()); } - + protected int validateScreenIndex(int idx) { - return 0; // big-desktop w/ multiple monitor attached, only one screen available + return 0; // big-desktop w/ multiple monitor attached, only one screen available } - + private native int[] getMonitorProps0(int crt_idx); private native int[] getMonitorMode0(int crt_index, int mode_idx); private native boolean setMonitorMode0(int crt_index, int nativeId, int rot); diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index 08638d868..f36d32772 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.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. - * + * */ package jogamp.newt.driver.macosx; @@ -53,14 +53,14 @@ import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.event.KeyEvent; public class WindowDriver extends WindowImpl implements MutableSurface, DriverClearFocus, DriverUpdatePosition { - + static { DisplayDriver.initSingleton(); } public WindowDriver() { } - + @Override protected void createNativeImpl() { final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration( @@ -69,7 +69,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } setGraphicsConfiguration(cfg); - reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); + reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); if (0 == getWindowHandle()) { throw new NativeWindowException("Error creating window"); } @@ -79,7 +79,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl protected void closeNativeImpl() { try { if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.CloseAction "+Thread.currentThread().getName()); } - final long handle = getWindowHandle(); + final long handle = getWindowHandle(); visibleChanged(true, false); setWindowHandle(0); surfaceHandle = 0; @@ -92,16 +92,16 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } } ); } } catch (Throwable t) { - if(DEBUG_IMPLEMENTATION) { + if(DEBUG_IMPLEMENTATION) { Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } } } - + @Override protected int lockSurfaceImpl() { - /** + /** * if( isOffscreenInstance ) { * return LOCK_SUCCESS; * } @@ -116,7 +116,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl @Override protected void unlockSurfaceImpl() { - /** + /** * if( isOffscreenInstance ) { * return; * } @@ -129,7 +129,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } } } - + @Override public final long getSurfaceHandle() { return 0 != sscSurfaceHandle ? sscSurfaceHandle : surfaceHandle; @@ -147,14 +147,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl public void run() { orderOut0( 0 != getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() ); } } ); - } /** this is done by recreation! + } /** this is done by recreation! else if (isVisible()){ OSXUtil.RunOnMainThread(false, new Runnable() { public void run() { orderFront0( 0!=getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() ); } } ); } */ - } + } } @Override @@ -179,7 +179,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl focusChanged(false, true); } } - + @Override public final void clearFocus() { if(DEBUG_IMPLEMENTATION) { @@ -194,9 +194,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl focusChanged(false, false); } } - + private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); } - + @Override public void updatePosition(int x, int y) { final long handle = getWindowHandle(); @@ -215,8 +215,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl // no native event (fullscreen, some reparenting) positionChanged(true, x, y); } - } - + } + @Override protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { final long handle = getWindowHandle(); @@ -237,7 +237,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } super.sizeChanged(defer, newWidth, newHeight, force); } - + @Override protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) { final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent()); @@ -250,11 +250,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl final boolean useParent = useParent(parent); if( useParent ) { pClientLevelOnSreen = getLocationOnScreenImpl(x, y, parent, useParent); - } else { + } else { pClientLevelOnSreen = new Point(x, y); } } - + if(DEBUG_IMPLEMENTATION) { final AbstractGraphicsConfiguration cWinCfg = this.getGraphicsConfiguration(); final NativeWindow pWin = getParent(); @@ -269,9 +269,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl "\n\t, "+getReconfigureFlagsAsString(null, flags)); // Thread.dumpStack(); } - + final boolean setVisible = 0 != ( FLAG_IS_VISIBLE & flags); - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && !setVisible ) { if ( !isOffscreenInstance ) { OSXUtil.RunOnMainThread(false, new Runnable() { @@ -290,11 +290,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl if(isOffscreenInstance) { createWindow(true, 0 != getWindowHandle(), pClientLevelOnSreen, 64, 64, false, setVisible, false); } else { - createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height, + createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height, 0 != ( FLAG_IS_FULLSCREEN & flags), setVisible, 0 != ( FLAG_IS_ALWAYSONTOP & flags)); } } else { - if( width>0 && height>0 ) { + if( width>0 && height>0 ) { if( !isOffscreenInstance ) { OSXUtil.RunOnMainThread(false, new Runnable() { public void run() { @@ -306,7 +306,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl sizeChanged(true, width, height, false); } if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && setVisible ) { - if( !isOffscreenInstance ) { + if( !isOffscreenInstance ) { OSXUtil.RunOnMainThread(false, new Runnable() { public void run() { orderFront0(getWindowHandle()); @@ -321,7 +321,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } } if(DEBUG_IMPLEMENTATION) { - System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets()); + System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets()); } return true; } @@ -332,28 +332,28 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl final boolean useParent = useParent(parent); return getLocationOnScreenImpl(x, y, parent, useParent); } - + private Point getLocationOnScreenImpl(final int x, final int y, final NativeWindow parent, final boolean useParent) { if( !useParent && !isOffscreenInstance && 0 != surfaceHandle) { return OSXUtil.GetLocationOnScreen(surfaceHandle, true, x, y); } - + final Point p = new Point(x, y); if( useParent ) { p.translate( parent.getLocationOnScreen(null) ); } return p; } - + @Override protected void updateInsetsImpl(Insets insets) { // nop - using event driven insetsChange(..) } - + /** Callback for native screen position change event of the client area. */ - protected void screenPositionChanged(boolean defer, int newX, int newY) { + protected void screenPositionChanged(boolean defer, int newX, int newY) { // passed coordinates are in screen position of the client area - if(getWindowHandle()!=0) { + if(getWindowHandle()!=0) { final NativeWindow parent = getParent(); if( null == parent || isOffscreenInstance ) { if(DEBUG_IMPLEMENTATION) { @@ -362,7 +362,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl positionChanged(defer, newX, newY); } else { // screen position -> rel child window position - Point absPos = new Point(newX, newY); + Point absPos = new Point(newX, newY); Point parentOnScreen = parent.getLocationOnScreen(null); absPos.translate( parentOnScreen.scale(-1, -1) ); if(DEBUG_IMPLEMENTATION) { @@ -374,10 +374,10 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl System.err.println("MacWindow.positionChanged.2 (Screen Pos - IGN): ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> "+newX+"/"+newY); } } - + @Override protected boolean setPointerVisibleImpl(final boolean pointerVisible) { - if( !isOffscreenInstance ) { + if( !isOffscreenInstance ) { return setPointerVisible0(getWindowHandle(), hasFocus(), pointerVisible); } // else may need offscreen solution ? FIXME return false; @@ -385,29 +385,29 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl @Override protected boolean confinePointerImpl(final boolean confine) { - if( !isOffscreenInstance ) { + if( !isOffscreenInstance ) { return confinePointer0(getWindowHandle(), confine); } // else may need offscreen solution ? FIXME return false; } - + @Override protected void warpPointerImpl(final int x, final int y) { - if( !isOffscreenInstance ) { + if( !isOffscreenInstance ) { warpPointer0(getWindowHandle(), x, y); } // else may need offscreen solution ? FIXME } - + @Override public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } - + @Override public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, short _keySym, char keyChar) { - throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); + throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } - + protected final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, char keyChar, char keySymChar) { // Note that we send the key char for the key code on this // platform -- we do not get any useful key codes out of the system @@ -427,7 +427,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl ", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode+ ", nativeValid "+isNativeValid()+", isOffscreen "+isOffscreenInstance); } */ - + // OSX delivery order is PRESSED (t0), RELEASED (t1) and TYPED (t2) -> NEWT order: PRESSED (t0) and RELEASED (t1) // Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE key _before_ PRESSED switch(eventType) { @@ -451,15 +451,15 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl //---------------------------------------------------------------------- // Internals only - // - - private void createWindow(final boolean offscreenInstance, final boolean recreate, - final PointImmutable pS, final int width, final int height, + // + + private void createWindow(final boolean offscreenInstance, final boolean recreate, + final PointImmutable pS, final int width, final int height, final boolean fullscreen, final boolean visible, final boolean alwaysOnTop) { final long parentWinHandle = getParentWindowHandle(); final long preWinHandle = getWindowHandle(); - + if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+ ": offscreen "+offscreenInstance+", recreate "+recreate+ @@ -474,7 +474,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl setWindowHandle(0); if( 0 == surfaceHandle ) { throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView"); - } + } OSXUtil.RunOnMainThread(false, new Runnable() { public void run() { changeContentView0(parentWinHandle, preWinHandle, 0); @@ -483,14 +483,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } else { if( 0 != surfaceHandle ) { throw new NativeWindowException("Internal Error - create w/o window, but has Newt NSView"); - } + } surfaceHandle = createView0(pS.getX(), pS.getY(), width, height, fullscreen); if( 0 == surfaceHandle ) { throw new NativeWindowException("Could not create native view "+Thread.currentThread().getName()+" "+this); } } - - final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen, + + final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen, ( isUndecorated() || offscreenInstance ) ? NSBorderlessWindowMask : NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask, NSBackingStoreBuffered, surfaceHandle); @@ -498,9 +498,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this); } setWindowHandle( newWin ); - + final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance; - // Blocking initialization on main-thread! + // Blocking initialization on main-thread! OSXUtil.RunOnMainThread(true, new Runnable() { public void run() { initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height, @@ -517,7 +517,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl ie.printStackTrace(); } } - + protected static native boolean initIDs0(); private native long createView0(int x, int y, int w, int h, boolean fullscreen); private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view); @@ -543,7 +543,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl private native void changeContentView0(long parentWindowOrView, long window, long view); /** Must be called on Main-Thread */ private native void setWindowClientTopLeftPointAndSize0(long window, int x, int y, int w, int h, boolean display); - /** Must be called on Main-Thread */ + /** Must be called on Main-Thread */ private native void setWindowClientTopLeftPoint0(long window, int x, int y, boolean display); /** Must be called on Main-Thread */ private native void setAlwaysOnTop0(long window, boolean atop); @@ -551,7 +551,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl private static native boolean setPointerVisible0(long windowHandle, boolean hasFocus, boolean visible); private static native boolean confinePointer0(long windowHandle, boolean confine); private static native void warpPointer0(long windowHandle, int x, int y); - + // Window styles private static final int NSBorderlessWindowMask = 0; private static final int NSTitledWindowMask = 1 << 0; @@ -567,5 +567,5 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl private volatile long surfaceHandle = 0; private long sscSurfaceHandle = 0; private boolean isOffscreenInstance = false; - + } diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index 595d5e952..d3c7416cc 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.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. - * + * */ package jogamp.newt.driver.windows; @@ -52,10 +52,10 @@ public class DisplayDriver extends DisplayImpl { NEWTJNILibLoader.loadNEWT(); sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0()); - + if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) { throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs"); - } + } } public static void initSingleton() { @@ -76,7 +76,7 @@ public class DisplayDriver extends DisplayImpl { aDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { sharedClassFactory.releaseSharedClass(); aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java index 621091320..e789b995f 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.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. - * + * */ package jogamp.newt.driver.windows; @@ -60,7 +60,7 @@ public class ScreenDriver extends ScreenImpl { protected void createNativeImpl() { aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx); } - + @Override protected void closeNativeImpl() { } @@ -71,7 +71,7 @@ public class ScreenDriver extends ScreenImpl { private final String getActiveMonitorName(String adapterName, int monitor_idx) { return getActiveMonitorName0(adapterName, monitor_idx); } - + private final MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, String adapterName, int crtModeIdx) { if( null == adapterName ) { return null; @@ -107,7 +107,7 @@ public class ScreenDriver extends ScreenImpl { final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx); // merge monitor-props + supported modes MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0); - + // next monitor, 1st mode supportedModes= new ArrayHashSet<MonitorMode>(); } @@ -116,7 +116,7 @@ public class ScreenDriver extends ScreenImpl { adapterName = getAdapterName(crtIdx); } } - + @Override protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) { final String adapterName = getAdapterName(monitor.getId()); @@ -135,7 +135,7 @@ public class ScreenDriver extends ScreenImpl { protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { return getMonitorModeImpl(null, getAdapterName(monitor.getId()), -1); } - + @Override protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) { return setMonitorMode0(monitor.getId(), @@ -150,14 +150,14 @@ public class ScreenDriver extends ScreenImpl { @Override protected int validateScreenIndex(int idx) { - return 0; // big-desktop w/ multiple monitor attached, only one screen available + return 0; // big-desktop w/ multiple monitor attached, only one screen available } - + @Override protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) { vOriginSize.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0()); } - + // Native calls private native int getVirtualOriginX0(); private native int getVirtualOriginY0(); diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index b2e175415..30405aa05 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.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. - * + * */ package jogamp.newt.driver.windows; @@ -74,26 +74,26 @@ public class WindowDriver extends WindowImpl { } final long hWnd = getWindowHandle(); hdc = GDI.GetDC(hWnd); - + // return ( 0 == hdc ) ? LOCK_SURFACE_NOT_READY : ( hdc_old != hdc ) ? LOCK_SURFACE_CHANGED : LOCK_SUCCESS ; - if( 0 == hdc ) { + if( 0 == hdc ) { return LOCK_SURFACE_NOT_READY; - } + } hmon = MonitorFromWindow0(hWnd); - + // Let's not trigger on HDC change, GLDrawableImpl.'s destroy/create is a nop here anyways. // FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine! - return LOCK_SUCCESS; - + return LOCK_SUCCESS; + /** if( hdc_old == hdc ) { return LOCK_SUCCESS; } - if(DEBUG_IMPLEMENTATION) { + if(DEBUG_IMPLEMENTATION) { System.err.println("WindowsWindow: surface change "+toHexString(hdc_old)+" -> "+toHexString(hdc)); // Thread.dumpStack(); } - return LOCK_SURFACE_CHANGED; */ + return LOCK_SURFACE_CHANGED; */ } @Override @@ -137,24 +137,24 @@ public class WindowDriver extends WindowImpl { } setGraphicsConfiguration(cfg); final VersionNumber winVer = Platform.getOSVersionNumber(); - final int flags = getReconfigureFlags(0, true) & + final int flags = getReconfigureFlags(0, true) & ( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ; final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(), winVer.getMajor(), winVer.getMinor(), - getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags); + getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags); if ( 0 == _windowHandle ) { throw new NativeWindowException("Error creating window"); } setWindowHandle(_windowHandle); windowHandleClose = _windowHandle; - + if(DEBUG_IMPLEMENTATION) { Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+ " (Parent HWND "+toHexString(getParentWindowHandle())+ ") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread()); e.printStackTrace(); } - } + } protected void closeNativeImpl() { if(windowHandleClose != 0) { @@ -162,7 +162,7 @@ public class WindowDriver extends WindowImpl { try { GDI.ReleaseDC(windowHandleClose, hdc); } catch (Throwable t) { - if(DEBUG_IMPLEMENTATION) { + if(DEBUG_IMPLEMENTATION) { Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } @@ -188,14 +188,14 @@ public class WindowDriver extends WindowImpl { System.err.println("WindowsWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ getReconfigureFlagsAsString(null, flags)); } - + if(0 == ( FLAG_IS_UNDECORATED & flags)) { final InsetsImmutable i = getInsets(); - + // client position -> top-level window position x -= i.getLeftWidth() ; y -= i.getTopHeight() ; - + if(0<width && 0<height) { // client size -> top-level window size width += i.getTotalWidth(); @@ -203,9 +203,9 @@ public class WindowDriver extends WindowImpl { } } reconfigureWindow0( getParentWindowHandle(), getWindowHandle(), x, y, width, height, flags); - + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { - visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); + visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); } return true; } @@ -222,7 +222,7 @@ public class WindowDriver extends WindowImpl { @Override protected boolean setPointerVisibleImpl(final boolean pointerVisible) { final boolean[] res = new boolean[] { false }; - + this.runOnEDTIfAvail(true, new Runnable() { public void run() { res[0] = setPointerVisible0(getWindowHandle(), pointerVisible); @@ -234,19 +234,19 @@ public class WindowDriver extends WindowImpl { @Override protected boolean confinePointerImpl(final boolean confine) { final Boolean[] res = new Boolean[] { Boolean.FALSE }; - + this.runOnEDTIfAvail(true, new Runnable() { public void run() { final Point p0 = getLocationOnScreenImpl(0, 0); - res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine, + res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine, p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight())); } }); return res[0].booleanValue(); } - + @Override - protected void warpPointerImpl(final int x, final int y) { + protected void warpPointerImpl(final int x, final int y) { this.runOnEDTIfAvail(true, new Runnable() { public void run() { final Point sPos = getLocationOnScreenImpl(x, y); @@ -255,44 +255,44 @@ public class WindowDriver extends WindowImpl { }); return; } - + protected Point getLocationOnScreenImpl(int x, int y) { return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y); } protected void updateInsetsImpl(Insets insets) { - // nop - using event driven insetsChange(..) + // nop - using event driven insetsChange(..) } - + // // PointerEvent Handling // /** * Send multiple-pointer {@link MouseEvent.PointerType#TouchScreen} event to be directly consumed * <p> - * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler. + * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler. * </p> * <p> * See {@link #doPointerEvent(boolean, boolean, PointerType[], short, int, int, boolean, int[], int[], int[], float[], float, float[], float)} * for details. * </p> */ - public final void sendTouchScreenEvent(short eventType, int modifiers, + public final void sendTouchScreenEvent(short eventType, int modifiers, int pActionIdx, int[] pNames, int[] pX, int[] pY, float[] pPressure, float maxPressure) { final int pCount = pNames.length; final MouseEvent.PointerType[] pTypes = new MouseEvent.PointerType[pCount]; for(int i=pCount-1; i>=0; i--) { pTypes[i] = PointerType.TouchScreen; } - doPointerEvent(false /*enqueue*/, false /*wait*/, - pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames, + doPointerEvent(false /*enqueue*/, false /*wait*/, + pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames, pX, pY, pPressure, maxPressure, new float[] { 0f, 0f, 0f} /*rotationXYZ*/, 1f/*rotationScale*/); } - + // // KeyEvent Handling // private short repeatedKey = KeyEvent.VK_UNDEFINED; - + private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) { if( setKeyPressed(keyCode, true) ) { // AR: Key was already pressed: Either [enter | within] AR mode @@ -308,18 +308,18 @@ public class WindowDriver extends WindowImpl { super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar); } return true; - } + } return false; } - + @Override public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { final boolean isModifierKey = KeyEvent.isModifierKey(keySym); // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+ // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode, false)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis()); - + // Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0) and RELEASED (t1) - // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0). + // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0). switch(eventType) { case KeyEvent.EVENT_KEY_RELEASED: if( isKeyCodeTracked(keyCode) ) { @@ -339,12 +339,12 @@ public class WindowDriver extends WindowImpl { break; } } - + @Override public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } - + //---------------------------------------------------------------------- // Internals only // @@ -361,5 +361,5 @@ public class WindowDriver extends WindowImpl { private static native boolean setPointerVisible0(long windowHandle, boolean visible); private static native boolean confinePointer0(long windowHandle, boolean grab, int l, int t, int r, int b); - private static native void warpPointer0(long windowHandle, int x, int y); + private static native void warpPointer0(long windowHandle, int x, int y); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index d911483b0..aa8067520 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.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. - * + * */ package jogamp.newt.driver.x11; @@ -83,7 +83,7 @@ public class DisplayDriver extends DisplayImpl { CompleteDisplay0(aDevice.getHandle()); } catch(RuntimeException e) { closeNativeImpl(aDevice); - throw e; + throw e; } } @@ -114,14 +114,14 @@ public class DisplayDriver extends DisplayImpl { protected long getJavaObjectAtom() { return javaObjectAtom; } protected long getWindowDeleteAtom() { return windowDeleteAtom; } // protected long getKbdHandle() { return kbdHandle; } // XKB disabled for now - - /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */ + + /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */ protected Boolean isXineramaEnabled() { return isNativeValid() ? Boolean.valueOf(((X11GraphicsDevice)aDevice).isXineramaEnabled()) : null; } - + //---------------------------------------------------------------------- // Internals only // - + private static native boolean initIDs0(boolean debug); private native void CompleteDisplay0(long handle); @@ -137,10 +137,10 @@ public class DisplayDriver extends DisplayImpl { /** X11 Window delete atom marker used on EDT */ private long windowDeleteAtom; - + /** X11 Window java object property used on EDT */ - private long javaObjectAtom; - + private long javaObjectAtom; + /** X11 Keyboard handle used on EDT */ // private long kbdHandle; // XKB disabled for now } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java index e39a6c63a..8b065d1f0 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java @@ -38,18 +38,18 @@ import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; public interface RandR { - public static final VersionNumber version110 = new VersionNumber(1, 1, 0); + public static final VersionNumber version110 = new VersionNumber(1, 1, 0); public static final VersionNumber version130 = new VersionNumber(1, 3, 0); public static final VersionNumber version140 = new VersionNumber(1, 4, 0); VersionNumber getVersion(); - + void dumpInfo(final long dpy, final int screen_idx); - + /** - * Encapsulate initial device query allowing caching of internal data structures. + * Encapsulate initial device query allowing caching of internal data structures. * Methods covered: - * <ul> + * <ul> * <li>{@link #getMonitorDeviceCount(long, ScreenDriver)}</li> * <li>{@link #getAvailableRotations(long, ScreenDriver, int)}</li> * <li>{@link #getMonitorModeProps(long, ScreenDriver, int)}</li> @@ -57,7 +57,7 @@ public interface RandR { * <li>{@link #getMonitorDeviceProps(long, ScreenDriver, List, int, MonitorMode)}</li> * </ul> * <p> - * Above methods may be called w/o begin/end, in which case no + * Above methods may be called w/o begin/end, in which case no * internal data structures can be cached: * </p> * @param dpy TODO @@ -66,11 +66,11 @@ public interface RandR { */ boolean beginInitialQuery(long dpy, ScreenDriver screen); void endInitialQuery(long dpy, ScreenDriver screen); - + int getMonitorDeviceCount(final long dpy, final ScreenDriver screen); int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx); /** - * + * * @param dpy * @param screen * @param mode_idx w/o indexing rotation @@ -80,7 +80,7 @@ public interface RandR { int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx); int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx); int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx); - boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode); - - public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport); + boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode); + + public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java index 877607f72..6c22a3fc6 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java @@ -38,8 +38,8 @@ import com.jogamp.newt.MonitorMode; class RandR11 implements RandR { private static final boolean DEBUG = ScreenDriver.DEBUG; - - RandR11() { + + RandR11() { } @Override @@ -51,13 +51,13 @@ class RandR11 implements RandR { public void dumpInfo(final long dpy, final int screen_idx) { // NOP } - + private int widthMM=0, heightMM=0; private int modeCount = 0; private int resolutionCount = 0; private int[][] nrates = null; // [nres_number][nrate_number] private int[] idx_rate = null, idx_res = null; - + @Override public boolean beginInitialQuery(long dpy, ScreenDriver screen) { // initialize iterators and static data @@ -76,11 +76,11 @@ class RandR11 implements RandR { return false; } } - + for(int nresIdx=0; nresIdx < resolutionCount; nresIdx++) { modeCount += nrates[nresIdx].length; } - + idx_rate = new int[modeCount]; idx_res = new int[modeCount]; @@ -94,23 +94,23 @@ class RandR11 implements RandR { } return true; } - + @Override public void endInitialQuery(long dpy, ScreenDriver screen) { idx_rate=null; - idx_res=null; - nrates=null; + idx_res=null; + nrates=null; } - + @Override public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) { return 1; } - + @Override public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) { if( 0 < crt_idx ) { - // RandR11 only supports 1 CRT + // RandR11 only supports 1 CRT return null; } final int screen_idx = screen.getIndex(); @@ -120,17 +120,17 @@ class RandR11 implements RandR { } return availRotations; } - + @Override public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) { if( mode_idx >= modeCount ) { return null; - } + } final int screen_idx = screen.getIndex(); - + final int nres_index = idx_res[mode_idx]; final int nrate_index = idx_rate[mode_idx]; - + final int[] res = getScreenResolution0(dpy, screen_idx, nres_index); if(null==res || 0==res.length) { return null; @@ -144,7 +144,7 @@ class RandR11 implements RandR { if( res[3] > heightMM ) { heightMM = res[3]; } - + int rate = nrates[nres_index][nrate_index]; if(0>=rate) { rate = ScreenImpl.default_sm_rate; @@ -166,13 +166,13 @@ class RandR11 implements RandR { if( MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL != i ) { throw new InternalError("XX"); } - return props; + return props; } - + @Override public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, final MonitorModeProps.Cache cache, final int crt_idx) { if( 0 < crt_idx ) { - // RandR11 only supports 1 CRT + // RandR11 only supports 1 CRT return null; } final int[] currentModeProps = getCurrentMonitorModeProps(dpy, screen, crt_idx); @@ -194,15 +194,15 @@ class RandR11 implements RandR { props[i++] = currentMode.getId(); // current mode id props[i++] = currentMode.getRotation(); for(int j=0; j<allModesCount; j++) { - props[i++] = cache.monitorModes.get(j).getId(); + props[i++] = cache.monitorModes.get(j).getId(); } return props; } - + @Override public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) { if( 0 < crt_idx ) { - // RandR11 only supports 1 CRT + // RandR11 only supports 1 CRT return null; } final int screen_idx = screen.getIndex(); @@ -212,7 +212,7 @@ class RandR11 implements RandR { } int[] res; final int nres_idx; - try { + try { int resNumber = getNumScreenResolutions0(dpy, screen_idx); if(0==resNumber) { return null; @@ -241,13 +241,13 @@ class RandR11 implements RandR { props[i++] = 0; props[i++] = res[0]; // width props[i++] = res[1]; // height - return props; + return props; } - + @Override public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) { if( 0 < crt_idx ) { - // RandR11 only supports 1 CRT + // RandR11 only supports 1 CRT return null; } final int screen_idx = screen.getIndex(); @@ -258,7 +258,7 @@ class RandR11 implements RandR { int[] res; int rate, rot; final int nres_idx; - try { + try { int resNumber = getNumScreenResolutions0(dpy, screen_idx); if(0==resNumber) { return null; @@ -318,7 +318,7 @@ class RandR11 implements RandR { final int resId = mode.getId(); if(0>resId || resId>=resolutionCount) { throw new RuntimeException("Invalid resolution index: ! 0 < "+resId+" < "+resolutionCount+", "+monitor+", "+mode); - } + } final int f = (int)mode.getRefreshRate(); // simply cut-off, orig is int final int r = mode.getRotation(); @@ -335,11 +335,11 @@ class RandR11 implements RandR { } return done; } - + @Override public final void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport) { // nop - } + } /** @return int[] { rot1, .. } */ private static native int[] getAvailableScreenRotations0(long display, int screen_index); @@ -353,7 +353,7 @@ class RandR11 implements RandR { private static native long getScreenConfiguration0(long display, int screen_index); private static native void freeScreenConfiguration0(long screenConfiguration); - + private static native int getCurrentScreenResolutionIndex0(long screenConfiguration); private static native int getCurrentScreenRate0(long screenConfiguration); private static native int getCurrentScreenRotation0(long screenConfiguration); @@ -361,5 +361,5 @@ class RandR11 implements RandR { /** needs own Display connection for XRANDR event handling */ private static native boolean setCurrentScreenModeStart0(long display, int screen_index, long screenConfiguration, int mode_index, int freq, int rot); private static native boolean setCurrentScreenModePollEnd0(long display, int screen_index, int mode_index, int freq, int rot); - + } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java index ac83fc5f2..a08741d9e 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java @@ -43,19 +43,19 @@ import com.jogamp.newt.MonitorMode; * <pre> * MonitorMode.id == XRR mode-id (not index) * MonitorDevice.id == XRR monitor-idx (not id) - * </pre> + * </pre> */ class RandR13 implements RandR { private static final boolean DEBUG = ScreenDriver.DEBUG; - - RandR13() { + + RandR13() { } - + @Override public final VersionNumber getVersion() { return version130; } - + @Override public void dumpInfo(final long dpy, final int screen_idx) { long screenResources = getScreenResources0(dpy, screen_idx); @@ -66,12 +66,12 @@ class RandR13 implements RandR { dumpInfo0(dpy, screen_idx, screenResources); } finally { freeScreenResources0(screenResources); - } + } } - + long sessionScreenResources = 0; IntLongHashMap crtInfoHandleMap = null; - + @Override public boolean beginInitialQuery(long dpy, ScreenDriver screen) { final int screen_idx = screen.getIndex(); @@ -84,7 +84,7 @@ class RandR13 implements RandR { return false; } } - + @Override public void endInitialQuery(long dpy, ScreenDriver screen) { if( null != crtInfoHandleMap ) { @@ -100,7 +100,7 @@ class RandR13 implements RandR { sessionScreenResources = 0; } } - + private final long getScreenResourceHandle(final long dpy, final int screen_idx) { if( 0 != sessionScreenResources ) { return sessionScreenResources; @@ -112,7 +112,7 @@ class RandR13 implements RandR { freeScreenResources0( screenResourceHandle ); } } - + private final long getMonitorInfoHandle(final long dpy, final int screen_idx, long screenResources, final int monitor_idx) { if( null != crtInfoHandleMap ) { long h = crtInfoHandleMap.get(monitor_idx); @@ -129,8 +129,8 @@ class RandR13 implements RandR { if( null == crtInfoHandleMap ) { freeMonitorInfoHandle0(monitorInfoHandle); } - } - + } + @Override public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) { final int screen_idx = screen.getIndex(); @@ -141,7 +141,7 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) { final int screen_idx = screen.getIndex(); @@ -152,7 +152,7 @@ class RandR13 implements RandR { final int[] availRotations = getAvailableRotations0(monitorInfo); if(null==availRotations || 0==availRotations.length) { return null; - } + } return availRotations; } finally { releaseMonitorInfoHandle(monitorInfo); @@ -161,7 +161,7 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) { final int screen_idx = screen.getIndex(); @@ -172,7 +172,7 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx) { final int screen_idx = screen.getIndex(); @@ -188,9 +188,9 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override - public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) { + public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) { final int screen_idx = screen.getIndex(); final long screenResources = getScreenResourceHandle(dpy, screen_idx); try { @@ -204,7 +204,7 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) { final int screen_idx = screen.getIndex(); @@ -220,7 +220,7 @@ class RandR13 implements RandR { releaseScreenResourceHandle(screenResources); } } - + @Override public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) { final int screen_idx = screen.getIndex(); @@ -229,7 +229,7 @@ class RandR13 implements RandR { try { final long monitorInfo = getMonitorInfoHandle(dpy, screen_idx, screenResources, monitor.getId()); try { - res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(), + res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(), -1, -1); // no fixed position! } finally { releaseMonitorInfoHandle(monitorInfo); @@ -239,36 +239,36 @@ class RandR13 implements RandR { } return res; } - + @Override public final void updateScreenViewport(final long dpy, final ScreenDriver screen, final RectangleImmutable viewport) { final int screen_idx = screen.getIndex(); final long screenResources = getScreenResourceHandle(dpy, screen_idx); try { - setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight()); + setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight()); } finally { dumpInfo0(dpy, screen_idx, screenResources); releaseScreenResourceHandle(screenResources); } } - + private static native long getScreenResources0(long display, int screen_index); private static native void freeScreenResources0(long screenResources); private static native void dumpInfo0(long display, int screen_index, long screenResources); - + private static native int getMonitorDeviceCount0(long screenResources); - + private static native long getMonitorInfoHandle0(long display, int screen_index, long screenResources, int monitor_index); private static native void freeMonitorInfoHandle0(long monitorInfoHandle); - + private static native int[] getAvailableRotations0(long monitorInfo); private static native int[] getMonitorViewport0(long monitorInfo); private static native int[] getMonitorCurrentMode0(long monitorInfo); - + private static native int[] getMonitorMode0(long screenResources, int mode_index); private static native int[] getMonitorCurrentMode0(long screenResources, long monitorInfo); private static native int[] getMonitorDevice0(long display, long screenResources, long monitorInfo, int monitor_idx); - + private static native boolean setMonitorMode0(long display, long screenResources, long monitorInfo, int monitor_idx, int mode_id, int rotation, int x, int y); private static native boolean setScreenViewport0(long display, int screen_index, long screenResources, int x, int y, int width, int height); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index c01d899f8..7f75e03f0 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.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. - * + * */ package jogamp.newt.driver.x11; @@ -54,19 +54,19 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; -public class ScreenDriver extends ScreenImpl { +public class ScreenDriver extends ScreenImpl { protected static final boolean DEBUG_TEST_RANDR13_DISABLED; - + static { Debug.initSingleton(); DEBUG_TEST_RANDR13_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableRandR13", true); - + DisplayDriver.initSingleton(); } /** Ensure static init has been run. */ /* pp */static void initSingleton() { } - + public ScreenDriver() { } @@ -74,14 +74,14 @@ public class ScreenDriver extends ScreenImpl { protected void createNativeImpl() { // validate screen index Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Long>() { - public Long run(long dpy) { + public Long run(long dpy) { return new Long(GetScreen0(dpy, screen_idx)); } } ); if (handle.longValue() == 0) { throw new RuntimeException("Error creating screen: " + screen_idx); } - final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice(); - final long dpy = x11dev.getHandle(); + final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice(); + final long dpy = x11dev.getHandle(); aScreen = new X11GraphicsScreen(x11dev, screen_idx); { int v[] = getRandRVersion0(dpy); @@ -118,7 +118,7 @@ public class ScreenDriver extends ScreenImpl { if( rAndR.beginInitialQuery(device.getHandle(), this) ) { try { final int crtCount = rAndR.getMonitorDeviceCount(device.getHandle(), this); - + // Gather all available rotations final ArrayHashSet<Integer> availableRotations = new ArrayHashSet<Integer>(); for(int i = 0; i < crtCount; i++) { @@ -129,7 +129,7 @@ public class ScreenDriver extends ScreenImpl { availableRotations.addAll(rotationList); } } - + // collect all modes, while injecting all available rotations { int modeIdx = 0; @@ -147,8 +147,8 @@ public class ScreenDriver extends ScreenImpl { if( cache.monitorModes.size() > 0 ) { for(int i = 0; i < crtCount; i++) { final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, i); - if( null != monitorProps && - MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ? + if( null != monitorProps && + MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ? MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) { MonitorModeProps.streamInMonitorDevice(null, cache, this, monitorProps, 0); } @@ -174,11 +174,11 @@ public class ScreenDriver extends ScreenImpl { device.unlock(); } } - + @Override protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) { if( null == rAndR ) { return null; } - + return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<MonitorMode>() { public MonitorMode run(long dpy) { final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId()); @@ -189,14 +189,14 @@ public class ScreenDriver extends ScreenImpl { @Override protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { if( null == rAndR ) { return false; } - + final long t0 = System.currentTimeMillis(); boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() { public Boolean run(long dpy) { return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) ); - } + } }).booleanValue(); - + if(DEBUG || !done) { System.err.println("X11Screen.setCurrentMonitorModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+ (System.currentTimeMillis()-t0)+"ms; "+monitor.getCurrentMode()+" -> "+mode); @@ -205,10 +205,10 @@ public class ScreenDriver extends ScreenImpl { } private DisplayImpl.DisplayRunnable<Boolean> xineramaEnabledQueryWithTemp = new DisplayImpl.DisplayRunnable<Boolean>() { - public Boolean run(long dpy) { - return new Boolean(X11Util.XineramaIsEnabled(dpy)); + public Boolean run(long dpy) { + return new Boolean(X11Util.XineramaIsEnabled(dpy)); } }; - + @Override protected int validateScreenIndex(final int idx) { final DisplayDriver x11Display = (DisplayDriver) getDisplay(); @@ -219,7 +219,7 @@ public class ScreenDriver extends ScreenImpl { return runWithTempDisplayHandle( xineramaEnabledQueryWithTemp ).booleanValue() ? 0 : idx; } } - + @Override protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) { final RectangleImmutable ov = (RectangleImmutable) getViewport().cloneMutable(); @@ -244,17 +244,17 @@ public class ScreenDriver extends ScreenImpl { System.err.println("X11Screen.calcVirtualScreenOriginAndSize: Querying X11: "+ov+" -> "+vOriginSize); } } - } - + } + //---------------------------------------------------------------------- // Internals only - // + // private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) { return display.runWithLockedDisplayDevice(action); } - + private final <T> T runWithTempDisplayHandle(DisplayRunnable<T> action) { - final long displayHandle = X11Util.openDisplay(display.getName()); + final long displayHandle = X11Util.openDisplay(display.getName()); if(0 == displayHandle) { throw new RuntimeException("null device"); } @@ -266,7 +266,7 @@ public class ScreenDriver extends ScreenImpl { } return res; } - + private final <T> T runWithOptTempDisplayHandle(DisplayRunnable<T> action) { if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 ) { return display.runWithLockedDisplayDevice(action); @@ -274,12 +274,12 @@ public class ScreenDriver extends ScreenImpl { return runWithTempDisplayHandle(action); } } - + private static native long GetScreen0(long dpy, int scrn_idx); private static native int getWidth0(long display, int scrn_idx); private static native int getHeight0(long display, int scrn_idx); - + private static native int[] getRandRVersion0(long display); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 806dd270c..02f80c0c3 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.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. - * + * */ package jogamp.newt.driver.x11; @@ -57,7 +57,7 @@ public class WindowDriver extends WindowImpl { private static final int X11_WHEEL_ONE_DOWN_BUTTON = 5; private static final int X11_WHEEL_TWO_UP_BUTTON = 6; private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7; - + static { ScreenDriver.initSingleton(); } @@ -70,21 +70,21 @@ public class WindowDriver extends WindowImpl { final ScreenDriver screen = (ScreenDriver) getScreen(); final DisplayDriver display = (DisplayDriver) screen.getDisplay(); final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice(); - - // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering + + // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection()); if( 0 == renderDeviceHandle ) { throw new RuntimeException("Error creating display(GfxCfg/Render): "+edtDevice.getConnection()); } renderDevice = new X11GraphicsDevice(renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex()); - + final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested); final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration( capsRequested, capsRequested, capabilitiesChooser, renderScreen, VisualIDHolder.VID_UNDEFINED); if(DEBUG_IMPLEMENTATION) { System.err.println("X11Window.createNativeImpl() factory: "+factory+", chosen config: "+cfg); - } + } if (null == cfg) { throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } @@ -93,13 +93,13 @@ public class WindowDriver extends WindowImpl { throw new NativeWindowException("Chosen Configuration w/o native visual ID: "+cfg); } setGraphicsConfiguration(cfg); - final int flags = getReconfigureFlags(0, true) & + final int flags = getReconfigureFlags(0, true) & ( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ; edtDevice.lock(); - try { + try { setWindowHandle(CreateWindow0(getParentWindowHandle(), - edtDevice.getHandle(), screen.getIndex(), visualID, - display.getJavaObjectAtom(), display.getWindowDeleteAtom(), + edtDevice.getHandle(), screen.getIndex(), visualID, + display.getJavaObjectAtom(), display.getWindowDeleteAtom(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags)); } finally { edtDevice.unlock(); @@ -117,10 +117,10 @@ public class WindowDriver extends WindowImpl { final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice(); edtDevice.lock(); try { - CloseWindow0(edtDevice.getHandle(), windowHandleClose, + CloseWindow0(edtDevice.getHandle(), windowHandleClose, display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now } catch (Throwable t) { - if(DEBUG_IMPLEMENTATION) { + if(DEBUG_IMPLEMENTATION) { Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } @@ -135,7 +135,7 @@ public class WindowDriver extends WindowImpl { } } - /** + /** * <p> * X11 Window supports {@link #FLAG_IS_FULLSCREEN_SPAN} * </p> @@ -145,7 +145,7 @@ public class WindowDriver extends WindowImpl { protected boolean isReconfigureFlagSupported(int changeFlags) { return true; // all flags! } - + @Override protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) { if(DEBUG_IMPLEMENTATION) { @@ -153,8 +153,8 @@ public class WindowDriver extends WindowImpl { } final int _x, _y; if(0 == ( FLAG_IS_UNDECORATED & flags)) { - final InsetsImmutable i = getInsets(); - + final InsetsImmutable i = getInsets(); + // client position -> top-level window position _x = x - i.getLeftWidth() ; _y = y - i.getTopHeight() ; @@ -177,7 +177,7 @@ public class WindowDriver extends WindowImpl { final DisplayDriver display = (DisplayDriver) getScreen().getDisplay(); runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { public Object run(long dpy) { - reconfigureWindow0( dpy, getScreenIndex(), + reconfigureWindow0( dpy, getScreenIndex(), getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(), _x, _y, width, height, fflags); return null; @@ -205,23 +205,23 @@ public class WindowDriver extends WindowImpl { public Object run(long dpy) { reconfigureWindow0( dpy, getScreenIndex(), getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(), - getX(), getY(), getWidth(), getHeight(), flags); + getX(), getY(), getWidth(), getHeight(), flags); return null; } }); } super.focusChanged(defer, focusGained); } - + protected void reparentNotify(long newParentWindowHandle) { if(DEBUG_IMPLEMENTATION) { final long p0 = getParentWindowHandle(); System.err.println("Window.reparentNotify ("+getThreadName()+"): "+toHexString(p0)+" -> "+toHexString(newParentWindowHandle)); } } - + @Override - protected void requestFocusImpl(final boolean force) { + protected void requestFocusImpl(final boolean force) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { public Object run(long dpy) { requestFocus0(dpy, getWindowHandle(), force); @@ -239,7 +239,7 @@ public class WindowDriver extends WindowImpl { } }); } - + @Override protected boolean setPointerVisibleImpl(final boolean pointerVisible) { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() { @@ -257,7 +257,7 @@ public class WindowDriver extends WindowImpl { } }).booleanValue(); } - + @Override protected void warpPointerImpl(final int x, final int y) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @@ -267,7 +267,7 @@ public class WindowDriver extends WindowImpl { } }); } - + @Override protected Point getLocationOnScreenImpl(final int x, final int y) { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Point>() { @@ -279,9 +279,9 @@ public class WindowDriver extends WindowImpl { @Override protected void updateInsetsImpl(Insets insets) { - // nop - using event driven insetsChange(..) + // nop - using event driven insetsChange(..) } - + @Override protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers, int x, int y, short button, float[] rotationXYZ, float rotationScale) { @@ -321,34 +321,34 @@ public class WindowDriver extends WindowImpl { rotationXYZ[0] = -1; modifiers |= InputEvent.SHIFT_MASK; break; - } + } break; } super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale); } - + /** Called by native TK */ protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) { // handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar); final boolean isModifierKey = KeyEvent.isModifierKey(keyCode); final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers ); - final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0; + final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0; // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+ // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis()); - + if( !isAutoRepeat || !isModifierKey ) { // ! ( isModifierKey && isAutoRepeat ) switch(eventType) { case KeyEvent.EVENT_KEY_PRESSED: super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar); break; - + case KeyEvent.EVENT_KEY_RELEASED: super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar); break; } } } - + @Override public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); @@ -357,33 +357,33 @@ public class WindowDriver extends WindowImpl { public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } - + //---------------------------------------------------------------------- // Internals only // private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI - + private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) { return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action); } protected static native boolean initIDs0(); - - private native long CreateWindow0(long parentWindowHandle, long display, int screen_index, - int visualID, long javaObjectAtom, long windowDeleteAtom, - int x, int y, int width, int height, boolean autoPosition, int flags); + + private native long CreateWindow0(long parentWindowHandle, long display, int screen_index, + int visualID, long javaObjectAtom, long windowDeleteAtom, + int x, int y, int width, int height, boolean autoPosition, int flags); private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle*/ ); // XKB disabled for now private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle, - long windowDeleteAtom, int x, int y, int width, int height, int flags); + long windowDeleteAtom, int x, int y, int width, int height, int flags); private native void requestFocus0(long display, long windowHandle, boolean force); - + private static native void setTitle0(long display, long windowHandle, String title); private static native long getParentWindow0(long display, long windowHandle); private static native boolean setPointerVisible0(long display, long windowHandle, boolean visible); private static native boolean confinePointer0(long display, long windowHandle, boolean grab); private static native void warpPointer0(long display, long windowHandle, int x, int y); - + private long windowHandleClose; private X11GraphicsDevice renderDevice; } diff --git a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java index 93d5e2fb9..38a434279 100644 --- a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java +++ b/src/newt/classes/jogamp/newt/event/NEWTEventTask.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.newt.event; import com.jogamp.newt.event.NEWTEvent; diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java index 6024195e3..08eacdee5 100644 --- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java @@ -40,16 +40,16 @@ import com.jogamp.newt.util.EDTUtil; */ public class SWTEDTUtil implements EDTUtil { public static final boolean DEBUG = Debug.debug("EDT"); - + private final Object edtLock = new Object(); // locking the EDT start/stop state - private final ThreadGroup threadGroup; + private final ThreadGroup threadGroup; private final String name; private final Runnable dispatchMessages; private final org.eclipse.swt.widgets.Display swtDisplay; private NEDT nedt = null; private int start_iter=0; private static long pollPeriod = EDTUtil.defaultEDTPollPeriod; - + public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay) { this.threadGroup = Thread.currentThread().getThreadGroup(); this.name=Thread.currentThread().getName()+"-SWTDisplay-"+newtDisplay.getFQName()+"-EDT-"; @@ -61,11 +61,11 @@ public class SWTEDTUtil implements EDTUtil { this.nedt = new NEDT(threadGroup, name); this.nedt.setDaemon(true); // don't stop JVM from shutdown .. } - + public final org.eclipse.swt.widgets.Display getDisplay() { return swtDisplay; } - + @Override public long getPollPeriod() { return pollPeriod; @@ -116,7 +116,7 @@ public class SWTEDTUtil implements EDTUtil { } nedt.start(); } - + @Override public boolean isCurrentThreadEDT() { return !swtDisplay.isDisposed() && swtDisplay.getThread() == Thread.currentThread(); @@ -126,18 +126,18 @@ public class SWTEDTUtil implements EDTUtil { public final boolean isCurrentThreadNEDT() { return nedt == Thread.currentThread(); } - + @Override public final boolean isCurrentThreadEDTorNEDT() { final Thread ct = Thread.currentThread(); return ( !swtDisplay.isDisposed() && ct == swtDisplay.getThread() ) || ct == nedt ; } - + @Override public boolean isRunning() { return nedt.isRunning(); } - + @Override public final boolean invokeStop(boolean wait, Runnable task) { return invokeImpl(wait, task, true); @@ -147,12 +147,12 @@ public class SWTEDTUtil implements EDTUtil { public final boolean invoke(boolean wait, Runnable task) { return invokeImpl(wait, task, false); } - + private static Runnable nullTask = new Runnable() { @Override - public void run() { } + public void run() { } }; - + private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) { Throwable throwable = null; RunnableTask rTask = null; @@ -165,12 +165,12 @@ public class SWTEDTUtil implements EDTUtil { System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop); Thread.dumpStack(); } - return false; + return false; } if( swtDisplay.isDisposed() ) { stop = true; } - + if( isCurrentThreadEDT() ) { if(null != task) { task.run(); @@ -179,7 +179,7 @@ public class SWTEDTUtil implements EDTUtil { if( stop ) { nedt.shouldStop = true; } - } else { + } else { if( !nedt.isRunning && !swtDisplay.isDisposed() ) { if( null != task ) { if( stop ) { @@ -210,11 +210,11 @@ public class SWTEDTUtil implements EDTUtil { return false; } } - + if( null != task ) { rTask = new RunnableTask(task, wait ? rTaskLock : null, - true /* always catch and report Exceptions, don't disturb EDT */, + true /* always catch and report Exceptions, don't disturb EDT */, wait ? null : System.err); swtDisplay.asyncExec(rTask); } @@ -238,7 +238,7 @@ public class SWTEDTUtil implements EDTUtil { } return true; } - } + } @Override final public boolean waitUntilIdle() { @@ -278,7 +278,7 @@ public class SWTEDTUtil implements EDTUtil { } } } - + class NEDT extends Thread { volatile boolean shouldStop = false; volatile boolean isRunning = false; @@ -298,7 +298,7 @@ public class SWTEDTUtil implements EDTUtil { super.start(); } - /** + /** * Utilizing locking only on tasks and its execution, * not for event dispatching. */ @@ -315,7 +315,7 @@ public class SWTEDTUtil implements EDTUtil { // EDT invoke thread is SWT-EDT, // hence dispatching is required to run on SWT-EDT as well. // Otherwise a deadlock may happen due to dispatched event's - // triggering a locking action. + // triggering a locking action. if ( !swtDisplay.isDisposed() ) { swtDisplay.syncExec(dispatchMessages); } else { @@ -343,7 +343,7 @@ public class SWTEDTUtil implements EDTUtil { } } finally { if(DEBUG) { - System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error); + System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error); } synchronized(edtLock) { isRunning = false; @@ -358,5 +358,5 @@ public class SWTEDTUtil implements EDTUtil { } // finally } // run() } // EventDispatchThread - + } diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java index 3782a1186..b5c45c1aa 100644 --- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.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.newt.swt.event; import org.eclipse.swt.SWT; @@ -206,7 +206,7 @@ public class SWTNewtEventFactory { } return res; } - + public static final com.jogamp.newt.event.MouseEvent createMouseEvent(org.eclipse.swt.widgets.Event event, Object source) { switch(event.type) { case SWT.MouseDown: @@ -229,7 +229,7 @@ public class SWTNewtEventFactory { } int mods = swtModifiers2Newt(event.stateMask, true); - + if( source instanceof com.jogamp.newt.Window) { final com.jogamp.newt.Window newtSource = (com.jogamp.newt.Window)source; if(newtSource.isPointerConfined()) { @@ -239,7 +239,7 @@ public class SWTNewtEventFactory { mods |= InputEvent.INVISIBLE_MASK; } } - + return new com.jogamp.newt.event.MouseEvent( type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time), mods, event.x, event.y, (short)event.count, (short)event.button, MouseEvent.getRotationXYZ(rotation, mods), 1f); @@ -260,32 +260,32 @@ public class SWTNewtEventFactory { final short newtKeyCode = swtKeyCode2NewtKeyCode( event.keyCode ); return com.jogamp.newt.event.KeyEvent.create( type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time), - swtModifiers2Newt(event.stateMask, false), + swtModifiers2Newt(event.stateMask, false), newtKeyCode, newtKeyCode, event.character); } return null; // no mapping .. } - + // // // - + short dragButtonDown = 0; - + public SWTNewtEventFactory() { resetButtonsDown(); } - + final void resetButtonsDown() { dragButtonDown = 0; } - + public final boolean dispatchMouseEvent(org.eclipse.swt.widgets.Event event, Object source, com.jogamp.newt.event.MouseListener l) { com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, source); if(null != res) { if(null != l) { switch(event.type) { - case SWT.MouseDown: + case SWT.MouseDown: dragButtonDown = (short) event.button; l.mousePressed(res); break; case SWT.MouseUp: @@ -293,7 +293,7 @@ public class SWTNewtEventFactory { l.mouseReleased(res); { final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent( - com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED, + com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED, res.getSource(), res.getWhen(), res.getModifiers(), res.getX(), res.getY(), res.getClickCount(), @@ -304,7 +304,7 @@ public class SWTNewtEventFactory { case SWT.MouseMove: if( 0 < dragButtonDown ) { final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent( - com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED, + com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED, res.getSource(), res.getWhen(), res.getModifiers(), res.getX(), res.getY(), res.getClickCount(), @@ -315,14 +315,14 @@ public class SWTNewtEventFactory { } break; case SWT.MouseEnter: - l.mouseEntered(res); + l.mouseEntered(res); break; case SWT.MouseExit: resetButtonsDown(); - l.mouseExited(res); + l.mouseExited(res); break; case SWT.MouseVerticalWheel: - l.mouseWheelMoved(res); + l.mouseWheelMoved(res); break; } } @@ -337,7 +337,7 @@ public class SWTNewtEventFactory { if(null != l) { switch(event.type) { case SWT.KeyDown: - l.keyPressed(res); + l.keyPressed(res); break; case SWT.KeyUp: l.keyReleased(res); @@ -347,9 +347,9 @@ public class SWTNewtEventFactory { return true; } return false; - } - - public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source, + } + + public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source, final com.jogamp.newt.event.MouseListener ml, final com.jogamp.newt.event.KeyListener kl) { final Listener listener = new Listener () { |