diff options
author | Sven Göthel <[email protected]> | 2024-01-31 11:56:36 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-31 11:56:36 +0100 |
commit | 5cf0d370dbc2b1f59102522d40f4875f7d77b1f7 (patch) | |
tree | 369a7cff074f9d654e046722d912e5226c7311aa /src/jogl/classes/com | |
parent | f7458c47338c90db19ef3f0143a268b60b1267a3 (diff) |
GraphUI: Only issue Shape.mark*Dirty() if values were updated or data available; JOGL ImageSequence: Add addFrame(GL, TextureFrame), remove*Frame() and isSequenceAnimating()
Diffstat (limited to 'src/jogl/classes/com')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java index b2522ab5b..69a990fde 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java @@ -66,14 +66,23 @@ public class ImageSequence implements TextureSequence { texWrapST[1] = wrapT; } - public final void addFrame(final GL gl, final Texture tex) { - final TextureSequence.TextureFrame frame = new TextureSequence.TextureFrame(tex); + public final TextureSequence.TextureFrame addFrame(final GL gl, final Texture tex) { + return addFrame(gl, new TextureSequence.TextureFrame(tex)); + } + public final TextureSequence.TextureFrame addFrame(final GL gl, final TextureSequence.TextureFrame frame) { frames.add(frame); - tex.bind(gl); + frame.texture.bind(gl); gl.glTexParameteri(getTextureTarget(), GL.GL_TEXTURE_MIN_FILTER, texMinMagFilter[0]); gl.glTexParameteri(getTextureTarget(), GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]); gl.glTexParameteri(getTextureTarget(), GL.GL_TEXTURE_WRAP_S, texWrapST[0]); gl.glTexParameteri(getTextureTarget(), GL.GL_TEXTURE_WRAP_T, texWrapST[1]); + return frame; + } + public boolean removeFrame(final TextureFrame tex) { + return frames.remove(tex); + } + public void removeAllFrames() { + frames.clear(); } public final void addFrame(final GL gl, final Class<?> context, final String imageResourcePath, final String imageSuffix) throws IOException { @@ -94,7 +103,10 @@ public class ImageSequence implements TextureSequence { frameIdx=idx; } public final void setManualStepping(final boolean v) { manualStepping = v; } - public final boolean getManualStepping() { return manualStepping; } + public final boolean isManualStepping() { return manualStepping; } + + /** Returns {@code true} if not {@link #isManualStepping()} and {@link #getFrameCount()} > 1 */ + public final boolean isSequenceAnimating() { return !manualStepping && frames.size() > 1; } public final TextureSequence.TextureFrame getFrame(final int idx) { return frames.get(idx); } public void destroy(final GL gl) throws GLException { |