From 4dc4a32720e7b176e6811c0eaa8ddc060e1468da Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Aug 2013 00:39:30 +0200 Subject: TextureSequence: Add END_OF_STREAM_PTS, remove 'blocking' from getNextTexture(..), may blocks .. or not, depending on implementation and state. --- .../jogamp/opengl/util/texture/TextureSequence.java | 21 ++++++++++++--------- .../junit/jogl/demos/TextureSequenceDemo01.java | 2 +- .../jogl/demos/es2/TextureSequenceCubeES2.java | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) 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 05fda99ae..e13e5ff13 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java @@ -110,8 +110,11 @@ public interface TextureSequence { * to associated related data. */ public static class TextureFrame { - /** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE 0x80000000 {@value}. */ - public static final int INVALID_PTS = 0x80000000 ; // == -2147483648 == Integer.MIN_VALUE; + /** 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 TextureFrame(Texture t) { texture = t; @@ -130,7 +133,7 @@ public interface TextureSequence { public final void setDuration(int duration) { this.duration = duration; } public String toString() { - return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, "+ texture + "]"; + return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ texture.getTextureObject() + "]"; } protected final Texture texture; protected int pts; @@ -141,7 +144,7 @@ public interface TextureSequence { /** * Signaling listeners that a new {@link TextureFrame} is available. *

- * User shall utilize {@link TextureSequence#getNextTexture(GL, boolean)} to dequeue it to maintain + * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain * a consistent queue. *

* @param ts the event source @@ -163,7 +166,7 @@ public interface TextureSequence { *

* In case the instance is just initialized, it shall return a TextureFrame * object with valid attributes. The texture content may be undefined - * until the first call of {@link #getNextTexture(GL, boolean)}.
+ * until the first call of {@link #getNextTexture(GL)}.
*

* Not blocking. * @@ -174,16 +177,16 @@ public interface TextureSequence { /** * Returns the next texture to be rendered. *

- * Implementation shall block until next frame is available if blocking is true, - * otherwise it shall return the last frame in case a new frame is not available. + * Implementation shall return the next frame if available, may block if a next frame may arrive soon. + * Otherwise implementation shall return the last frame. *

*

- * Shall return null in case no frame is available. + * Shall return null in case no next or last frame is available. *

* * @throws IllegalStateException if instance is not initialized */ - public TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException ; + public TextureFrame getNextTexture(GL gl) throws IllegalStateException ; /** * In case a shader extension is required, based on the implementation diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java index 6fd47e63f..ab3899a7b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java @@ -77,7 +77,7 @@ public class TextureSequenceDemo01 implements TextureSequence { } @Override - public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException { + public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException { return frame; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java index 556d17992..4172a2c20 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java @@ -370,7 +370,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { interleavedVBO.enableBuffer(gl, true); Texture tex = null; if(null!=texSeq) { - final TextureSequence.TextureFrame texFrame = texSeq.getNextTexture(gl, true); + final TextureSequence.TextureFrame texFrame = texSeq.getNextTexture(gl); if(null != texFrame) { tex = texFrame.getTexture(); gl.glActiveTexture(GL.GL_TEXTURE0+texSeq.getTextureUnit()); -- cgit v1.2.3