'Draws a triangle using current transform.
:param position0: First vertex position.
:type QVector3D
:param position1: Second vertex position.
:type QVector3D
:param position2: Third vertex position.
:type QVector3D
:param color0: First vertex color.
:type QColor
:param color1: Second vertex color.
:type QColor
:param color2: Third vertex color.
:type QColor
:param color: A convenience parameter: Overrides color values.
:type QColor'

def draw_triangle(self, position0, position1, position2, color0=QColor(0, 0, 0), color1=QColor(0, 0, 0), color2=QColor(0, 0, 0), color=None):

    if color:
        colors = ([color.redF(), color.greenF(), color.blueF(), color.alphaF()] * 3)
    else:
        colors = [color0.redF(), color0.greenF(), color0.blueF(), color0.alphaF(), color1.redF(), color1.greenF(), color1.blueF(), color1.alphaF(), color2.redF(), color2.greenF(), color2.blueF(), color2.alphaF()]
    positions = [position0.x(), position0.y(), position0.z(), position1.x(), position1.y(), position1.z(), position2.x(), position2.y(), position2.z()]
    self._shader.bind()
    glUniform4fv(glGetUniformLocation(self._shader.programId(), 'colors'), (len(colors) / 4), numpy.array(colors, numpy.float32))
    glUniform3fv(glGetUniformLocation(self._shader.programId(), 'positions'), (len(positions) / 3), numpy.array(positions, numpy.float32))
    self._vertex_buffer.draw(GL_TRIANGLES, 0, 3)
    self._shader.release()
