Package com.jogamp.opengl.util.texture
Class ImageSequence
java.lang.Object
com.jogamp.opengl.util.texture.ImageSequence
- All Implemented Interfaces:
TextureSequence
Simple
TextureSequence
implementation
allowing existing textures
or image streams
to be used and replayed as frames
.-
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 -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final void
void
final int
getFrame
(int idx) final int
Returns the last updated texture.final boolean
getNextTexture
(GL gl) Returns the next texture to be rendered.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
Returns the hash code of the strings:TextureSequence.getTextureLookupFragmentShaderImpl()
TextureSequence.getTextureSampler2DType()
Returns the complete texture2D lookup function code of typegetTextureLookupFunctionName
(String desiredFuncName) int[]
Returns eithersampler2D
orsamplerExternalOES
depending onTextureSequence.getLastTexture()
.getTexture()
.getTarget()
.int
Returns the texture target used by implementation.int
Return the texture unit used to render the current frame.int[]
boolean
Returns true if texture source is ready and a texture is available viaTextureSequence.getNextTexture(GL)
andTextureSequence.getLastTexture()
.final void
setCurrentIdx
(int idx) final void
setManualStepping
(boolean v) void
setParams
(int magFilter, int minFilter, int wrapS, int wrapT)
-
Constructor Details
-
ImageSequence
public ImageSequence(int textureUnit, boolean useBuildInTexLookup)
-
-
Method Details
-
setParams
public void setParams(int magFilter, int minFilter, int wrapS, int wrapT) -
addFrame
-
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
- Throws:
IndexOutOfBoundsException
-
setManualStepping
public final void setManualStepping(boolean v) -
getManualStepping
public final boolean getManualStepping() -
getFrame
-
destroy
- 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
-
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
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
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
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
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
-
getTextureLookupFunctionName
- Specified by:
getTextureLookupFunctionName
in interfaceTextureSequence
- Parameters:
desiredFuncName
- desired lookup function name. Ifnull
or ignored by the implementation, a build-in name is returned.- Returns:
- the final lookup function name
- Throws:
IllegalStateException
- if instance is not initialized
-
getTextureLookupFragmentShaderImpl
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 can be negotiated and queried via
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(String)
.TextureSequence.getTextureLookupFunctionName(String)
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:
-
getTextureFragmentShaderHashCode
public int getTextureFragmentShaderHashCode()Description copied from interface:TextureSequence
Returns the hash code of the strings:Returns zero if
The returned hash code allows selection of a matching shader program for thistexture is not available
.TextureSequence
instance.Implementation shall cache the resulting hash code, which must be reset to zero if
texture is not available
.- Specified by:
getTextureFragmentShaderHashCode
in interfaceTextureSequence
-