On 8 July 2011 01:38, Bruce Smith <[email protected]> wrote: > On Tue, Jul 5, 2011 at 8:49 PM, Joseph Marlin > <[email protected]>wrote: > >> This seems like it would be a common problem for beginners, but I couldn't >> find anything on the topic. >> >> I start off drawing a nice background: >> def on_draw(): >> bg.blit_tiled(map_bottom_left[0], map_bottom_left[1], 0, map_width, >> map_height) >> http://i.imgur.com/kMhK6.png >> >> I can then add in kytten, which I finally convinced to work. That is drawn >> using a batch: >> def on_draw(): >> bg.blit_tiled(map_bottom_left[0], map_bottom_left[1], 0, map_width, >> map_height) >> batch.draw() >> That also works nicely: http://i.imgur.com/4wUtl.png >> >> However, as soon as I draw a sprite, the background image gets very dark. >> Strangely, the menu does not: >> def on_draw(): >> bg.blit_tiled(map_bottom_left[0], map_bottom_left[1], 0, map_width, >> map_height) >> sprite.draw() >> batch.draw() >> http://i.imgur.com/7jmIU.png >> In the image, the background might look like it is black, but it is >> actually just darkened quite a bit. I don't know why it is darkening. The >> sprites show up normally colored, as does the menu, as you can see. >> >> Any ideas? >> Thanks! >> >> No specific ideas, but this sort of bug in OpenGL code often means that > the newly-added call (in this case sprite.draw()) is changing some OpenGL > state without saving it and restoring it. I don't know a shortcut to find > out *which* state except reading its code and/or guessing. > > - Bruce Smith > > -- > 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. >
I've looked into TileableTexture and Sprite, and the only thing that strikes me as odd is that Sprite activates GL_BLEND, then sets its own function, but doesn't return to what it was before-hand. Try adding 'from pyglet.gl import *' at the top of your code, then doing 'glDisable(GL_BLEND)' before the blit_tiled call. -- 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.
