rect()

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

rect(x, y, width, height)
rect(x, y, z, width, height)
  • x, y, z ... coordinates of the rectangle's center
  • width, height ... of the rectangle

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

In Context

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