public class ImageSequence extends Object implements TextureSequence
TextureSequence
implementation
allowing existing textures
or image streams
to be used and replayed as frames
.TextureSequence.TexSeqEventListener<T extends TextureSequence>, TextureSequence.TextureFrame
sampler2D, samplerExternalOES
Constructor and Description |
---|
ImageSequence(int textureUnit,
boolean useBuildInTexLookup) |
Modifier and Type | Method and Description |
---|---|
void |
addFrame(GL gl,
Class<?> context,
String imageResourcePath,
String imageSuffix) |
void |
addFrame(GL gl,
Texture tex) |
void |
destroy(GL gl) |
int |
getCurrentIdx() |
TextureSequence.TextureFrame |
getFrame(int idx) |
int |
getFrameCount() |
TextureSequence.TextureFrame |
getLastTexture()
Returns the last updated texture.
|
boolean |
getManualStepping() |
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 strings:
TextureSequence.getTextureLookupFragmentShaderImpl()
TextureSequence.getTextureSampler2DType()
|
String |
getTextureLookupFragmentShaderImpl()
Returns the complete texture2D lookup function code of type
|
String |
getTextureLookupFunctionName(String desiredFuncName) |
int[] |
getTextureMinMagFilter() |
String |
getTextureSampler2DType()
Returns either
sampler2D or samplerExternalOES
depending on TextureSequence.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 |
isTextureAvailable()
Returns true if texture source is ready and a texture is available
via
TextureSequence.getNextTexture(GL) and TextureSequence.getLastTexture() . |
void |
setCurrentIdx(int idx) |
void |
setManualStepping(boolean v) |
void |
setParams(int magFilter,
int minFilter,
int wrapS,
int wrapT) |
public void setParams(int magFilter, int minFilter, int wrapS, int wrapT)
public final void addFrame(GL gl, Class<?> context, String imageResourcePath, String imageSuffix) throws IOException
IOException
public final int getFrameCount()
public final int getCurrentIdx()
public final void setCurrentIdx(int idx) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public final void setManualStepping(boolean v)
public final boolean getManualStepping()
public final TextureSequence.TextureFrame getFrame(int idx)
public void destroy(GL gl) throws GLException
GLException
public int getTextureTarget()
TextureSequence
getTextureTarget
in interface TextureSequence
public int getTextureUnit()
TextureSequence
getTextureUnit
in interface TextureSequence
public int[] getTextureMinMagFilter()
getTextureMinMagFilter
in interface TextureSequence
public int[] getTextureWrapST()
getTextureWrapST
in interface TextureSequence
public boolean isTextureAvailable()
TextureSequence
TextureSequence.getNextTexture(GL)
and TextureSequence.getLastTexture()
.isTextureAvailable
in interface TextureSequence
public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException
TextureSequence
In case the instance is just initialized, it shall return a TextureFrame
object with valid attributes. The texture content may be undefined
until the first call of TextureSequence.getNextTexture(GL)
.
getLastTexture
in interface TextureSequence
IllegalStateException
- if instance is not initializedpublic TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException
TextureSequence
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.
getNextTexture
in interface TextureSequence
IllegalStateException
- if instance is not initializedpublic String getRequiredExtensionsShaderStub() throws IllegalStateException
TextureSequence
#extension GL_OES_EGL_image_external : enable
getRequiredExtensionsShaderStub
in interface TextureSequence
IllegalStateException
- if instance is not initializedpublic String getTextureSampler2DType() throws IllegalStateException
TextureSequence
sampler2D
or samplerExternalOES
depending on TextureSequence.getLastTexture()
.getTexture()
.getTarget()
.getTextureSampler2DType
in interface TextureSequence
IllegalStateException
- if instance is not initializedpublic String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException
getTextureLookupFunctionName
in interface TextureSequence
desiredFuncName
- desired lookup function name. If null
or ignored by the implementation,
a build-in name is returned.IllegalStateException
- if instance is not initialized#getTextureLookupFragmentShaderImpl()}
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException
TextureSequence
vec4 funcName(in getTextureSampler2DType() image, in vec2 texCoord) { vec4 texColor = do_something_with(image, texCoord); return texColor; }
funcName can be negotiated and queried via TextureSequence.getTextureLookupFunctionName(String)
.
TextureSequence.getTextureLookupFunctionName(String)
will ignore the desired function name
and returns the build-in lookup function name.
getTextureLookupFragmentShaderImpl
in interface TextureSequence
IllegalStateException
- if instance is not initializedTextureSequence.getTextureLookupFunctionName(String)
,
TextureSequence.getTextureSampler2DType()
public int getTextureFragmentShaderHashCode()
TextureSequence
Returns zero if texture is not available
.
TextureSequence
instance.
Implementation shall cache the resulting hash code,
which must be reset to zero if texture is not available
.
getTextureFragmentShaderHashCode
in interface TextureSequence
Copyright 2010 JogAmp Community.