Top Description Fields Constructors Methods
com.jogamp.opengl.util.texture

public Class ImageSequence

extends Object
implements TextureSequence
Class Inheritance
All Implemented Interfaces
com.jogamp.opengl.util.texture.TextureSequence
Imports
java.io.IOException, java.net.URLConnection, java.util.ArrayList, .List, com.jogamp.opengl.GL, .GLException, .GLProfile, com.jogamp.common.util.IOUtil

Simple TextureSequence implementation allowing existing textures or image streams to be used and replayed as frames.

Field Summary

Modifier and TypeField and Description
private volatile int
private final List<TextureSequence.TextureFrame>
private volatile boolean
private final int[]
private int
private String
private final int
private final int[]
private final boolean

Constructor Summary

AccessConstructor and Description
public
ImageSequence(final int textureUnit, final boolean useBuildInTexLookup)

Method Summary

Modifier and TypeMethod and Description
public final void
addFrame(final GL gl, final Texture tex)

public final void
addFrame(final GL gl, final Class<?> context, final String imageResourcePath, final String imageSuffix)

public void
destroy(final GL gl)

public final int
public final TextureSequence.TextureFrame
getFrame(final int idx)

public final int
public TextureSequence.TextureFrame
public final boolean
public TextureSequence.TextureFrame
getNextTexture(final GL gl)

Implements com.jogamp.opengl.util.texture.TextureSequence.getNextTexture.

Returns the next texture to be rendered.
public String
getRequiredExtensionsShaderStub()

Implements com.jogamp.opengl.util.texture.TextureSequence.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.:
#extension GL_OES_EGL_image_external : enable
public int
public String
getTextureLookupFragmentShaderImpl()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFragmentShaderImpl.

Returns the complete texture2D lookup function code of type
  vec4 funcName(in getTextureSampler2DType() image, in vec2 texCoord) {
     vec4 texColor = do_something_with(image, texCoord);
     return texColor;
  }
public String
getTextureLookupFunctionName(final String
desired lookup function name. If null or ignored by the implementation, a build-in name is returned.
desiredFuncName
)

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFunctionName.

public int[]
public String
getTextureSampler2DType()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureSampler2DType.

Returns either sampler2D or samplerExternalOES depending on getLastTexture().
public int
getTextureTarget()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureTarget.

Returns the texture target used by implementation.
public int
getTextureUnit()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureUnit.

Return the texture unit used to render the current frame.
public int[]
public boolean
isTextureAvailable()

Implements com.jogamp.opengl.util.texture.TextureSequence.isTextureAvailable.

Returns true if texture source is ready and a texture is available via getNextTexture(GL) and getLastTexture().
public final void
setCurrentIdx(final int idx)

public final void
setManualStepping(final boolean v)

public void
setParams(final int magFilter, final int minFilter, final int wrapS, final int wrapT)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

frameIdxback to summary
private volatile int frameIdx
framesback to summary
private final List<TextureSequence.TextureFrame> frames
manualSteppingback to summary
private volatile boolean manualStepping
texMinMagFilterback to summary
private final int[] texMinMagFilter
textureFragmentShaderHashCodeback to summary
private int textureFragmentShaderHashCode
textureLookupFunctionNameback to summary
private String textureLookupFunctionName
textureUnitback to summary
private final int textureUnit
texWrapSTback to summary
private final int[] texWrapST
useBuildInTexLookupback to summary
private final boolean useBuildInTexLookup

Constructor Detail

ImageSequenceback to summary
public ImageSequence(final int textureUnit, final boolean useBuildInTexLookup)

Method Detail

addFrameback to summary
public final void addFrame(final GL gl, final Texture tex)
addFrameback to summary
public final void addFrame(final GL gl, final Class<?> context, final String imageResourcePath, final String imageSuffix) throws IOException
destroyback to summary
public void destroy(final GL gl) throws GLException
getCurrentIdxback to summary
public final int getCurrentIdx()
getFrameback to summary
public final TextureSequence.TextureFrame getFrame(final int idx)
getFrameCountback to summary
public final int getFrameCount()
getLastTextureback to summary
public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getLastTexture.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getLastTexture.

