Howdy, folks. I'm pretty new to Pyglet, and an OpenGL novice as well, so I hope you'll cut me a lot of slack when I mangle the lingo. I'll catch on eventually, I promise. =)
I hope someone can help with a mystery that I've been banging away at for a few days. My efforts at search/RTFM/module diving/experiments have been fruitless thus far. I reduced the problem to what I hope an easily digestible demo: batch_vs_gl.zip. Pyglet 1.1.4.128, OpenGL 2.1, PyOpenGL 3, Python 2.6. The nature of the problem is this. The demo starts out rendering some stars as sprite points. This works fine. A mouse click pops up a SimpleMenu (thanks, Mr. Jones) which is rendered via a Pyglet batch in its draw() method. When the batch is executed, it appears to change some GL texturing settings, as evidenced by an immediate change in the appearance of the stars (they get larger and the texture background becomes opaque). Commenting the call to menu.draw() makes the rendering issue go away. Also, this is not specific to SimpleMenu. I tried another module that batches its rendering and the demo has the same issue. In a different demo I was able to observe that batch.draw() indeed disables (GL_DEPTH_TEST, GL_CULL_FACE, GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T), and if I re-enable them after menu.draw() the demo works according to plan. But in the point-sprite demo I am at a loss for identifying what settings are being changed (I even brute-force checked the entire lot with glIsEnabled()). So as a workaround I kludged rerunning the point-sprite initialization each time the menu is drawn. I imagine this is a common thing: drawing the world in 3D then switching to Ortho for the GUI. Ideally I would like to have a draw-GUI routine that works in most, if not all, situations without the overhead of a ton of GL save-n-restore calls, and doing it differently for each implementation. Is this a realistic expectation? Hopefully one of you already has experience with this and can give me some pointers. Thanks in advance for your kind consideration. :) Gumm -- 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.
