Convenience class for rendering pipelines.
Vertex attributes can be set to buffer objects or anything that can be
converted to an ArrayBuffer
.
Shader uniforms behave as usual.
Fragment outputs can be set to texture objects.
Attention:
In order to guarantee correct functioning of vertex attribute,
uniform and fragment output variables, their names must be unique,
must not begin with an underscore, and must not collide with the
names of any vertex array or framebuffer methods.
Usage examples:
>>> shader = ShaderProgram(...)
>>> vertices = [...]
>>> colors = [...]
>>> elements = [...]
>>> texture = Texture2D(...)
>>> pipeline = Pipeline(shader, in_position=vertices, in_color=colors, elements=elements, out_color=texture)
>>> pipeline.clear()
>>> pipeline.draw()
>>> pipeline = Pipeline(shader, use_framebuffer=False)
>>> with pipeline(in_position=vertices, in_color=colors, elements=elements):
... pipeline.draw()
>>> with pipeline(in_position=vertices, in_color=colors, elements=elements) as p:
... p.draw()
>>> pipeline.draw_with(in_position=vertices, in_color=colors, elements=elements)
>>> pipeline = Pipeline(shader, use_framebuffer=False)
>>> vertex_array = VertexArray(...)
>>> with pipeline:
... vertex_array.draw()
|
|
|
_has_input(self,
name)
Determine whether the shader as an attribute named name . |
source code
|
|
|
_add_input(self,
name,
value=None)
Add a proxy for the attribute named name . |
source code
|
|
|
_has_output(self,
name)
Determine whether the shader as a fragment output named
name . |
source code
|
|
|
_add_output(self,
name,
value)
Add a proxy for the fragment output named name . |
source code
|
|
|
|
|
|
|
__enter__(self)
Bind framebuffer and shader. |
source code
|
|
|
__exit__(self,
type,
value,
traceback)
Unbind framebuffer and shader. |
source code
|
|
|
|
Inherited from utils.proxy.InstanceDescriptorMixin :
__getattribute__
Inherited from utils.objects.StateMixin :
__call__
Inherited from object :
__format__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|