line()

Draws a line in space. This is a high level alternative to using OpenGL calls directly. Line width and color are set with glLineWidth() glColor4f(), respectively.

line(x1, y1, x2, y2)
line(x1, y1, z1, x2, y2, z2)
  • x1, y1, z1 ... coordinates of the start point
  • x2, y2, z2 ... coordinates of the start end

Relevant examples: shape2D.py , shape3D.py , points.py , curve.py , line.py , ALL

In Context

def onDraw(self):
    line(-1, 0, -0.5, 1, 0, 0)
def onDraw(self):
    glColor4f(1.0, 0.5, 0.5, 1.0)
    glLineWidth(2)
    line(-1, 0, -0.5, 1, 0, 0)
def onDrawOrtho(self):
    line(200, 50, 300, 50)
Initiated by Stephan Hechenberger
Thanks to CADRE's 103