title: Python: pyglet vs PyOpengl performance evaluation for frame dropping
body: <p>I have to evaluate the performance/functionality of Pyopengl vs Pyglet. The main concern is that it can't drop any frame while using high FPS. Before I start learning one of then, I need to see if it can do what the client needs.</p>
  
  <p>I am trying to alternate (on vsync) between red and green (in fullscreen mode). If anybody can give me a good tutorial site, or help me with an example, it would be very nice.</p>
  
  <p>I have looked at this post (and more):
  <a href="https://stackoverflow.com/questions/10583701/fps-with-pyglet-half-of-monitor-refresh-rate">FPS with Pyglet half of monitor refresh rate</a></p>
  
  <p>Made a modification, but can't see how to switch from one color to another one on Vsync.</p>
  
  <pre><code>import pyglet
  from pyglet.gl import *
  
  
  fps = pyglet.clock.ClockDisplay()
  
  # The game window
  class Window(pyglet.window.Window):
      def __init__(self):
          super(Window, self).__init__(fullscreen=True, vsync = False)
          self.flipScreen = 0
          glClearColor(1.0, 1.0, 1.0, 1.0)
          # Run "self.update" 128 frames a second and set FPS limit to 128.
          pyglet.clock.schedule_interval(self.update, 1.0/128.0)
          pyglet.clock.set_fps_limit(128)
  
  
  def update(self, dt):
      self.flipScreen = not self.flipScreen
      pass
  
  def on_draw(self):
      pyglet.clock.tick() # Make sure you tick the clock!
      if self.flipScreen == 0:
          glClearColor(0, 1, 0, 1.0)
      else:
          glClearColor(1, 0, 0, 1.0)
      self.clear()
      fps.draw()
  
  # Create a window and run
  win = Window()
  pyglet.app.run()
  </code></pre>
  
  <p>I have seen a lot of tutorials, but I haven't been able to understand how to run this one test.</p>
  
  <p>Thanks for your help.</p>