opengl - Pyglet: Unstable fps when using Vsync... and no other software -
i using pyopengl , pyglet simple application. using vsync swap buffers @ 120 hz. here problem. when run many applications outlook, chrome, notepad++, dora's great adventure on background, fps steady enough @ 120hz. but, when turn off applications, fps goes 114hz 125hz !?!?
i thought closing applications in fact improve fps, no. application out of sync. thought fps given pyglet stick between 119 & 121.
can me figure out? not seeing obvious stuff?
here code
def on_draw(dt): cnt screenswap left = true right = false rval = 0.0/255.0 gval = 153.0/255.0 bval = 0.0/255.0 shapeposition(speed = 0.25) glclear(gl_color_buffer_bit) # clear color buffer glloadidentity() # reset model-view matrix drawchecker(nbr = 16, dark = 25.0/255, light = 75.0/255) if screenswap == 1: drawquestionmark(rval, gval, bval, left) # blue line blueline(left) # line see if dropping frame dropframetest(left) screenswap = 0 else: drawquestionmark(rval, gval, bval, right) # blue line blueline(right) # line see if dropping frame dropframetest(right) screenswap = 1 fps = pyglet.clock.get_fps() fd.write( str(fps) + "\n") # debug and more:
display = pyglet.window.get_platform().get_default_display() screens = display.get_screens() # direct opengl commands window. config = config(double_buffer = true) window = pyglet.window.window(config = config, screen=screens[1], vsync=true) # set full screen in separate function avoid flicker start window.set_fullscreen(true) pyglet.clock.clockdisplay() #pyglet.clock.set_fps_limit(120) fps = pyglet.clock.get_fps() dt = pyglet.clock.tick() pyglet.clock.schedule_interval(on_draw, 0.001) pyglet.app.run() fd.close()
ok, think understand happening.
in order understand behavior, wrote file time , frame rate everytime drew frame. used "gpu task manager" information on gpu load @ specific time (gpu-z).
when have lot of applications running in ground, application runs fine , gpu load around 25%.
when not have lot of applications running in ground, application out of sync, cpu load higher , gpu load around not steady.
i made observations on 2 different implementations of code, , monitored gpu + cpu activity 15 minutes each time.
at first, assumed cpu taking of load... seems wrong.
Comments
Post a Comment