MakeOpenglDrawIn2D — wiki
make opengl behave like you are drawing in 2d.
def glEnable2D():
""" make opengl behave like you are drawing in 2d.
"""
vPort = glGetIntegerv(GL_VIEWPORT)
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
glOrtho(0, vPort[2], 0, vPort[3], -1, 1)
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()
def glDisable2D():
""" Use when you've finished drawing in 2D.
"""
glMatrixMode(GL_PROJECTION)
glPopMatrix()
glMatrixMode(GL_MODELVIEW)
glPopMatrix()