diff options
author | Sven Gothel <[email protected]> | 2013-08-23 00:39:30 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-08-23 00:39:30 +0200 |
commit | 4dc4a32720e7b176e6811c0eaa8ddc060e1468da (patch) | |
tree | f52ea9bbd1c037f044d219e43c3f0fc4012b8171 | |
parent | c6555b09c455d0db238e4cf57ee3efd4e426f215 (diff) |
TextureSequence: Add END_OF_STREAM_PTS, remove 'blocking' from getNextTexture(..), may blocks .. or not, depending on implementation and state.
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. * <p> - * 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. * </p> * @param ts the event source @@ -163,7 +166,7 @@ public interface TextureSequence { * <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 - * until the first call of {@link #getNextTexture(GL, boolean)}.<br> + * until the first call of {@link #getNextTexture(GL)}.<br> * </p> * Not blocking. * @@ -174,16 +177,16 @@ public interface TextureSequence { /** * Returns the next texture to be rendered. * <p> - * Implementation shall block until next frame is available if <code>blocking</code> is <code>true</code>, - * 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 <i>soon</i>. + * Otherwise implementation shall return the last frame. * </p> * <p> - * Shall return <code>null</code> in case <i>no</i> frame is available. + * Shall return <code>null</code> in case <i>no</i> next or last frame is available. * </p> * * @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()); |