[ Back to Geeks3D.com ]
 GeeXLab
Laboratory for Real Time 3D Programming (prototyping and demos) OpenGL, Lua, Python, GLSL, PhysX and more...Reference Guide Host-API Lua / Python
» Back to Homepage
» Back to Developer's Guide Index
HYP_GPUShader Library
Real time shader library
Number of functions: 17
HYP_GPUShader.GetId
Returns the shader object id from its name (declared in XML).
: Lua - Python
name [STRING]: shader name.
id [INTEGER]: shader id
:
id = HYP_GPUShader.GetId("simpleShader")
HYP_GPUShader.Create
Creates a new shader object.
: Lua - Python
id [INTEGER]: shader id
:
id = HYP_GPUShader.Create()
HYP_GPUShader.Destroy
Destroys an existing shader object.
: Lua - Python
id [INTEGER]: shader id
:
HYP_GPUShader.Destroy(id)
HYP_GPUShader.CreateFromFile
Creates a new shader object from a source code file.
: Lua - Python
filename [STRING]: shader source code file. Currently only GLSL shaders are supported.
absolutePath [INTEGER]: filename is specified by an absolute path (1) or a relative path (0).
id [INTEGER]: shader id
:
id = HYP_GPUShader.CreateFromFile("data/myGlslShader.glsl", 0)
HYP_GPUShader.UpdateSourceCode
Creates a new shader object from a source code file.
: Lua - Python
id [INTEGER]: shader id
sourceCode [STRING]: shader source code buffer. Currently only GLSL shaders are supported.
:
id = HYP_GPUShader.Create()
HYP_GPUShader.UpdateSourceCode(id, shaderBuffer)
HYP_GPUShader.Activate
Links if necessary and binds the shader (sets this shader active at the level of the renderer). This function is useful in post direct rendering scripts.
: Lua
id [INTEGER]: shader id
:
HYP_GPUShader.Activate(id)
HYP_GPUShader.Deactivate
Unbinds the shader.
: Lua
id [INTEGER]: shader id
:
HYP_GPUShader.Deactivate(id)
HYP_GPUShader.GetOpenGLId
Gets the OpenGL shader name or ID. This function is useful in post direct rendering scripts with HYP_Renderer.GPUShaderxxxxxx() functions.
: Lua - Python
id [INTEGER]: shader id
glId [INTEGER]: OpenGL shader name
:
glId = HYP_GPUShader.GetOpenGLId(id)
HYP_GPUShader.SetConstant_1i
Specifies the name and the value of a 1D vector of integers constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [INTEGER]: x componant of the vector.
:
HYP_GPUShader.SetConstant_1i(id, "varX", x)
HYP_GPUShader.SetConstant_2i
Specifies the name and the value of a 2D vector of integers constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [INTEGER]: x componant of the vector.
y [INTEGER]: y componant of the vector.
:
HYP_GPUShader.SetConstant_2i(id, "varXY", x, y)
HYP_GPUShader.SetConstant_3i
Specifies the name and the value of a 3D vector of integers constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [INTEGER]: x componant of the vector.
y [INTEGER]: y componant of the vector.
z [INTEGER]: z componant of the vector.
:
HYP_GPUShader.SetConstant_3i(id, "varXYZ", x, y, z)
HYP_GPUShader.SetConstant_4i
Specifies the name and the value of a 4D vector of integers constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [INTEGER]: x componant of the vector.
y [INTEGER]: y componant of the vector.
z [INTEGER]: z componant of the vector.
w [INTEGER]: w componant of the vector.
:
HYP_GPUShader.SetConstant_4i(id, "varXYZW", x, y, z, w)
HYP_GPUShader.SetConstant_1f
Specifies the name and the value of a 1D vector of reals constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [REAL]: x componant of the vector.
:
elapsedTime = HYP_Utils.GetElapsedTime() * 0.001
HYP_GPUShader.SetConstant_1f(id, "time", elapsedTime)
HYP_GPUShader.SetConstant_2f
Specifies the name and the value of a 2D vector of reals constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [REAL]: x componant of the vector.
y [REAL]: y componant of the vector.
:
HYP_GPUShader.SetConstant_2f(id, "texCoord", u, v)
HYP_GPUShader.SetConstant_3f
Specifies the name and the value of a 4D vector of reals constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [REAL]: x componant of the vector.
y [REAL]: y componant of the vector.
z [REAL]: z componant of the vector.
:
HYP_GPUShader.SetConstant_4f(id, "position", x, y, z)
HYP_GPUShader.SetConstant_4f
Specifies the name and the value of a 4D vector of reals constant to pass to the shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
x [REAL]: x componant of the vector.
y [REAL]: y componant of the vector.
z [REAL]: z componant of the vector.
w [REAL]: w componant of the vector.
:
HYP_GPUShader.SetConstant_4f(id, "varXYZW", x, y, z, w)
HYP_GPUShader.SetConstant_4x4f
Specifies the value of a 4x4 matrix uniform variable of a shader. The name of this constant must be declared in the source code of the shader.
: Lua - Python
id [INTEGER]: name of the constant (or uniform) variable
name [STRING]: shader id
m0, ..., m15 [REAL]: 16 values of the 4x4 matrix in OpenGL conventions
:
HYP_GPUShader.SetConstant_4x4f(id, "viewMat", m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15)
|