Package com.banuba.sdk.internal.gl
Class GLTexture
- java.lang.Object
-
- com.banuba.sdk.internal.gl.GLTexture
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class GLTexture extends java.lang.Object implements java.io.Closeable
OpenGL texture
-
-
Constructor Summary
Constructors Constructor Description GLTexture(int colorComponents)
Create a new insance of GLTexture
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
associateWithUniformAndTextureUnit(int uniformLocation, int textureUnitNumber)
Associate this texture with uniform variable in the shader program, and set texture unitvoid
bind()
Bind this texture and setup texture sampler in the sahder.void
close()
Close resourcesint
getTextureId()
Get OpenGL texture IDvoid
setTextureData(java.nio.ByteBuffer data, int width, int height, int strideInPixels)
Set texture datastatic void
unbind()
Unbind any previously bound shader program
-
-
-
Method Detail
-
associateWithUniformAndTextureUnit
public void associateWithUniformAndTextureUnit(int uniformLocation, int textureUnitNumber)
Associate this texture with uniform variable in the shader program, and set texture unit- Parameters:
uniformLocation
- uniform idtextureUnitNumber
-- See Also:
GLShaderProgram.getUniformLocation(String)
-
bind
public void bind()
Bind this texture and setup texture sampler in the sahder. (The method must have been called before associateWithUniformAndTextureUnit)
-
unbind
public static void unbind()
Unbind any previously bound shader program
-
setTextureData
public void setTextureData(java.nio.ByteBuffer data, int width, int height, int strideInPixels)
Set texture data- Parameters:
data
- image datawidth
- width of the imageheight
- height of the imagestrideInPixels
- image stride in number of pixels
-
getTextureId
public int getTextureId()
Get OpenGL texture ID- Returns:
- texture Id
-
close
public void close()
Close resources- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-