I just started using Pyglet and came across an issue with the Win32 method of swapping front and back buffers. Pyglet uses the wglSwapLayerBuffers Win32 API call do this swap. On my machine (Windows 7, AMD Radeon HD 7-series graphics card) this method doesn't work with vsync enabled. My display has a 60Hz refresh rate, and yet the wglSwapLayerBuffers call blocks to make a 30fps rate. With vsync disabled the frame rate is > 500 so it is certainly not the case that each frame is to slow to achieve 60fps with vsync enabled. Moreover, if I replace the wglSwapLayerBuffers call with the more standard SwapBuffers call, everything works correctly (60fps).
I've heard reports of other people experiencing the same thing. Why does Pyglet use the wglSwapLayerBuffers call? This flat out doesn't work on some configurations with vsync enabled. Useful resources:
On Thursday, July 26, 2012 11:10:02 AM UTC-7, Taylor Gordon wrote:
> I just started using Pyglet and came across an issue with the Win32 method > of swapping front and back buffers. Pyglet uses the wglSwapLayerBuffers > Win32 API call do this swap. On my machine (Windows 7, AMD Radeon HD > 7-series graphics card) this method doesn't work with vsync enabled. My > display has a 60Hz refresh rate, and yet the wglSwapLayerBuffers call > blocks to make a 30fps rate. With vsync disabled the frame rate is > 500 so > it is certainly not the case that each frame is to slow to achieve 60fps > with vsync enabled. Moreover, if I replace the wglSwapLayerBuffers call > with the more standard SwapBuffers call, everything works correctly > (60fps).
> I've heard reports of other people experiencing the same thing. Why does > Pyglet use the wglSwapLayerBuffers call? This flat out doesn't work on some > configurations with vsync enabled. Useful resources:
On Sun, Jul 29, 2012 at 1:26 PM, Taylor Gordon <taylorgordo...@gmail.com> wrote:
> Ping! Should we switch from wglSwapLayerBuffers to SwapBuffers.
> On Thursday, July 26, 2012 11:10:02 AM UTC-7, Taylor Gordon wrote:
>> I just started using Pyglet and came across an issue with the Win32 method
>> of swapping front and back buffers. Pyglet uses the wglSwapLayerBuffers
>> Win32 API call do this swap. On my machine (Windows 7, AMD Radeon HD
>> 7-series graphics card) this method doesn't work with vsync enabled. My
>> display has a 60Hz refresh rate, and yet the wglSwapLayerBuffers call blocks
>> to make a 30fps rate. With vsync disabled the frame rate is > 500 so it is
>> certainly not the case that each frame is to slow to achieve 60fps with
>> vsync enabled. Moreover, if I replace the wglSwapLayerBuffers call with the
>> more standard SwapBuffers call, everything works correctly (60fps).
>> I've heard reports of other people experiencing the same thing. Why does
>> Pyglet use the wglSwapLayerBuffers call? This flat out doesn't work on some
>> configurations with vsync enabled. Useful resources:
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/vol_It4XyLsJ.
> To post to this group, send email to pyglet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> pyglet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
> "since GDI and the ICD share function names like SwapBuffers, a
> wglSwapBuffers is needed to avoid ambiguity when loading the proc
> dynamically."
> On Sun, Jul 29, 2012 at 1:26 PM, Taylor Gordon <taylorgordo...@gmail.com> wrote:
>> Ping! Should we switch from wglSwapLayerBuffers to SwapBuffers.
>> On Thursday, July 26, 2012 11:10:02 AM UTC-7, Taylor Gordon wrote:
>>> I just started using Pyglet and came across an issue with the Win32 method
>>> of swapping front and back buffers. Pyglet uses the wglSwapLayerBuffers
>>> Win32 API call do this swap. On my machine (Windows 7, AMD Radeon HD
>>> 7-series graphics card) this method doesn't work with vsync enabled. My
>>> display has a 60Hz refresh rate, and yet the wglSwapLayerBuffers call blocks
>>> to make a 30fps rate. With vsync disabled the frame rate is > 500 so it is
>>> certainly not the case that each frame is to slow to achieve 60fps with
>>> vsync enabled. Moreover, if I replace the wglSwapLayerBuffers call with the
>>> more standard SwapBuffers call, everything works correctly (60fps).
>>> I've heard reports of other people experiencing the same thing. Why does
>>> Pyglet use the wglSwapLayerBuffers call? This flat out doesn't work on some
>>> configurations with vsync enabled. Useful resources:
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pyglet-users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/pyglet-users/-/vol_It4XyLsJ.
>> To post to this group, send email to pyglet-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> pyglet-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/pyglet-users?hl=en.
On Thu, Jul 26, 2012 at 8:10 PM, Taylor Gordon <taylorgordo...@gmail.com> wrote:
> Moreover, if I replace the wglSwapLayerBuffers call with the
> more standard SwapBuffers call, everything works correctly (60fps).
What have you changed exactly to get it working with SwapBuffers?
I tried replacing the line
wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE)
with
wgl.SwapBuffers(self.canvas.hdc)
But I always get the error
pyglet.gl.lib.MissingFunctionException: SwapBuffers is not
exported by the available OpenGL driver.
with current Nvidia and Intel drivers.
This may of course be a bug in pyglets wrapper or be related to the
dynamic linking issue Andre pointed out, but I'm curious how you got
it working?
On Monday, July 30, 2012 12:03:12 AM UTC-7, Andreas Schiefer wrote:
> On Thu, Jul 26, 2012 at 8:10 PM, Taylor Gordon <taylorg...@gmail.com<javascript:>> > wrote: > > Moreover, if I replace the wglSwapLayerBuffers call with the > > more standard SwapBuffers call, everything works correctly (60fps).
> What have you changed exactly to get it working with SwapBuffers? > I tried replacing the line > wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE) > with > wgl.SwapBuffers(self.canvas.hdc)
> But I always get the error > pyglet.gl.lib.MissingFunctionException: SwapBuffers is not > exported by the available OpenGL driver. > with current Nvidia and Intel drivers.
> This may of course be a bug in pyglets wrapper or be related to the > dynamic linking issue Andre pointed out, but I'm curious how you got > it working?
> On Monday, July 30, 2012 12:03:12 AM UTC-7, Andreas Schiefer wrote:
>> On Thu, Jul 26, 2012 at 8:10 PM, Taylor Gordon <taylorg...@gmail.com>
>> wrote:
>> > Moreover, if I replace the wglSwapLayerBuffers call with the
>> > more standard SwapBuffers call, everything works correctly (60fps).
>> What have you changed exactly to get it working with SwapBuffers?
>> I tried replacing the line
>> wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE)
>> with
>> wgl.SwapBuffers(self.canvas.hdc)
>> But I always get the error
>> pyglet.gl.lib.MissingFunctionException: SwapBuffers is not
>> exported by the available OpenGL driver.
>> with current Nvidia and Intel drivers.
>> This may of course be a bug in pyglets wrapper or be related to the
>> dynamic linking issue Andre pointed out, but I'm curious how you got
>> it working?
> --
Ah, but there is more fun for this issue:
1. There's also a GDI function SwapBuffers, which seems to be the
recomended way, see