onDrawOrtho()

One of two event handler methods that get called by the main loop to redraw the world. Shapes that are drawn from this method are placed in 3D, orthographic space. In orthographic space the x-y picture plane always faces the camera and placement on the z-axis does not affect size. To some extent this corresponds to 2D space and 2D shapes are usually drawn with this method because it allows for pixel-exact positioning. The frequency by which it gets called depends on the value that is assigned to <world>.fps. The default frequency is 40 times per second.

Relevant examples: hello_world.py , curve.py , tag.py

In Context

In the World

class Atlantis(World):
    def onDrawOrtho(self):
        line(30, 50, 200, 50)
class Atlantis(World):
    def onDraw(self):
        glBegin(GL_LINES)
        glVertex2f(10, 200)
        glVertex2f(10, 50)
        glEnd()

In a Tag: Tags are generally drawn in orthographic space.

class Line(Tag):
    def onDraw(self):
        line(30, 50, 200, 50)
Initiated by Stephan Hechenberger
Thanks to CADRE's 103