'called in the middle of ondraw after the buffer has been cleared'

def draw_objects(self):

    self.create_objects()
    glPushMatrix()
    glTranslatef(0, 0, (- self.dist))
    glMultMatrixd(build_rotmatrix(self.basequat))
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.2, 0.2, 0.2, 1))
    glTranslatef(((- self.build_dimensions[3]) - (self.platform.width / 2)), ((- self.build_dimensions[4]) - (self.platform.depth / 2)), 0)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    glDisable(GL_LIGHTING)
    self.platform.draw()
    glEnable(GL_LIGHTING)
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
    inter = self.mouse_to_plane(self.mousepos[0], self.mousepos[1], plane_normal=(0, 0, 1), plane_offset=0, local_transform=False)
    if (inter is not None):
        glPushMatrix()
        glTranslatef(inter[0], inter[1], inter[2])
        glBegin(GL_TRIANGLES)
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(1, 0, 0, 1))
        glNormal3f(0, 0, 1)
        glVertex3f(2, 2, 0)
        glVertex3f((-2), 2, 0)
        glVertex3f((-2), (-2), 0)
        glVertex3f(2, (-2), 0)
        glVertex3f(2, 2, 0)
        glVertex3f((-2), (-2), 0)
        glEnd()
        glPopMatrix()
    glDisable(GL_CULL_FACE)
    glPushMatrix()
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0.3, 0.7, 0.5, 1))
    for i in self.parent.models:
        model = self.parent.models[i]
        glPushMatrix()
        glTranslatef(*model.offsets)
        glRotatef(model.rot, 0.0, 0.0, 1.0)
        glTranslatef(*model.centeroffset)
        glScalef(*model.scale)
        model.batch.draw()
        glPopMatrix()
    glPopMatrix()
    glEnable(GL_CULL_FACE)
    if self.parent.cutting:
        axis = self.parent.cutting_axis
        fixed_dist = self.parent.cutting_dist
        (dist, plane_width, plane_height) = self.get_cutting_plane(axis, fixed_dist)
        if (dist is not None):
            glPushMatrix()
            if (axis == 'x'):
                glRotatef(90, 0, 1, 0)
                glRotatef(90, 0, 0, 1)
                glTranslatef(0, 0, dist)
            elif (axis == 'y'):
                glRotatef(90, 1, 0, 0)
                glTranslatef(0, 0, (- dist))
            elif (axis == 'z'):
                glTranslatef(0, 0, dist)
            glDisable(GL_CULL_FACE)
            glBegin(GL_TRIANGLES)
            glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0, 0.9, 0.15, 0.3))
            glNormal3f(0, 0, self.parent.cutting_direction)
            glVertex3f(plane_width, plane_height, 0)
            glVertex3f(0, plane_height, 0)
            glVertex3f(0, 0, 0)
            glVertex3f(plane_width, 0, 0)
            glVertex3f(plane_width, plane_height, 0)
            glVertex3f(0, 0, 0)
            glEnd()
            glEnable(GL_CULL_FACE)
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
            glEnable(GL_LINE_SMOOTH)
            orig_linewidth = GLfloat()
            glGetFloatv(GL_LINE_WIDTH, orig_linewidth)
            glLineWidth(4.0)
            glBegin(GL_LINE_LOOP)
            glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vec(0, 0.8, 0.15, 1))
            glVertex3f(0, 0, 0)
            glVertex3f(0, plane_height, 0)
            glVertex3f(plane_width, plane_height, 0)
            glVertex3f(plane_width, 0, 0)
            glEnd()
            glLineWidth(orig_linewidth)
            glDisable(GL_LINE_SMOOTH)
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
            glPopMatrix()
    glPopMatrix()
