Package com.banuba.sdk.internal.gl
Class GLTexture
java.lang.Object
com.banuba.sdk.internal.gl.GLTexture
- All Implemented Interfaces:
Closeable
,AutoCloseable
OpenGL texture
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Get OpenGL texture IDvoid
setTextureData
(ByteBuffer data, int width, int height, int strideInPixels) Set texture datastatic void
unbind()
Unbind any previously bound shader program
-
Constructor Details
-
GLTexture
public GLTexture(int colorComponents) Create a new insance of GLTexture- Parameters:
colorComponents
- number of the color components: 1 - for GL_LUMINANCE texture 2 - for GL_RG texture 3 - for GL_RGB texture 4 - for GL_RGBA texture
-
-
Method Details
-
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:
-
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
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-