mesh
FreeBodyEngine.graphics.webgl.mesh
#
WebGL2Mesh(attributes, indices=None, primitive=None, index_type=None, usage=None)
#
Bases: Mesh
The WebGL2 implementation of Mesh - see GLMesh's own docstring, same
shape: one real VAO, one VBO per vertex attribute, an optional EBO for
indexed drawing. WebGL2 (unlike WebGL1) has native createVertexArray/
bindVertexArray, so this needs no OES_vertex_array_object shim.
ebo = gl.createBuffer() if indices is not None else None
instance-attribute
#
gl = get_service('renderer').gl
instance-attribute
#
vao = gl.createVertexArray()
instance-attribute
#
vbos = {}
instance-attribute
#
destroy()
#
Deletes every attribute VBO, the EBO if this mesh has one, and the VAO itself.
draw()
#
Issues the draw call - drawElements against the EBO if this
mesh has indices, else drawArrays (same non-indexed vertex-count
assumption GLMesh.draw() makes: the first attribute is a 3-wide
channel).
upload()
#
(Re)creates one VBO per entry in self.attributes and uploads
its data, wiring each up as a sequential vertex attribute starting
at location 0, in the same declaration order GLMesh.upload() uses
- see its own docstring for why that order matters.