"No one can be told what GeeXLab is, you have to see it for yourself!"

"Stop Playing Games and Start Making Them! With GeeXLab, your are on your way!"


Quick Links
What is GeeXLab
Download GeeXLab
GeeXLab Requirements
Online Help
Articles and Tutorials
Samples Screenshots
Videos

GeeXLab Changelog

XML Ref. Guide
Scripting Ref. Guide
Code Samples

Purchase GeeXLab
GeeXLab SDK

Shader Library

Follow GeeXLab's News
GeeXLab news, articles, tutorials and demos @ Geeks3D.com
GeeXLab @ Twitter GeeXLab RSS Feed

Subscribe to GeeXLab news by email

[ Back to Geeks3D.com ]

GeeXLab

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


Description
Real time shader library

Number of functions: 17

HYP_GPUShader.GetId

Description
Returns the shader object id from its name (declared in XML).

Languages: Lua - Python

Parameters
  • name [STRING]: shader name.

    Return Values
  • id [INTEGER]: shader id

    Code sample :

    id = HYP_GPUShader.GetId("simpleShader")


    HYP_GPUShader.Create

    Description
    Creates a new shader object.

    Languages: Lua - Python

    Return Values
  • id [INTEGER]: shader id

    Code sample :

    id = HYP_GPUShader.Create()


    HYP_GPUShader.Destroy

    Description
    Destroys an existing shader object.

    Languages: Lua - Python

    Parameters
  • id [INTEGER]: shader id

    Code sample :

    HYP_GPUShader.Destroy(id)


    HYP_GPUShader.CreateFromFile

    Description
    Creates a new shader object from a source code file.

    Languages: Lua - Python

    Parameters
  • 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).

    Return Values
  • id [INTEGER]: shader id

    Code sample :

    id = HYP_GPUShader.CreateFromFile("data/myGlslShader.glsl", 0)


    HYP_GPUShader.UpdateSourceCode

    Description
    Creates a new shader object from a source code file.

    Languages: Lua - Python

    Parameters
  • id [INTEGER]: shader id
  • sourceCode [STRING]: shader source code buffer. Currently only GLSL shaders are supported.

    Code sample :

    id = HYP_GPUShader.Create()
    HYP_GPUShader.UpdateSourceCode(id, shaderBuffer)


    HYP_GPUShader.Activate

    Description
    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.

    Languages: Lua

    Parameters
  • id [INTEGER]: shader id

    Code sample :

    HYP_GPUShader.Activate(id)


    HYP_GPUShader.Deactivate

    Description
    Unbinds the shader.

    Languages: Lua

    Parameters
  • id [INTEGER]: shader id

    Code sample :

    HYP_GPUShader.Deactivate(id)


    HYP_GPUShader.GetOpenGLId

    Description
    Gets the OpenGL shader name or ID. This function is useful in post direct rendering scripts with HYP_Renderer.GPUShaderxxxxxx() functions.

    Languages: Lua - Python

    Parameters
  • id [INTEGER]: shader id

    Return Values
  • glId [INTEGER]: OpenGL shader name

    Code sample :

    glId = HYP_GPUShader.GetOpenGLId(id)


    HYP_GPUShader.SetConstant_1i

    Description
    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.

    Languages: Lua - Python

    Parameters
  • id [INTEGER]: name of the constant (or uniform) variable
  • name [STRING]: shader id
  • x [INTEGER]: x componant of the vector.

    Code sample :

    HYP_GPUShader.SetConstant_1i(id, "varX", x)


    HYP_GPUShader.SetConstant_2i

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_2i(id, "varXY", x, y)


    HYP_GPUShader.SetConstant_3i

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_3i(id, "varXYZ", x, y, z)


    HYP_GPUShader.SetConstant_4i

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_4i(id, "varXYZW", x, y, z, w)


    HYP_GPUShader.SetConstant_1f

    Description
    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.

    Languages: Lua - Python

    Parameters
  • id [INTEGER]: name of the constant (or uniform) variable
  • name [STRING]: shader id
  • x [REAL]: x componant of the vector.

    Code sample :

    elapsedTime = HYP_Utils.GetElapsedTime() * 0.001
    HYP_GPUShader.SetConstant_1f(id, "time", elapsedTime)


    HYP_GPUShader.SetConstant_2f

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_2f(id, "texCoord", u, v)


    HYP_GPUShader.SetConstant_3f

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_4f(id, "position", x, y, z)


    HYP_GPUShader.SetConstant_4f

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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.

    Code sample :

    HYP_GPUShader.SetConstant_4f(id, "varXYZW", x, y, z, w)


    HYP_GPUShader.SetConstant_4x4f

    Description
    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.

    Languages: Lua - Python

    Parameters
  • 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

    Code sample :

    HYP_GPUShader.SetConstant_4x4f(id, "viewMat", m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15)




  • Random Projects

    Phong Lighting Multiple Lights
    Phong Lighting Multiple Lights

    Dream Vision Effect
    Dream Vision Effect

    Phong Lighting Multiple Lights
    Phong Lighting Multiple Lights


    Random Code Samples

    Python - Hello World
    Python - Hello World

    3D fonts
    3D fonts

    DirectX Format Loading
    DirectX Format Loading



    (C)2009-2010 Geeks3D.com