Class ImageSequence
- java.lang.Object
-
- com.jogamp.opengl.util.texture.ImageSequence
-
- All Implemented Interfaces:
TextureSequence
public class ImageSequence extends Object implements TextureSequence
SimpleTextureSequenceimplementation allowingexisting texturesorimage streamsto 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 voidaddFrame(GL gl, Texture tex)voidaddFrame(GL gl, Class<?> context, String imageResourcePath, String imageSuffix)voiddestroy(GL gl)intgetCurrentIdx()TextureSequence.TextureFramegetFrame(int idx)intgetFrameCount()TextureSequence.TextureFramegetLastTexture()Returns the last updated texture.booleangetManualStepping()TextureSequence.TextureFramegetNextTexture(GL gl)Returns the next texture to be rendered.StringgetRequiredExtensionsShaderStub()In case a shader extension is required, based on the implementation and the runtime GL profile, this method returns the preprocessor macros, e.g.:intgetTextureFragmentShaderHashCode()Returns the hash code of the strings:TextureSequence.getTextureLookupFunctionName()TextureSequence.getTextureLookupFragmentShaderImpl()TextureSequence.getTextureSampler2DType()StringgetTextureLookupFragmentShaderImpl()Returns the complete texture2D lookup function code of typeStringgetTextureLookupFunctionName()Returns the chosen lookup function name, which can be set viaTextureSequence.setTextureLookupFunctionName(String).int[]getTextureMinMagFilter()StringgetTextureSampler2DType()Returns eithersampler2DorsamplerExternalOESdepending onTextureSequence.getLastTexture().getTexture().getTarget().intgetTextureTarget()Returns the texture target used by implementation.intgetTextureUnit()Return the texture unit used to render the current frame.int[]getTextureWrapST()booleanisTextureAvailable()Returns true if texture source is ready and a texture is available viaTextureSequence.getNextTexture(GL)andTextureSequence.getLastTexture().voidsetCurrentIdx(int idx)voidsetManualStepping(boolean v)voidsetParams(int magFilter, int minFilter, int wrapS, int wrapT)StringsetTextureLookupFunctionName(String texLookupFuncName)Set the desired shader code's texture lookup function name.
-
-
-
Method Detail
-
setParams
public void setParams(int magFilter, int minFilter, int wrapS, int wrapT)
-
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)
-
getManualStepping
public final boolean getManualStepping()
-
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:TextureSequenceReturns the texture target used by implementation.- Specified by:
getTextureTargetin interfaceTextureSequence
-
getTextureUnit
public int getTextureUnit()
Description copied from interface:TextureSequenceReturn the texture unit used to render the current frame.- Specified by:
getTextureUnitin interfaceTextureSequence
-
getTextureMinMagFilter
public int[] getTextureMinMagFilter()
- Specified by:
getTextureMinMagFilterin interfaceTextureSequence
-
getTextureWrapST
public int[] getTextureWrapST()
- Specified by:
getTextureWrapSTin interfaceTextureSequence
-
isTextureAvailable
public boolean isTextureAvailable()
Description copied from interface:TextureSequenceReturns true if texture source is ready and a texture is available viaTextureSequence.getNextTexture(GL)andTextureSequence.getLastTexture().- Specified by:
isTextureAvailablein interfaceTextureSequence
-
getLastTexture
public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException
Description copied from interface:TextureSequenceReturns the last updated texture.In case the instance is just initialized, it shall return a
Not blocking.TextureFrameobject with valid attributes. The texture content may be undefined until the first call ofTextureSequence.getNextTexture(GL).
- Specified by:
getLastTexturein interfaceTextureSequence- Throws:
IllegalStateException- if instance is not initialized
-
getNextTexture
public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException
Description copied from interface:TextureSequenceReturns 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
nullin case no next or last frame is available.- Specified by:
getNextTexturein interfaceTextureSequence- Throws:
IllegalStateException- if instance is not initialized
-
getRequiredExtensionsShaderStub
public String getRequiredExtensionsShaderStub() throws IllegalStateException
Description copied from interface:TextureSequenceIn 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:
getRequiredExtensionsShaderStubin interfaceTextureSequence- Throws:
IllegalStateException- if instance is not initialized
-
getTextureSampler2DType
public String getTextureSampler2DType() throws IllegalStateException
Description copied from interface:TextureSequenceReturns eithersampler2DorsamplerExternalOESdepending onTextureSequence.getLastTexture().getTexture().getTarget().- Specified by:
getTextureSampler2DTypein interfaceTextureSequence- Throws:
IllegalStateException- if instance is not initialized
-
setTextureLookupFunctionName
public String setTextureLookupFunctionName(String texLookupFuncName) throws IllegalStateException
Description copied from interface:TextureSequenceSet the desired shader code's texture lookup function name.- Specified by:
setTextureLookupFunctionNamein interfaceTextureSequence- Parameters:
texLookupFuncName- desired lookup function name. Ifnullor 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:TextureSequenceReturns the chosen lookup function name, which can be set viaTextureSequence.setTextureLookupFunctionName(String).- Specified by:
getTextureLookupFunctionNamein 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:TextureSequenceReturns 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:
getTextureLookupFragmentShaderImplin interfaceTextureSequence- Throws:
IllegalStateException- if instance is not initialized- See Also:
TextureSequence.getTextureLookupFunctionName(),TextureSequence.setTextureLookupFunctionName(String),TextureSequence.getTextureFragmentShaderHashCode(),TextureSequence.getTextureSampler2DType()
-
getTextureFragmentShaderHashCode
public int getTextureFragmentShaderHashCode()
Description copied from interface:TextureSequenceReturns the hash code of the strings:TextureSequence.getTextureLookupFunctionName()TextureSequence.getTextureLookupFragmentShaderImpl()TextureSequence.getTextureSampler2DType()
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.TextureSequenceinstance.Implementation caches the resulting hash code, which must be reset to zero if
texture is not available.
-
-