2D rendering code for OpenGL 2.1