Lua GLSL Api: Difference between revisions

From Spring
Jump to navigationJump to search
JK (talk | contribs)
New page: <font color="red">All this functions are ONLY available if the the graphic board supports GLSL.</font><br> <font color="green">So test in your scripts if one of them exists before your use...
 
JK (talk | contribs)
mNo edit summary
Line 1: Line 1:
<font color="red">All this functions are ONLY available if the the graphic board supports GLSL.</font><br>
<font color="red" style="font-size:150%">All this functions are ONLY available if the graphic board supports GLSL.</font>
<font color="green">So test in your scripts if one of them exists before your use them!</font>
 
<font color="green" style="font-size:150%">So test in your scripts if one of them exists before your use them!</font>
 


'''CreateShader'''
'''CreateShader'''

Revision as of 15:06, 11 August 2007

All this functions are ONLY available if the graphic board supports GLSL.

So test in your scripts if one of them exists before your use them!


CreateShader

 ( [ vertex   = "glsl code" ],
   [ fragment = "glsl code" ],
   [ uniform       = { uniformName = number value, ...} ],
   [ uniformInt    = { uniformName = number value, ...} ],
   [ uniformMatrix = { uniformName = number value, ...} ]
 ) -> number shaderID

DeleteShader

 (number shaderID) -> nil

UseShader

 (number shaderID) -> boolean linked

GetShaderLog

 () -> string "errorLog"


GetActiveUniforms

 (number shaderID) -> { 
     [1] = { name = "name", type = "type", length = number length, size = number size },
     ...
   }

GetUniformLocation

 (number shaderID, name uniformName) -> number locationID

Uniform

 (number locationID, number float1 [,number float2 [,number float3 [,number float4]]] ) -> nil

UniformInt

 (number locationID, number int1 [,number int2 [,number int3 [,number int4]]] ) -> nil

UniformMatrix

 (number locationID, 
  "shadow" |
  "camera" |
  "caminv" |
  "camprj" |
  number m1, number m2, number m3, number m4 |
  number m1, ... , number m9 |
  number m1, ... , number m16
 ) -> nil