I have the same problem under Ubuntu though the same code works nice under Arch Linux and Windows on the same machine. If you use Ubuntu it is likely to be another Ubuntu-specific bug.
2012/3/15 Andreas <[email protected]> > Hi, > > I'm trying to learn pyglet, and I've taken some simple code from [1] > and modified it by basically only adding an "update()" function. No > matter what I actually do in the "update()" function, the program will > always freeze after a random number of iterations. Why is that? Is > there something special about the "update()" function that I need to > consider? If I run the code with the python debugger "python -m pdb > myscript.py" and set a break point in the "update()" function, then > program doesn't freeze. If I delete the break point and let the > program continue it will freeze again eventually. Once the program > freezes in "Pdb" mode, I can not retrieve a traceback. > > And here's the code: > > import pyglet > from pyglet.gl import * > from ctypes import pointer, sizeof > > def triangles_v2f(scale): > if scale < 1.0: > return [] > else: > data = triangles_v2f(scale / 2.0) > data.extend([ > 100 + scale, 100, > 100 + scale, 100 + scale, > 100, 100 + scale, > ]) > return data > > vbo_id = GLuint() > > glGenBuffers(1, pointer(vbo_id)) > > v2f = triangles_v2f(200) > data = (GLfloat*len(v2f))(*v2f) > > glBindBuffer(GL_ARRAY_BUFFER, vbo_id) > glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW) > > window = pyglet.window.Window(width=400, height=400) > fps_display = pyglet.clock.ClockDisplay() > glClearColor(0.2, 0.4, 0.5, 1.0) > glEnableClientState(GL_VERTEX_ARRAY) > > > counter = 0; > def update(dt): > global counter > counter += 1 > # print counter > pyglet.clock.schedule_interval(update, 1.0/60.0) > > > @window.event > def on_draw(): > glClear(GL_COLOR_BUFFER_BIT) > > glColor3f(0, 0, 0) > > glBindBuffer(GL_ARRAY_BUFFER, vbo_id) > glVertexPointer(2, GL_FLOAT, 0, 0) > > glDrawArrays(GL_TRIANGLES, 0, len(v2f)/2) > fps_display.draw() > > > pyglet.app.run() > > > any pointers on how to track down and fix this problem are greatly > appreciated! > cheers, > andreas > > ps: I am using a recent version of pyglet 1.2dev on a linux machine > [1]: https://sites.google.com/site/swinesmallpygletexamples/vbo-triangle > > -- > 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. > > -- 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.
