library / com.otaliastudios.opengl.program / GlProgram

GlProgram

abstract class GlProgram

Base class for a program that accepts a vertex and a fragment shader in the constructor. The program will be created automatically and released when release is called.

Subclasses are required to do two things - typically, during the onPreDraw callback: 1 Inspect the GlDrawable properties:

The vertex shader should then use the two to compute the gl_Position.

Constructors

<init>

GlProgram(vertexShader: String, fragmentShader: String)
GlProgram(handle: Int)GlProgram(handle: Int, ownsHandle: Boolean)

Base class for a program that accepts a vertex and a fragment shader in the constructor. The program will be created automatically and released when release is called.

Properties

handle

val handle: Int

Functions

draw

fun draw(drawable: GlDrawable, modelViewProjectionMatrix: FloatArray = drawable.modelMatrix): Unit

getAttribHandle

fun getAttribHandle(name: String): GlProgramLocation

getUniformHandle

fun getUniformHandle(name: String): GlProgramLocation

onDraw

open fun onDraw(drawable: GlDrawable): Unit

onPostDraw

open fun onPostDraw(drawable: GlDrawable): Unit

onPreDraw

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

release

open fun release(): Unit

Companion Object Functions

create

fun create(vertexShaderSource: String, fragmentShaderSource: String): Int

Inheritors

GlFlatProgram

open class GlFlatProgram : GlProgram

An GlProgram that uses basic flat-shading rendering, based on FlatShadedProgram from grafika.

GlTextureProgram

open class GlTextureProgram : GlProgram

Base implementation for a GlProgram that draws textures.