What do you mean "it failed"? Can you post a traceback or describe how the result differs from your expectation? On Dec 12, 2016 10:34 PM, "Simon" <xinmingm...@163.com> wrote:
> Hi guys, I met a strange problem. I use pyglet building an app to simulate > fireworks. And I want to add special effects of persistence of vision. I do > not know how to do it, I just do it in my own way. Maybe you can tell me > how to do it. My problem is that I update the background > (glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)) every 3, 5, 7 frames, > it works. If I update the background every 2,4,6,8 frames, it failed. why? > > > my code is like this > > > def on_draw(self): > glViewport(0, 0, window.width, window.height) > glMatrixMode(gl.GL_PROJECTION) > glLoadIdentity() > gluPerspective(90,window.width/window.height,0.05,1000) > glMatrixMode(gl.GL_MODELVIEW) > glLoadIdentity() > gluLookAt(0.0,0.0,4.0, > 0.0,0.0,0.0, > 0.0,1.0,0.0) > if self.frame % 5 == 1: # if change > 5 to even number 4,6,8, it failed > glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) > > full code can be found here > <https://github.com/xinmingzhang/fireworks/blob/master/fireworks.py> > > And I am new to OpenGL, I also lost in setting these gl environment, like > gl.GL_PROJECTION, gl.GL_MODELVIEW etc. Sometimes I set the projection, and > I see nothing on screen. Is there any good suggestions? > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pyglet-users+unsubscr...@googlegroups.com. > To post to this group, send email to pyglet-users@googlegroups.com. > Visit this group at https://groups.google.com/group/pyglet-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.