INNER CODE UNIT · Python

TriangleExample

mosra/magnum-examples · src/python/magnum-triangle.py:39

class TriangleExample(Application):
    def __init__(self):
        Application.__init__(self, self.Configuration(
            title="Magnum Python Triangle Example"
        ))

        buffer = gl.Buffer()
        buffer.set_data(array.array('f', [
            -0.5, -0.5, 1.0, 0.0, 0.0,
             0.5, -0.5, 0.0, 1.0, 0.0,
             0.0,  0.5, 0.0, 0.0, 1.0
        ]))

        self._mesh = gl.Mesh()
        self._mesh.count = 3
        self._mesh.add_vertex_buffer(buffer, 0, 5*4,
            shaders.VertexColorGL2D.POSITION)
        self._mesh.add_vertex_buffer(buffer, 2*4, 5*4,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…