Shader

open class Shader(vertexFile: String, fragmentFile: String)

Shaders can be used to transform the image that is being drawn. There are multiple types of shaders. So far vertex and fragment shaders are supported. The vertex shader acts on all the vertices that are being drawn and allows to modify those. The fragment shader acts on the pixels that are being drawn and can be used to adjust the color of those.

This class offers a framework to use those shaders. The shader code itself has to be written in GLSL and placed in the resources package. You will always need both a vertex adn a fragment shader. To use a shader program it first has to be compiled and register on the GPU. All of that is automatically done for you simply by creating an instance of this class. The best way to do this is to create an object that inherits from this class. It is recommended that you do that in an object file within ./impl/ .

To then use the shader (let's call it SomeShader) simply invoke SomeShader.useShader() before rendering and SomeShader.stopShader() after rendering the part that should be affected.

See also

Constructors

Link copied to clipboard
fun Shader(name: String)
Link copied to clipboard
fun Shader(vertexFile: String, fragmentFile: String)

Functions

Link copied to clipboard

Deactivates this shader by setting the current gl program to 0.

Link copied to clipboard

Deletes this Program from the GPU Memory.

Link copied to clipboard
fun useShader()

Activates this shader.

Properties

Link copied to clipboard

Inheritors

Link copied to clipboard