Returns the last updated texture.

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 getNextTexture(GL).

Not blocking.
Annotations
@Override
Exceptions
IllegalStateException:
if instance is not initialized
getManualSteppingback to summary
public final boolean getManualStepping()
getNextTextureback to summary
public TextureSequence.TextureFrame getNextTexture(final GL gl) throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getNextTexture.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getNextTexture.

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.

Annotations
@Override
Exceptions
IllegalStateException:
if instance is not initialized
getRequiredExtensionsShaderStubback to summary
public String getRequiredExtensionsShaderStub() throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getRequiredExtensionsShaderStub.

Doc from com.jogamp.opengl.util.texture.TextureSequence.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.:

#extension GL_OES_EGL_image_external : enable
Annotations
@Override
Exceptions
IllegalStateException:
if instance is not initialized
getTextureFragmentShaderHashCodeback to summary
public int getTextureFragmentShaderHashCode()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureFragmentShaderHashCode.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureFragmentShaderHashCode.

Returns the hash code of the strings:

Returns zero if texture is not available.

The returned hash code allows selection of a matching shader program for this TextureSequence instance.

Implementation shall cache the resulting hash code, which must be reset to zero if texture is not available.

Annotations
@Override
getTextureLookupFragmentShaderImplback to summary
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFragmentShaderImpl.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFragmentShaderImpl.

Returns the complete texture2D lookup function code of type

  vec4 funcName(in getTextureSampler2DType() image, in vec2 texCoord) {
     vec4 texColor = do_something_with(image, texCoord);
     return texColor;
  }

funcName can be negotiated and queried via getTextureLookupFunctionName(String).

Note: This function may return an empty string in case a build-in lookup function is being chosen. If the implementation desires so, getTextureLookupFunctionName(String) will ignore the desired function name and returns the build-in lookup function name.

Annotations
@Override
Exceptions
IllegalStateException:
if instance is not initialized
getTextureLookupFunctionNameback to summary
public String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFunctionName.

Parameters
desiredFuncName:String

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFunctionName.

desired lookup function name. If null or ignored by the implementation, a build-in name is returned.

Returns:String

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFunctionName.

the final lookup function name

Annotations
@Override
Exceptions
IllegalStateException:

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureLookupFunctionName.

if instance is not initialized

getTextureMinMagFilterback to summary
public int[] getTextureMinMagFilter()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureMinMagFilter.

Annotations
@Override
getTextureSampler2DTypeback to summary
public String getTextureSampler2DType() throws IllegalStateException

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureSampler2DType.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureSampler2DType.

Returns either sampler2D or samplerExternalOES depending on getLastTexture().getTexture().getTarget().

Annotations
@Override
Exceptions
IllegalStateException:
if instance is not initialized
getTextureTargetback to summary
public int getTextureTarget()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureTarget.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureTarget.

Returns the texture target used by implementation.

Annotations
@Override
getTextureUnitback to summary
public int getTextureUnit()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureUnit.

Doc from com.jogamp.opengl.util.texture.TextureSequence.getTextureUnit.

Return the texture unit used to render the current frame.

Annotations
@Override
getTextureWrapSTback to summary
public int[] getTextureWrapST()

Implements com.jogamp.opengl.util.texture.TextureSequence.getTextureWrapST.

Annotations
@Override
isTextureAvailableback to summary
public boolean isTextureAvailable()

Implements com.jogamp.opengl.util.texture.TextureSequence.isTextureAvailable.

Doc from com.jogamp.opengl.util.texture.TextureSequence.isTextureAvailable.

Returns true if texture source is ready and a texture is available via getNextTexture(GL) and getLastTexture().

Annotations
@Override
setCurrentIdxback to summary
public final void setCurrentIdx(final int idx) throws IndexOutOfBoundsException
setManualSteppingback to summary
public final void setManualStepping(final boolean v)
setParamsback to summary
public void setParams(final int magFilter, final int minFilter, final int wrapS, final int wrapT)