aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/JoglVersion.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java28
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java45
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java4
8 files changed, 84 insertions, 31 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index d162f2bd8..8cb25174c 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -70,7 +70,7 @@ public class JoglVersion extends JogampVersion {
public static StringBuilder getGLInfo(GL gl, StringBuilder sb) {
AbstractGraphicsDevice device = gl.getContext().getGLDrawable().getNativeSurface()
- .getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+ .getGraphicsConfiguration().getScreen().getDevice();
if(null==sb) {
sb = new StringBuilder();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
index 9e4d76869..ba159b82c 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
@@ -28,12 +28,30 @@
package com.jogamp.opengl.cg;
+import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.DynamicLibraryBundleInfo;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.cache.TempJarCache;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.*;
public class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
private static List<String> glueLibNames;
static {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Platform.initSingleton();
+
+ if(TempJarCache.isInitialized()) {
+ // Cg class and natives are available in their single atomic JAR files only
+ JNILibLoaderBase.addNativeJarLibs(CgDynamicLibraryBundleInfo.class, "jogl_cg", null);
+ }
+ return null;
+ }
+ });
+
glueLibNames = new ArrayList<String>();
// glueLibNames.addAll(getGlueLibNamesPreload());
glueLibNames.add("jogl_cg");
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 93b75e70b..26d299663 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -164,7 +164,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl {
}
};
- public boolean skipWaitForCompletion(Thread thread) {
- return ((Thread.currentThread() == thread) || EventQueue.isDispatchThread());
+ public boolean blockUntilDone(Thread thread) {
+ return ((Thread.currentThread() != thread) && !EventQueue.isDispatchThread());
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 16aac957a..6d508f227 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -59,7 +59,9 @@ import javax.media.opengl.GLAutoDrawable;
*/
public class Animator extends AnimatorBase {
-
+ /** timeout in milliseconds, 15 frames @ 60Hz = 240ms, limiting {@link #finishLifecycleAction(Condition)} */
+ private static final long TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 15*16;
+
protected ThreadGroup threadGroup;
private Runnable runnable;
private boolean runAsFastAsPossible;
@@ -241,18 +243,24 @@ public class Animator extends AnimatorBase {
// dependencies on the Animator's internal thread. Currently we
// use a couple of heuristics to determine whether we should do
// the blocking wait().
- boolean doWait = !impl.skipWaitForCompletion(animThread);
- if (doWait) {
- while (condition.result()) {
- try {
- wait();
- } catch (InterruptedException ie) { }
- }
+ final boolean blocking = impl.blockUntilDone(animThread);
+ long remaining = blocking ? TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION : 0;
+ while (remaining>0 && condition.result()) {
+ long td = System.currentTimeMillis();
+ try {
+ wait(remaining);
+ } catch (InterruptedException ie) { }
+ remaining -= (System.currentTimeMillis() - td) ;
}
if(DEBUG) {
- System.err.println("finishLifecycleAction(" + condition.getClass().getName() + "): finished - waited " + doWait +
+ if(remaining<0) {
+ System.err.println("finishLifecycleAction(" + condition.getClass().getName() + "): ++++++ timeout reached ++++++ " + Thread.currentThread().getName());
+ }
+ System.err.println("finishLifecycleAction(" + condition.getClass().getName() + "): finished "+
+ "- blocking "+blocking+
+ ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
", started: " + isStartedImpl() +", animating: " + isAnimatingImpl() +
- ", paused: " + isPausedImpl() + ", drawables " + drawables.size());
+ ", paused: " + isPausedImpl() + ", drawables " + drawables.size() + " - " + Thread.currentThread().getName());
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index e84a9bf78..d65967da1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -56,7 +56,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public interface AnimatorImpl {
void display(ArrayList<GLAutoDrawable> drawables, boolean ignoreExceptions, boolean printExceptions);
- boolean skipWaitForCompletion(Thread thread);
+ boolean blockUntilDone(Thread thread);
}
protected ArrayList<GLAutoDrawable> drawables = new ArrayList<GLAutoDrawable>();
@@ -92,7 +92,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public synchronized void add(GLAutoDrawable drawable) {
if(DEBUG) {
- System.err.println("Animator add: "+drawable.hashCode()+" - "+Thread.currentThread());
+ System.err.println("Animator add: "+drawable.hashCode()+" - "+Thread.currentThread().getName());
}
boolean paused = pause();
drawables.add(drawable);
@@ -101,7 +101,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if(paused) {
resume();
}
- if(!impl.skipWaitForCompletion(animThread)) {
+ if(impl.blockUntilDone(animThread)) {
while(isStarted() && !isPaused() && !isAnimating()) {
try {
wait();
@@ -113,7 +113,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public synchronized void remove(GLAutoDrawable drawable) {
if(DEBUG) {
- System.err.println("Animator remove: "+drawable.hashCode()+" - "+Thread.currentThread() + ": "+toString());
+ System.err.println("Animator remove: "+drawable.hashCode()+" - "+Thread.currentThread().getName() + ": "+toString());
}
boolean paused = pause();
@@ -123,7 +123,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if(paused) {
resume();
}
- if(!impl.skipWaitForCompletion(animThread)) {
+ if(impl.blockUntilDone(animThread)) {
while(isStarted() && drawablesEmpty && isAnimating()) {
try {
wait();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
index bad268f70..23b0845ee 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
@@ -60,7 +60,7 @@ class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl {
}
}
- public boolean skipWaitForCompletion(Thread thread) {
- return (Thread.currentThread() == thread);
+ public boolean blockUntilDone(Thread thread) {
+ return (Thread.currentThread() != thread);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
index f2e742cda..4ab603576 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -49,9 +49,8 @@ import java.nio.*;
/**
* Utility routines for dealing with direct buffers.
- * @author Kenneth Russel
- * @author Sven Gothel
- * @author Michael Bien
+ *
+ * @author Kenneth Russel, et.al.
*/
public class GLBuffers extends Buffers {
@@ -66,7 +65,8 @@ public class GLBuffers extends Buffers {
* GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
* GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV
* GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
- * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV (25)
+ * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
+ * GL_HILO16_NV, GL_SIGNED_HILO16_NV (27)
* @return -1 if glType is unhandled, otherwise the actual value > 0
*/
public static final int sizeOfGLType(int glType) {
@@ -97,6 +97,8 @@ public class GLBuffers extends Buffers {
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:
@@ -122,7 +124,8 @@ public class GLBuffers extends Buffers {
* GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
* GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV
* GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
- * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV (25)
+ * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
+ * GL_HILO16_NV, GL_SIGNED_HILO16_NV (27)
* @return null if glType is unhandled, otherwise the new Buffer object
*/
public static final Buffer newDirectGLBuffer(int glType, int numElements) {
@@ -153,6 +156,8 @@ public class GLBuffers extends Buffers {
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 newDirectIntBuffer(numElements);
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
@@ -178,7 +183,8 @@ public class GLBuffers extends Buffers {
* GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
* GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV
* GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
- * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV (25)
+ * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
+ * GL_HILO16_NV, GL_SIGNED_HILO16_NV (27)
* @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) {
@@ -215,6 +221,8 @@ public class GLBuffers extends Buffers {
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 parent.asIntBuffer();
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
@@ -360,7 +368,7 @@ public class GLBuffers extends Buffers {
* GL_RGB, GL_BGR, GL_RGBA, GL_BGRA, GL_ABGR_EXT,
* GL_RED_INTEGER, GL_GREEN_INTEGER, GL_BLUE_INTEGER,
* GL_RG_INTEGER, GL_RGB_INTEGER, GL_BGR_INTEGER,
- * GL_RGBA_INTEGER, GL_BGRA_INTEGER (24)
+ * GL_RGBA_INTEGER, GL_BGRA_INTEGER, GL_HILO_NV, GL_SIGNED_HILO_NV (26)
*
* @param type must be one of
* GL_BITMAP,
@@ -373,7 +381,8 @@ public class GLBuffers extends Buffers {
* GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV,
* GL_UNSIGNED_INT_10_10_10_2, GL_UNSIGNED_INT_2_10_10_10_REV
* GL_UNSIGNED_INT_24_8, GL_UNSIGNED_INT_10F_11F_11F_REV,
- * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV (26)
+ * GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
+ * GL_HILO16_NV, GL_SIGNED_HILO16_NV (28)
*
* @param width in pixels
* @param height in pixels
@@ -410,6 +419,8 @@ public class GLBuffers extends Buffers {
case GL.GL_LUMINANCE_ALPHA:
case GL2GL3.GL_RG:
case GL2GL3.GL_RG_INTEGER:
+ case GL2.GL_HILO_NV:
+ case GL2.GL_SIGNED_HILO_NV:
elements = 2;
break;
case GL.GL_RGB:
@@ -470,6 +481,11 @@ public class GLBuffers extends Buffers {
esize = 2;
elements = 1;
break;
+ case GL2.GL_HILO16_NV:
+ case GL2.GL_SIGNED_HILO16_NV:
+ esize = 2;
+ elements = 2;
+ 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:
@@ -491,6 +507,19 @@ public class GLBuffers extends Buffers {
return sizeof(gl, tmp, elements * esize, width, height, depth, pack);
}
+
+ public static final int getNextPowerOf2(int number) {
+ if (((number-1) & number) == 0) {
+ //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
+ return number;
+ }
+ int power = 0;
+ while (number > 0) {
+ number = number>>1;
+ power++;
+ }
+ return (1<<power);
+ }
//----------------------------------------------------------------------
// Conversion routines
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 b6df365ba..7f3aa8a39 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -1055,9 +1055,7 @@ public class Texture {
// Helper routines for disabling certain codepaths
private static boolean haveNPOT(GL gl) {
- return (!disableNPOT &&
- ( gl.isGLES2() ||
- gl.isExtensionAvailable("GL_ARB_texture_non_power_of_two") ) );
+ return !disableNPOT && gl.isNPOTTextureAvailable();
}
private static boolean haveTexRect(GL gl) {