Create a plane.
Procedurally generate a plane (or quad) mesh by specifying its size. Texture coordinates are computed automatically, with origin at the bottom left of the plane. The generated plane is perpendicular to the +Z axis, origin of the plane is at its center.
size (tuple or float) – Dimensions of the plane. If a single value is specified, the plane will be square. Provide a tuple of floats to specify the width and length of the plane (eg. size=(0.2, 1.3)).
Vertex attribute arrays (position, texture coordinates, and normals) and triangle indices.
Examples
Create a plane mesh and draw it:
vertices, textureCoords, normals, faces = gltools.createPlane()
vertexVBO = gltools.createVBO(vertices)
texCoordVBO = gltools.createVBO(textureCoords)
normalsVBO = gltools.createVBO(normals)
indexBuffer = gltools.createVBO(
faces.flatten(),
target=GL.GL_ELEMENT_ARRAY_BUFFER,
dataType=GL.GL_UNSIGNED_INT)
vao = gltools.createVAO({0: vertexVBO, 8: texCoordVBO, 2: normalsVBO},
indexBuffer=indexBuffer)
# in the rendering loop
gltools.drawVAO(vao, GL.GL_TRIANGLES)