On Sun, May 3, 2009 at 9:16 AM, George Oliver <[email protected]> wrote: > > I'm having trouble debugging a crash and I'm hoping someone here has a > clue what's going on. > > The problem is that the game just freezes up, so I'm not getting a > traceback or anything, and I can't quite figure out how to use pdb or > other modules to analyze my program at the point where it freezes > (i.e., just trying pdb.set_trace() doesn't let me inspect the stack at > the moment where things freeze). > > If anyone has suggestions on debugging tools that'd be great, > otherwise here is the code in error: > > for other in things.others: > if (((self.x-self.width//2) < other.x < (self.x > +self.width//2)) and > ((self.y-self.height//2) < other.y < (self.y > +self.height//2))): > x = int(other.x) > y = int(other.y) > vertex_list = batch.add(4, pyglet.gl.GL_QUADS, > layer_2, > ('v2i', (x, y, x+8, y, x+8, y+8, x, y+8)), > ('c3B', (255, 0, 0, 255, 0, 0, 255, 0, 0, > 255, 0, 0))) > > here is a pastebin link to that in case it's mangled: > http://pastebin.com/m108e579e > > This for loop draws the quads whenever the player presses the x key. > It checks first if the 'other' sprite is contained within the player, > and if so it draws the quads based on the other's position. The freeze > up happens when (as far as I can figure out) the player presses x and > moves with the arrow keys. > > If batch.add() is called 'too fast' could this be the problem? What am > I doing wrong here? > > Here is the complete source if anyone wants to try this out > themselves: http://media.pyweek.org/dl/8/georgek/open_src_r1.tar.gz > > > Thanks for any help.
I just had a quick play -- very neat presentation btw -- and didn't get a crash, but if I hold down X and arrow keys at the same time I can "draw" the little dots all over the screen, which I don't think is what you intended. I believe this is because you're adding sprites to a batch repeatedly, when all you want to do (I'm guessing) is draw them and then throw them away. pyglet.graphics.vertex_list() may be what you're after. I'd take a guess and say that your specific video hardware is causing the hang, due to the vertex buffer being either too large (due to this bug) or being modified while being drawn (I've seen ATI cards with this issue). If I've missed the mark on this let me know and I'll look at the code. Alex. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
