Example #1
0
    def draw_arrays(self, mode=Unspecified, first=Unspecified, count=Unspecified, patch_vertices=Unspecified, renderer=Unspecified):
        mode = getspecified(mode, self._mode)
        first = getspecified(first, getspecified(self._first, 0))
        count = getspecified(count, getspecified(self._count, 0))
        patch_vertices = getspecified(patch_vertices, self._patch_vertices)

        if mode == GL.GL_PATCHES:
            GL.glPatchParameteri(GL.GL_PATCH_VERTICES, patch_vertices)

        GL.glDrawArrays(mode, first, count)
Example #2
0
    def draw_indices_instanced(self, instances, mode=Unspecified, first=Unspecified, count=Unspecified, patch_vertices=Unspecified, renderer=Unspecified):
        renderer.activate(self._ibo)

        _type = self._ibo.type
        _count = self._ibo.count

        mode = getspecified(mode, self._mode)
        first = getspecified(first, getspecified(self._first, 0))
        count = getspecified(count, getspecified(self._count, _count))
        patch_vertices = getspecified(patch_vertices, self._patch_vertices)

        if mode == GL.GL_PATCHES:
            GL.glPatchParameteri(GL.GL_PATCH_VERTICES, patch_vertices)

        GL.glDrawElementsInstanced(mode, count, _type.dtype.type, ctypes.c_void_p(first * _type.dtype.nbytes), instances)