VISU - PHP Game Framework

ShaderProgram
in package

This class is a wrapper for OpenGL shader programs.

You will see some duplicated code in this class. Microoptimizations are bad bla bla, but as some of the methods here are called many many times during the rendering process, squeezing our as much overhead as possible is a good idea. Obviously, PHP itself is a bottleneck here but VISU is PHP library..

Table of Contents

Properties

$id  : int
OpenGL shader ID
$fragmentShader  : ShaderStage|null
Fragment stage
$geometryShader  : ShaderStage|null
Geometry stage
$glState  : GLState
$isLinked  : bool
Linked status, to avaid calling glGetProgramiv every time
$tessControlShader  : ShaderStage|null
Tessellation control stage
$tessEvaluationShader  : ShaderStage|null
Tessellation evaluation stage
$uniformLocationMap  : array<string, int>
An array of cached uniform locations for this shader program
$vertexShader  : ShaderStage|null
Vertex stage

Methods

__construct()  : mixed
Constructor Creating a program object will also create the program in OpenGL
__destruct()  : mixed
Destructor
attach()  : void
Attaches a shader stage to the shader program
getInfoLog()  : string
Returns the shader info log (GL_INFO_LOG)
getLogLength()  : int
Returns the shader log length (GL_INFO_LOG_LENGTH)
getUniformLocation()  : int
Returns the uniform location of the given uniform name
isLinked()  : bool
Returns boolean indicating whether the program is linked (GL_LINK_STATUS)
link()  : void
Compiles all stages (if requrired) and links the program.
setUniform1f()  : void
Sets a uniform value using `glUniform1f`
setUniform1i()  : void
Sets a uniform value using `glUniform1i`
setUniform2f()  : void
Sets a uniform value using `glUniform2f`
setUniform2i()  : void
Sets a uniform value using `glUniform2i`
setUniform3f()  : void
Sets a uniform value using `glUniform3f`
setUniform3i()  : void
Sets a uniform value using `glUniform3i`
setUniform4f()  : void
Sets a uniform value using `glUniform4f`
setUniform4i()  : void
Sets a uniform value using `glUniform4i`
setUniformFloat()  : void
Sets a `float` uniform value in the shader program.
setUniformFloatArray()  : void
Sets an array of uniform float values using `glUniform1fv`
setUniformInt()  : void
Sets a `int` uniform value in the shader program.
setUniformIntArray()  : void
Sets an array of uniform int values using `glUniform1iv`
setUniformIvec2()  : void
Sets a `ivec2` uniform value in the shader program.
setUniformIvec3()  : void
Sets a `ivec3` uniform value in the shader program.
setUniformIvec4()  : void
Sets a `ivec4` uniform value in the shader program.
setUniformMat4()  : void
Sets a `vec4` uniform value in the shader program.
setUniformMatrix4f()  : void
Sets a `mat4` uniform value in the shader program.
setUniformsKV()  : void
Sets an array of uniforms using their key as the location and guessed type of the value
setUniformUintArray()  : void
Sets an array of uniform unsigned int values using `glUniform1uiv`
setUniformVec2()  : void
Sets a `vec2` uniform value in the shader program.
setUniformVec2Array()  : void
Sets an array of uniform `vec2` values using `glUniform2fv`
setUniformVec3()  : void
Sets a `vec3` uniform value in the shader program.
setUniformVec3Array()  : void
Sets an array of uniform `vec3` values using `glUniform3fv`
setUniformVec4()  : void
Sets a `vec4` uniform value in the shader program.
setUniformVec4Array()  : void
Sets an array of uniform `vec4` values using `glUniform4fv`
unsafeSetUniform1f()  : void
Sets a uniform value using `glUniform1f`, this methods is faster than using `setUniform1f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform1fv()  : void
Sets a uniform value using `glUniform1fv`, this methods is faster than using `setUniform1fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform1i()  : void
Sets a uniform value using `glUniform1i`, this methods is faster than using `setUniform1i()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform1iv()  : void
Sets a uniform value using `glUniform1iv`, this methods is faster than using `setUniform1iv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform1ui()  : void
Sets a uniform value using `glUniform1ui`, this methods is faster than using `setUniform1ui()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform1uiv()  : void
Sets a uniform value using `glUniform1uiv`, this methods is faster than using `setUniform1uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2f()  : void
Sets a uniform value using `glUniform2f`, this methods is faster than using `setUniform2f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2fv()  : void
Sets a uniform value using `glUniform2fv`, this methods is faster than using `setUniform2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2i()  : void
Sets a uniform value using `glUniform2i`, this methods is faster than using `setUniform2i()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2iv()  : void
Sets a uniform value using `glUniform2iv`, this methods is faster than using `setUniform2iv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2ui()  : void
Sets a uniform value using `glUniform2ui`, this methods is faster than using `setUniform2ui()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform2uiv()  : void
Sets a uniform value using `glUniform2uiv`, this methods is faster than using `setUniform2uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3f()  : void
Sets a uniform value using `glUniform3f`, this methods is faster than using `setUniform3f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3fv()  : void
Sets a uniform value using `glUniform3fv`, this methods is faster than using `setUniform3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3i()  : void
Sets a uniform value using `glUniform3i`, this methods is faster than using `setUniform3i()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3iv()  : void
Sets a uniform value using `glUniform3iv`, this methods is faster than using `setUniform3iv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3ui()  : void
Sets a uniform value using `glUniform3ui`, this methods is faster than using `setUniform3ui()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform3uiv()  : void
Sets a uniform value using `glUniform3uiv`, this methods is faster than using `setUniform3uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4f()  : void
Sets a uniform value using `glUniform4f`, this methods is faster than using `setUniform4f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4fv()  : void
Sets a uniform value using `glUniform4fv`, this methods is faster than using `setUniform4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4i()  : void
Sets a uniform value using `glUniform4i`, this methods is faster than using `setUniform4i()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4iv()  : void
Sets a uniform value using `glUniform4iv`, this methods is faster than using `setUniform4iv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4ui()  : void
Sets a uniform value using `glUniform4ui`, this methods is faster than using `setUniform4ui()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniform4uiv()  : void
Sets a uniform value using `glUniform4uiv`, this methods is faster than using `setUniform4uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMat4()  : void
Sets a uniform value using `glUniformMatrix4f`, this methods is faster than using `setUniformMat4()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix2fv()  : void
Sets a uniform value using `glUniformMatrix2fv`, this methods is faster than using `setUniformMatrix2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix2x3fv()  : void
Sets a uniform value using `glUniformMatrix2x3fv`, this methods is faster than using `setUniformMatrix2x3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix2x4fv()  : void
Sets a uniform value using `glUniformMatrix2x4fv`, this methods is faster than using `setUniformMatrix2x4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix3fv()  : void
Sets a uniform value using `glUniformMatrix3fv`, this methods is faster than using `setUniformMatrix3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix3x2fv()  : void
Sets a uniform value using `glUniformMatrix3x2fv`, this methods is faster than using `setUniformMatrix3x2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix3x4fv()  : void
Sets a uniform value using `glUniformMatrix3x4fv`, this methods is faster than using `setUniformMatrix3x4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix4fv()  : void
Sets a uniform value using `glUniformMatrix4fv`, this methods is faster than using `setUniformMatrix4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix4x2fv()  : void
Sets a uniform value using `glUniformMatrix4x2fv`, this methods is faster than using `setUniformMatrix4x2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformMatrix4x3fv()  : void
Sets a uniform value using `glUniformMatrix4x3fv`, this methods is faster than using `setUniformMatrix4x3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformVec2()  : void
Sets a uniform value using `glUniformVec2f`, this methods is faster than using `setUniformVec2f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformVec3()  : void
Sets a uniform value using `glUniformVec3f`, this methods is faster than using `setUniformVec3f()` because it skips a bunch of checks, this is why it is labeled unsafe.
unsafeSetUniformVec4()  : void
Sets a uniform value using `glUniformVec4f`, this methods is faster than using `setUniformVec4f()` because it skips a bunch of checks, this is why it is labeled unsafe.
use()  : void
Sets this shader program as the current program in the OpenGL context This method will check if the program is linked and if it is alreay set as the current program.
compileShaderStage()  : void
Will check if the given stage needs to be compiled and if so, will compile it and afterwards atatch it to the program

Properties

$isLinked

Linked status, to avaid calling glGetProgramiv every time

private bool $isLinked = false

$uniformLocationMap

An array of cached uniform locations for this shader program

private array<string, int> $uniformLocationMap = []

Methods

__construct()

Constructor Creating a program object will also create the program in OpenGL

public __construct(GLState $glState) : mixed
Parameters
$glState : GLState

getInfoLog()

Returns the shader info log (GL_INFO_LOG)

public getInfoLog() : string
Return values
string

getLogLength()

Returns the shader log length (GL_INFO_LOG_LENGTH)

public getLogLength() : int
Return values
int

getUniformLocation()

Returns the uniform location of the given uniform name

public getUniformLocation(string $name) : int
Parameters
$name : string
Return values
int

isLinked()

Returns boolean indicating whether the program is linked (GL_LINK_STATUS)

public isLinked() : bool
Return values
bool

Compiles all stages (if requrired) and links the program.

public link() : void

setUniform1f()

Sets a uniform value using `glUniform1f`

public setUniform1f(string $name, float $value) : void
Parameters
$name : string

The uniforms name

$value : float

setUniform1i()

Sets a uniform value using `glUniform1i`

public setUniform1i(string $name, int $value) : void
Parameters
$name : string

The uniforms name

$value : int

setUniform2f()

Sets a uniform value using `glUniform2f`

public setUniform2f(string $name, float $value1, float $value2) : void
Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float

setUniform2i()

Sets a uniform value using `glUniform2i`

public setUniform2i(string $name, int $value1, int $value2) : void
Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int

setUniform3f()

Sets a uniform value using `glUniform3f`

public setUniform3f(string $name, float $value1, float $value2, float $value3) : void
Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float
$value3 : float

setUniform3i()

Sets a uniform value using `glUniform3i`

public setUniform3i(string $name, int $value1, int $value2, int $value3) : void
Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int

setUniform4f()

Sets a uniform value using `glUniform4f`

public setUniform4f(string $name, float $value1, float $value2, float $value3, float $value4) : void
Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float
$value3 : float
$value4 : float

setUniform4i()

Sets a uniform value using `glUniform4i`

public setUniform4i(string $name, int $value1, int $value2, int $value3, int $value4) : void
Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int
$value4 : int

setUniformFloat()

Sets a `float` uniform value in the shader program.

public setUniformFloat(string $name, float $value) : void

This is identical to the method setUniform1f

Parameters
$name : string

The uniforms name

$value : float

setUniformFloatArray()

Sets an array of uniform float values using `glUniform1fv`

public setUniformFloatArray(string $name, FloatBuffer|array<string|int, float> $values) : void
Parameters
$name : string

The uniforms name

$values : FloatBuffer|array<string|int, float>

The array of values to set

setUniformInt()

Sets a `int` uniform value in the shader program.

public setUniformInt(string $name, int $value) : void

This is identical to the method setUniform1i

Parameters
$name : string

The uniforms name

$value : int

setUniformIntArray()

Sets an array of uniform int values using `glUniform1iv`

public setUniformIntArray(string $name, IntBuffer|array<string|int, int> $values) : void
Parameters
$name : string

The uniforms name

$values : IntBuffer|array<string|int, int>

The array of values to set

setUniformIvec2()

Sets a `ivec2` uniform value in the shader program.

public setUniformIvec2(string $name, int $value1, int $value2) : void

This is identical to the method setUniform2i

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int

setUniformIvec3()

Sets a `ivec3` uniform value in the shader program.

public setUniformIvec3(string $name, int $value1, int $value2, int $value3) : void

This is identical to the method setUniform3i

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int

setUniformIvec4()

Sets a `ivec4` uniform value in the shader program.

public setUniformIvec4(string $name, int $value1, int $value2, int $value3, int $value4) : void

This is identical to the method setUniform4i

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int
$value4 : int

setUniformMat4()

Sets a `vec4` uniform value in the shader program.

public setUniformMat4(string $name, bool $transpose, Mat4 $mat) : void

This is identical to the method setUniformMatrix4f

Parameters
$name : string

The uniforms name

$transpose : bool
$mat : Mat4

The matrix object to set as unfiform value

setUniformMatrix4f()

Sets a `mat4` uniform value in the shader program.

public setUniformMatrix4f(string $name, bool $transpose, Mat4 $mat) : void
Parameters
$name : string

The uniforms name

$transpose : bool
$mat : Mat4

The matrix object to set as unfiform value

setUniformsKV()

Sets an array of uniforms using their key as the location and guessed type of the value

public setUniformsKV(array<string, mixed> $uniforms) : void

Example: $program->setUniformsKV([ "u_color" => new Vec4(1.0, 0.0, 0.0, 1.0), "u_matrix" => new Mat4(), "u_time" => 1.0 "u_resolution" => new Vec2(800, 600) ]);

Parameters
$uniforms : array<string, mixed>

The uniforms to set

setUniformUintArray()

Sets an array of uniform unsigned int values using `glUniform1uiv`

public setUniformUintArray(string $name, UintBuffer|array<string|int, int> $values) : void
Parameters
$name : string

The uniforms name

$values : UintBuffer|array<string|int, int>

The array of values to set

setUniformVec2()

Sets a `vec2` uniform value in the shader program.

public setUniformVec2(string $name, Vec2 $vec) : void

This is identical to the method setUniform2f

Parameters
$name : string

The uniforms nam

$vec : Vec2

The vector object to set as unfiform value

setUniformVec2Array()

Sets an array of uniform `vec2` values using `glUniform2fv`

public setUniformVec2Array(string $name, FloatBuffer|array<string|int, float> $values) : void

Values are passed as flat array:

  • [x1, y1, x2, y2, x3, y3, x4, y4]
Parameters
$name : string

The uniforms name

$values : FloatBuffer|array<string|int, float>

The array of values to set

setUniformVec3()

Sets a `vec3` uniform value in the shader program.

public setUniformVec3(string $name, Vec3 $vec) : void

This is identical to the method setUniform3f

Parameters
$name : string

The uniforms name

$vec : Vec3

The vector object to set as unfiform value

setUniformVec3Array()

Sets an array of uniform `vec3` values using `glUniform3fv`

public setUniformVec3Array(string $name, FloatBuffer|array<string|int, float> $values) : void

Values are passed as flat array:

  • [x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4]
Parameters
$name : string

The uniforms name

$values : FloatBuffer|array<string|int, float>

The array of values to set

setUniformVec4()

Sets a `vec4` uniform value in the shader program.

public setUniformVec4(string $name, Vec4 $vec) : void

This is identical to the method setUniform4f

Parameters
$name : string

The uniforms name

$vec : Vec4

The vector object to set as unfiform value

setUniformVec4Array()

Sets an array of uniform `vec4` values using `glUniform4fv`

public setUniformVec4Array(string $name, FloatBuffer|array<string|int, float> $values) : void

Values are passed as flat array:

  • [x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4]
Parameters
$name : string

The uniforms name

$values : FloatBuffer|array<string|int, float>

The array of values to set

unsafeSetUniform1f()

Sets a uniform value using `glUniform1f`, this methods is faster than using `setUniform1f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1f(string $name, float $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : float

unsafeSetUniform1fv()

Sets a uniform value using `glUniform1fv`, this methods is faster than using `setUniform1fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1fv(string $name, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : FloatBuffer|array<string|int, float>

unsafeSetUniform1i()

Sets a uniform value using `glUniform1i`, this methods is faster than using `setUniform1i()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1i(string $name, int $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1i directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : int

unsafeSetUniform1iv()

Sets a uniform value using `glUniform1iv`, this methods is faster than using `setUniform1iv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1iv(string $name, IntBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1iv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : IntBuffer|array<string|int, int>

unsafeSetUniform1ui()

Sets a uniform value using `glUniform1ui`, this methods is faster than using `setUniform1ui()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1ui(string $name, int $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1ui directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : int

unsafeSetUniform1uiv()

Sets a uniform value using `glUniform1uiv`, this methods is faster than using `setUniform1uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform1uiv(string $name, UintBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform1uiv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : UintBuffer|array<string|int, int>

unsafeSetUniform2f()

Sets a uniform value using `glUniform2f`, this methods is faster than using `setUniform2f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2f(string $name, float $value1, float $value2) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float

unsafeSetUniform2fv()

Sets a uniform value using `glUniform2fv`, this methods is faster than using `setUniform2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2fv(string $name, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : FloatBuffer|array<string|int, float>

unsafeSetUniform2i()

Sets a uniform value using `glUniform2i`, this methods is faster than using `setUniform2i()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2i(string $name, int $value1, int $value2) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2i directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int

unsafeSetUniform2iv()

Sets a uniform value using `glUniform2iv`, this methods is faster than using `setUniform2iv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2iv(string $name, IntBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2iv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : IntBuffer|array<string|int, int>

unsafeSetUniform2ui()

Sets a uniform value using `glUniform2ui`, this methods is faster than using `setUniform2ui()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2ui(string $name, int $value1, int $value2) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2ui directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int

unsafeSetUniform2uiv()

Sets a uniform value using `glUniform2uiv`, this methods is faster than using `setUniform2uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform2uiv(string $name, UintBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform2uiv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : UintBuffer|array<string|int, int>

unsafeSetUniform3f()

Sets a uniform value using `glUniform3f`, this methods is faster than using `setUniform3f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3f(string $name, float $value1, float $value2, float $value3) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float
$value3 : float

unsafeSetUniform3fv()

Sets a uniform value using `glUniform3fv`, this methods is faster than using `setUniform3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3fv(string $name, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : FloatBuffer|array<string|int, float>

unsafeSetUniform3i()

Sets a uniform value using `glUniform3i`, this methods is faster than using `setUniform3i()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3i(string $name, int $value1, int $value2, int $value3) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3i directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int

unsafeSetUniform3iv()

Sets a uniform value using `glUniform3iv`, this methods is faster than using `setUniform3iv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3iv(string $name, IntBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3iv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : IntBuffer|array<string|int, int>

unsafeSetUniform3ui()

Sets a uniform value using `glUniform3ui`, this methods is faster than using `setUniform3ui()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3ui(string $name, int $value1, int $value2, int $value3) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3ui directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int

unsafeSetUniform3uiv()

Sets a uniform value using `glUniform3uiv`, this methods is faster than using `setUniform3uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform3uiv(string $name, UintBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform3uiv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : UintBuffer|array<string|int, int>

unsafeSetUniform4f()

Sets a uniform value using `glUniform4f`, this methods is faster than using `setUniform4f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4f(string $name, float $value1, float $value2, float $value3, float $value4) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : float
$value2 : float
$value3 : float
$value4 : float

unsafeSetUniform4fv()

Sets a uniform value using `glUniform4fv`, this methods is faster than using `setUniform4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4fv(string $name, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : FloatBuffer|array<string|int, float>

unsafeSetUniform4i()

Sets a uniform value using `glUniform4i`, this methods is faster than using `setUniform4i()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4i(string $name, int $value1, int $value2, int $value3, int $value4) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4i directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int
$value4 : int

unsafeSetUniform4iv()

Sets a uniform value using `glUniform4iv`, this methods is faster than using `setUniform4iv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4iv(string $name, IntBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4iv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : IntBuffer|array<string|int, int>

unsafeSetUniform4ui()

Sets a uniform value using `glUniform4ui`, this methods is faster than using `setUniform4ui()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4ui(string $name, int $value1, int $value2, int $value3, int $value4) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4ui directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value1 : int
$value2 : int
$value3 : int
$value4 : int

unsafeSetUniform4uiv()

Sets a uniform value using `glUniform4uiv`, this methods is faster than using `setUniform4uiv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniform4uiv(string $name, UintBuffer|array<string|int, int> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniform4uiv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : UintBuffer|array<string|int, int>

unsafeSetUniformMat4()

Sets a uniform value using `glUniformMatrix4f`, this methods is faster than using `setUniformMat4()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMat4(string $name, bool $transpose, Mat4 $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix4f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : Mat4

unsafeSetUniformMatrix2fv()

Sets a uniform value using `glUniformMatrix2fv`, this methods is faster than using `setUniformMatrix2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix2fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix2fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix2x3fv()

Sets a uniform value using `glUniformMatrix2x3fv`, this methods is faster than using `setUniformMatrix2x3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix2x3fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix2x3fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix2x4fv()

Sets a uniform value using `glUniformMatrix2x4fv`, this methods is faster than using `setUniformMatrix2x4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix2x4fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix2x4fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix3fv()

Sets a uniform value using `glUniformMatrix3fv`, this methods is faster than using `setUniformMatrix3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix3fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix3fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix3x2fv()

Sets a uniform value using `glUniformMatrix3x2fv`, this methods is faster than using `setUniformMatrix3x2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix3x2fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix3x2fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix3x4fv()

Sets a uniform value using `glUniformMatrix3x4fv`, this methods is faster than using `setUniformMatrix3x4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix3x4fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix3x4fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix4fv()

Sets a uniform value using `glUniformMatrix4fv`, this methods is faster than using `setUniformMatrix4fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix4fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix4fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix4x2fv()

Sets a uniform value using `glUniformMatrix4x2fv`, this methods is faster than using `setUniformMatrix4x2fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix4x2fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix4x2fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformMatrix4x3fv()

Sets a uniform value using `glUniformMatrix4x3fv`, this methods is faster than using `setUniformMatrix4x3fv()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformMatrix4x3fv(string $name, bool $transpose, FloatBuffer|array<string|int, float> $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformMatrix4x3fv directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$transpose : bool

Whether to transpose the matrix

$value : FloatBuffer|array<string|int, float>

unsafeSetUniformVec2()

Sets a uniform value using `glUniformVec2f`, this methods is faster than using `setUniformVec2f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformVec2(string $name, Vec2 $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformVec2f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : Vec2

unsafeSetUniformVec3()

Sets a uniform value using `glUniformVec3f`, this methods is faster than using `setUniformVec3f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformVec3(string $name, Vec3 $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformVec3f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : Vec3

unsafeSetUniformVec4()

Sets a uniform value using `glUniformVec4f`, this methods is faster than using `setUniformVec4f()` because it skips a bunch of checks, this is why it is labeled unsafe.

public unsafeSetUniformVec4(string $name, Vec4 $value) : void

If you want to eliminate more overhead store the uniform location on your own and call glUniformVec4f directly. If this turns out to still be the bottleneck you a different technique then uniforms like SSBOs

!!! This methods expects that you already bound the program using "use" !!! This methods also expects that the uniform name your are using has been binded beforehand.

Parameters
$name : string

The uniforms name

$value : Vec4

use()

Sets this shader program as the current program in the OpenGL context This method will check if the program is linked and if it is alreay set as the current program.

public use() : void
Tags
throws
ShaderProgramException

if the program is not linked

compileShaderStage()

Will check if the given stage needs to be compiled and if so, will compile it and afterwards atatch it to the program

private compileShaderStage(ShaderStage|null $shader) : void
Parameters
$shader : ShaderStage|null

        
On this page

Search results