library / com.otaliastudios.opengl.program / GlTextureProgram

GlTextureProgram

open class GlTextureProgram : GlProgram

Base implementation for a GlProgram that draws textures.

Constructors

<init>

GlTextureProgram(vertexShader: String = SIMPLE_VERTEX_SHADER, fragmentShader: String = SIMPLE_FRAGMENT_SHADER, vertexPositionName: String = "aPosition", vertexMvpMatrixName: String = "uMVPMatrix", textureCoordsName: String? = "aTextureCoord", textureTransformName: String? = "uTexMatrix")
GlTextureProgram(handle: Int, vertexPositionName: String = "aPosition", vertexMvpMatrixName: String = "uMVPMatrix", textureCoordsName: String? = "aTextureCoord", textureTransformName: String? = "uTexMatrix")

Base implementation for a GlProgram that draws textures.

GlTextureProgram(handle: Int, ownsHandle: Boolean, vertexPositionName: String, vertexMvpMatrixName: String, textureCoordsName: String?, textureTransformName: String?)

Properties

texture

If not null, GlTextureProgram will care about the texture lifecycle: binding, unbinding and destroying.

var texture: GlTexture?

textureTransform

var textureTransform: FloatArray

Functions

computeTextureCoordinate

open fun computeTextureCoordinate(vertex: Int, drawable: Gl2dDrawable, value: Float, min: Float, max: Float, horizontal: Boolean): Float

onPostDraw

open fun onPostDraw(drawable: GlDrawable): Unit

onPreDraw

open fun onPreDraw(drawable: GlDrawable, modelViewProjectionMatrix: FloatArray): Unit

release

open fun release(): Unit

Companion Object Properties

SIMPLE_FRAGMENT_SHADER

const val SIMPLE_FRAGMENT_SHADER: String

SIMPLE_VERTEX_SHADER

const val SIMPLE_VERTEX_SHADER: String

Extension Functions

use

fun GlBindable.use(block: () -> Unit): Unit