Class ImageSequence
- java.lang.Object
-
- com.jogamp.opengl.util.texture.ImageSequence
-
- All Implemented Interfaces:
TextureSequence
public class ImageSequence extends Object implements TextureSequence
SimpleTextureSequence
implementation allowingexisting textures
orimage streams
to be used and replayed asframes
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jogamp.opengl.util.texture.TextureSequence
TextureSequence.TexSeqEventListener<T extends TextureSequence>, TextureSequence.TextureFrame
-
-
Field Summary
-
Fields inherited from interface com.jogamp.opengl.util.texture.TextureSequence
sampler2D, samplerExternalOES
-
-
Constructor Summary
Constructors Constructor Description ImageSequence(int textureUnit, boolean useBuildInTexLookup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextureSequence.TextureFrame
addFrame(GL gl, Texture tex)
TextureSequence.TextureFrame
addFrame(GL gl, TextureSequence.TextureFrame frame)
void
addFrame(GL gl, Class<?> context, String imageResourcePath, String imageSuffix)
void
destroy(GL gl)
com.jogamp.math.Vec4f
getARatioLetterboxBackColor()
ReturnsTextureSequence.useARatioLetterbox()
background color for added letter-box space, defaults to transparent zero.int
getCurrentIdx()
TextureSequence.TextureFrame
getFrame(int idx)
int
getFrameCount()
TextureSequence.TextureFrame
getLastTexture()
Returns the last updated texture.TextureSequence.TextureFrame
getNextTexture(GL gl)
Returns the next texture to be rendered.String
getRequiredExtensionsShaderStub()
In case a shader extension is required, based on the implementation and the runtime GL profile, this method returns the preprocessor macros, e.g.:int
getTextureFragmentShaderHashCode()
Returns the hash code of the stringTextureSequence.getTextureFragmentShaderHashID()
.String
getTextureFragmentShaderHashID()
Returns the concatenated string representing the following values utilized forTextureSequence.getTextureFragmentShaderHashCode()
.String
getTextureLookupFragmentShaderImpl()
Returns the complete texture2D lookup function code of typeString
getTextureLookupFunctionName()
Returns the chosen lookup function name, which can be set viaTextureSequence.setTextureLookupFunctionName(String)
.int[]
getTextureMinMagFilter()
String
getTextureSampler2DType()
Returns eithersampler2D
orsamplerExternalOES
depending onTextureSequence.getLastTexture()
.getTexture()
.getTarget()
.int
getTextureTarget()
Returns the texture target used by implementation.int
getTextureUnit()
Return the texture unit used to render the current frame.int[]
getTextureWrapST()
boolean
isManualStepping()
boolean
isSequenceAnimating()
boolean
isTextureAvailable()
Returns true if texture source is ready and a texture is available viaTextureSequence.getNextTexture(GL)
andTextureSequence.getLastTexture()
.void
removeAllFrames()
boolean
removeFrame(TextureSequence.TextureFrame tex)
void
setARatioAdjustment(boolean v)
TogglesTextureSequence.useARatioLetterbox()
.void
setARatioLetterbox(boolean v, com.jogamp.math.Vec4f backColor)
TogglesTextureSequence.useARatioLetterbox()
.void
setCurrentIdx(int idx)
void
setManualStepping(boolean v)
void
setParams(int magFilter, int minFilter, int wrapS, int wrapT)
String
setTextureLookupFunctionName(String texLookupFuncName)
Set the desired shader code's texture lookup function name.boolean
useARatioAdjustment()
Returningtrue
indicates texture correction for aspect-ratio in the shader.boolean
useARatioLetterbox()
Returns whetherTextureSequence.useARatioAdjustment()
shall add letter-box space to match aspect-ratio, otherwise it will be zoomed in.
-
-
-
Method Detail
-
setParams
public void setParams(int magFilter, int minFilter, int wrapS, int wrapT)
-
addFrame
public final TextureSequence.TextureFrame addFrame(GL gl, Texture tex)
-
addFrame
public final TextureSequence.TextureFrame addFrame(GL gl, TextureSequence.TextureFrame frame)
-
removeFrame
public boolean removeFrame(TextureSequence.TextureFrame tex)
-
removeAllFrames
public void removeAllFrames()
-
addFrame
public final void addFrame(GL gl, Class<?> context, String imageResourcePath, String imageSuffix) throws IOException
- Throws:
IOException
-
getFrameCount
public final int getFrameCount()
-
getCurrentIdx
public final int getCurrentIdx()
-
setCurrentIdx
public final void setCurrentIdx(int idx) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
setManualStepping
public final void setManualStepping(boolean v)
-
isManualStepping
public final boolean isManualStepping()
-
isSequenceAnimating
public final boolean isSequenceAnimating()
-
getFrame
public final TextureSequence.TextureFrame getFrame(int idx)
-
destroy
public void destroy(GL gl) throws GLException
- Throws:
GLException
-
getTextureTarget
public int getTextureTarget()
Description copied from interface:TextureSequence
Returns the texture target used by implementation.- Specified by:
getTextureTarget
in interfaceTextureSequence
-
getTextureUnit
public int getTextureUnit()
Description copied from interface:TextureSequence
Return the texture unit used to render the current frame.- Specified by:
getTextureUnit
in interfaceTextureSequence
-
getTextureMinMagFilter
public int[] getTextureMinMagFilter()
- Specified by:
getTextureMinMagFilter
in interfaceTextureSequence
-
getTextureWrapST
public int[] getTextureWrapST()
- Specified by:
getTextureWrapST
in interfaceTextureSequence
-
useARatioAdjustment
public boolean useARatioAdjustment()
Returningtrue
indicates texture correction for aspect-ratio in the shader. Graph'sRegion
shader will utilizeTextureSequence.setTexCoordBBox(Texture, AABBox, boolean, float[], boolean)
for texture-coordinate bounding-box calculation.Returning
false
indicates no correction for aspect-ratio in the shader. Graph'sRegion
shader will utilizeTextureSequence.setTexCoordBBoxSimple(Texture, AABBox, float[], boolean)
for texture-coordinate bounding-box calculation.Default value is implementation specific and toggling is optional.
Defaults to
true
and toggling is supported viasetARatioAdjustment(boolean)
-
setARatioAdjustment
public void setARatioAdjustment(boolean v)
TogglesTextureSequence.useARatioLetterbox()
.Default value is implementation specific and toggling is optional.
Defaults to
true
.- Specified by:
setARatioAdjustment
in interfaceTextureSequence
- See Also:
TextureSequence.useARatioLetterbox()
,TextureSequence.useARatioAdjustment()
-
useARatioLetterbox
public boolean useARatioLetterbox()
Returns whetherTextureSequence.useARatioAdjustment()
shall add letter-box space to match aspect-ratio, otherwise it will be zoomed in.Default value is implementation specific and toggling is optional.
Defaults to
false
and toggling is supported viasetARatioLetterbox(boolean, Vec4f)
- Specified by:
useARatioLetterbox
in interfaceTextureSequence
- See Also:
TextureSequence.useARatioAdjustment()
,TextureSequence.setARatioLetterbox(boolean, Vec4f)
-
getARatioLetterboxBackColor
public com.jogamp.math.Vec4f getARatioLetterboxBackColor()
Description copied from interface:TextureSequence
ReturnsTextureSequence.useARatioLetterbox()
background color for added letter-box space, defaults to transparent zero.- Specified by:
getARatioLetterboxBackColor
in interfaceTextureSequence
-
setARatioLetterbox
public void setARatioLetterbox(boolean v, com.jogamp.math.Vec4f backColor)
TogglesTextureSequence.useARatioLetterbox()
.Default value is implementation specific and toggling is optional.
Impacts only if
TextureSequence.useARatioAdjustment()
returnstrue
.Defaults to
false
.- Specified by:
setARatioLetterbox
in interfaceTextureSequence
- Parameters:
v
- new value forTextureSequence.useARatioLetterbox()
backColor
- optional background color for added letter-box space, defaults to transparent zero- See Also:
TextureSequence.useARatioLetterbox()
,TextureSequence.useARatioAdjustment()
-
isTextureAvailable
public boolean isTextureAvailable()
Description copied from interface:TextureSequence
Returns true if texture source is ready and a texture is available viaTextureSequence.getNextTexture(GL)
andTextureSequence.getLastTexture()
.- Specified by:
isTextureAvailable
in interfaceTextureSequence
-
getLastTexture
public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException
Description copied from interface:TextureSequence
Returns the last updated texture.In case the instance is just initialized, it shall return a
Not blocking.TextureFrame
object with valid attributes. The texture content may be undefined until the first call ofTextureSequence.getNextTexture(GL)
.
- Specified by:
getLastTexture
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized
-
getNextTexture
public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException
Description copied from interface:TextureSequence
Returns the next texture to be rendered.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 next or last frame is available.- Specified by:
getNextTexture
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized
-
getRequiredExtensionsShaderStub
public String getRequiredExtensionsShaderStub() throws IllegalStateException
Description copied from interface:TextureSequence
In case a shader extension is required, based on the implementation and the runtime GL profile, this method returns the preprocessor macros, e.g.:#extension GL_OES_EGL_image_external : enable
- Specified by:
getRequiredExtensionsShaderStub
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized
-
getTextureSampler2DType
public String getTextureSampler2DType() throws IllegalStateException
Description copied from interface:TextureSequence
Returns eithersampler2D
orsamplerExternalOES
depending onTextureSequence.getLastTexture()
.getTexture()
.getTarget()
.- Specified by:
getTextureSampler2DType
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized
-
setTextureLookupFunctionName
public String setTextureLookupFunctionName(String texLookupFuncName) throws IllegalStateException
Description copied from interface:TextureSequence
Set the desired shader code's texture lookup function name.- Specified by:
setTextureLookupFunctionName
in interfaceTextureSequence
- Parameters:
texLookupFuncName
- desired lookup function name. Ifnull
or ignored by the implementation, a build-in name is returned.- Returns:
- the chosen lookup function name
- Throws:
IllegalStateException
- if instance is not initialized- See Also:
TextureSequence.getTextureLookupFunctionName()
,TextureSequence.getTextureFragmentShaderHashCode()
,TextureSequence.getTextureLookupFragmentShaderImpl()
-
getTextureLookupFunctionName
public String getTextureLookupFunctionName() throws IllegalStateException
Description copied from interface:TextureSequence
Returns the chosen lookup function name, which can be set viaTextureSequence.setTextureLookupFunctionName(String)
.- Specified by:
getTextureLookupFunctionName
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized- See Also:
TextureSequence.setTextureLookupFunctionName(String)
,TextureSequence.getTextureFragmentShaderHashCode()
,TextureSequence.getTextureLookupFragmentShaderImpl()
-
getTextureLookupFragmentShaderImpl
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException
Description copied from interface:TextureSequence
Returns the complete texture2D lookup function code of typevec4 funcName(in getTextureSampler2DType() image, in vec2 texCoord) { vec4 texColor = do_something_with(image, texCoord); return texColor; }
funcName is set via
TextureSequence.setTextureLookupFunctionName(String)
and queried viaTextureSequence.getTextureLookupFunctionName()
.User shall call
TextureSequence.setTextureLookupFunctionName(String)
first if intended.Note: This function may return an empty string in case a build-in lookup function is being chosen. If the implementation desires so,
TextureSequence.getTextureLookupFunctionName()
will ignore the desired function name and returns the build-in lookup function name.- Specified by:
getTextureLookupFragmentShaderImpl
in interfaceTextureSequence
- Throws:
IllegalStateException
- if instance is not initialized- See Also:
TextureSequence.getTextureLookupFunctionName()
,TextureSequence.setTextureLookupFunctionName(String)
,TextureSequence.getTextureFragmentShaderHashID()
,TextureSequence.getTextureFragmentShaderHashCode()
,TextureSequence.getTextureSampler2DType()
-
getTextureFragmentShaderHashID
public String getTextureFragmentShaderHashID()
Description copied from interface:TextureSequence
Returns the concatenated string representing the following values utilized forTextureSequence.getTextureFragmentShaderHashCode()
.TextureSequence.getTextureSampler2DType()
TextureSequence.getTextureLookupFunctionName()
TextureSequence.getTextureLookupFragmentShaderImpl()
To reduce string concatenating, implementation may simply return
TextureSequence.getTextureLookupFragmentShaderImpl()
, if it coversTextureSequence.getTextureSampler2DType()
andTextureSequence.getTextureLookupFunctionName()
.- Specified by:
getTextureFragmentShaderHashID
in interfaceTextureSequence
- See Also:
TextureSequence.getTextureFragmentShaderHashCode()
-
getTextureFragmentShaderHashCode
public int getTextureFragmentShaderHashCode()
Description copied from interface:TextureSequence
Returns the hash code of the stringTextureSequence.getTextureFragmentShaderHashID()
.User shall call
TextureSequence.setTextureLookupFunctionName(String)
first if intended.Returns zero if
The returned hash code allows selection of a matching shader program for thistexture is not available
.TextureSequence
instance.Implementation caches the resulting hash code, which is reset by
TextureSequence.setTextureLookupFunctionName(String)
and this method iftexture is not available
.
-
-