I'm sure this is something simple that I'm missing.  In the code below I can
draw the label or I can draw the background but I can't draw them both.  It
seems that the call to glLoadIdentity() with GL_PROJECTION matrix mode keeps the
label.draw() from working.  Is there something I missed in the docs about mixing
openGL calls with pyglet's drawable objects?

Any thoughts would be appreciated,

Danny

from pyglet.gl.gl import GL_PROJECTION
from pyglet.gl.gl import glMatrixMode
from pyglet.gl.gl import glLoadIdentity
from pyglet.gl.gl import GL_QUADS
from pyglet.gl.gl import glBegin
from pyglet.gl.gl import glColor3f
from pyglet.gl.gl import glVertex2f
from pyglet.gl.gl import glEnd
import pyglet

window = pyglet.window.Window()
label = pyglet.text.Label('Hello, world',
                          font_name='Times New Roman',
                          font_size=36,
                          x=window.width//2, y=window.height//2,
                          anchor_x='center', anchor_y='center')

@window.event
def on_draw():
    draw_bg()
    label.draw()

def draw_bg():
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glBegin(GL_QUADS)
    glColor3f(1.0, 0.0, 0.0)
    glVertex2f(-1.0, 1.0)
    glVertex2f(1.0,1.0)
    glColor3f(0.0, 0.0, 1.0)
    glVertex2f(1.0,-1.0)
    glVertex2f(-1.0, -1.0)
    glEnd()

pyglet.app.run()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to