1
BL_Shader(PyObjectPlus)
2
=======================
6
base class --- :class:`PyObjectPlus`
8
.. class:: BL_Shader(PyObjectPlus)
10
BL_Shader GLSL shaders.
14
.. method:: setUniformfv(name, fList)
16
Set a uniform with a list of float values
18
:arg name: the uniform name
20
:arg fList: a list (2, 3 or 4 elements) of float values
21
:type fList: list[float]
23
.. method:: delSource()
25
Clear the shader. Use this method before the source is changed with :data:`setSource`.
27
.. method:: getFragmentProg()
29
Returns the fragment program.
31
:return: The fragment program.
34
.. method:: getVertexProg()
36
Get the vertex program.
38
:return: The vertex program.
43
Check if the shader is valid.
45
:return: True if the shader is valid
48
.. method:: setAttrib(enum)
50
Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
52
:arg enum: attribute location value
55
.. method:: setNumberOfPasses( max_pass )
57
Set the maximum number of passes. Not used a.t.m.
59
:arg max_pass: the maximum number of passes
60
:type max_pass: integer
62
.. method:: setSampler(name, index)
64
Set uniform texture sample index.
66
:arg name: Uniform name
68
:arg index: Texture sample index.
71
.. method:: setSource(vertexProgram, fragmentProgram)
73
Set the vertex and fragment programs
75
:arg vertexProgram: Vertex program
76
:type vertexProgram: string
77
:arg fragmentProgram: Fragment program
78
:type fragmentProgram: string
80
.. method:: setUniform1f(name, fx)
82
Set a uniform with 1 float value.
84
:arg name: the uniform name
86
:arg fx: Uniform value
89
.. method:: setUniform1i(name, ix)
91
Set a uniform with an integer value.
93
:arg name: the uniform name
95
:arg ix: the uniform value
98
.. method:: setUniform2f(name, fx, fy)
100
Set a uniform with 2 float values
102
:arg name: the uniform name
104
:arg fx: first float value
107
:arg fy: second float value
110
.. method:: setUniform2i(name, ix, iy)
112
Set a uniform with 2 integer values
114
:arg name: the uniform name
116
:arg ix: first integer value
118
:arg iy: second integer value
121
.. method:: setUniform3f(name, fx, fy, fz)
123
Set a uniform with 3 float values.
125
:arg name: the uniform name
127
:arg fx: first float value
129
:arg fy: second float value
131
:arg fz: third float value
134
.. method:: setUniform3i(name, ix, iy, iz)
136
Set a uniform with 3 integer values
138
:arg name: the uniform name
140
:arg ix: first integer value
142
:arg iy: second integer value
144
:arg iz: third integer value
147
.. method:: setUniform4f(name, fx, fy, fz, fw)
149
Set a uniform with 4 float values.
151
:arg name: the uniform name
153
:arg fx: first float value
155
:arg fy: second float value
157
:arg fz: third float value
159
:arg fw: fourth float value
162
.. method:: setUniform4i(name, ix, iy, iz, iw)
164
Set a uniform with 4 integer values
166
:arg name: the uniform name
168
:arg ix: first integer value
170
:arg iy: second integer value
172
:arg iz: third integer value
174
:arg iw: fourth integer value
177
.. method:: setUniformDef(name, type)
181
:arg name: the uniform name
183
:arg type: uniform type
184
:type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
186
.. method:: setUniformMatrix3(name, mat, transpose)
188
Set a uniform with a 3x3 matrix value
190
:arg name: the uniform name
192
:arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
193
:type mat: 3x3 matrix
194
:arg transpose: set to True to transpose the matrix
195
:type transpose: boolean
197
.. method:: setUniformMatrix4(name, mat, transpose)
199
Set a uniform with a 4x4 matrix value
201
:arg name: the uniform name
203
:arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
204
:type mat: 4x4 matrix
205
:arg transpose: set to True to transpose the matrix
206
:type transpose: boolean
208
.. method:: setUniformiv(name, iList)
210
Set a uniform with a list of integer values
212
:arg name: the uniform name
214
:arg iList: a list (2, 3 or 4 elements) of integer values
215
:type iList: list[integer]
217
.. method:: validate()
219
Validate the shader object.