Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion wglSwapLayerBuffers versus SwapBuffers

Received: by 10.50.34.197 with SMTP id b5mr1071092igj.5.1344717894812;
        Sat, 11 Aug 2012 13:44:54 -0700 (PDT)
X-BeenThere: pyglet-users@googlegroups.com
Received: by 10.231.2.13 with SMTP id 13ls5148123ibh.1.gmail; Sat, 11 Aug 2012
 13:44:53 -0700 (PDT)
Received: by 10.50.217.134 with SMTP id oy6mr1072869igc.5.1344717893359;
        Sat, 11 Aug 2012 13:44:53 -0700 (PDT)
Received: by 10.50.217.134 with SMTP id oy6mr1072868igc.5.1344717893339;
        Sat, 11 Aug 2012 13:44:53 -0700 (PDT)
Return-Path: <ccanep...@gmail.com>
Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178])
        by gmr-mx.google.com with ESMTPS id s10si798247igs.0.2012.08.11.13.44.53
        (version=TLSv1/SSLv3 cipher=OTHER);
        Sat, 11 Aug 2012 13:44:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of ccanep...@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ccanep...@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=ccanep...@gmail.com; dkim=pass header...@gmail.com
Received: by obbwd20 with SMTP id wd20so5738623obb.23
        for <pyglet-users@googlegroups.com>; Sat, 11 Aug 2012 13:44:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=L58PvLa6OJYW2v8nR96LqLq+5Ch6FqiHMK40hpr0hwU=;
        b=Kj8d9+fdnd3PE6PNsKaw4TY70Ix2Sov/2xcoN5yxC1wN7CVVsn0Y2ITUEJy7WUSaaz
         AN6mtXC+fKBA1RyJaVucd5mcDy9OcSFXr723sqQ/ocbdDaZgWLwNnWMozB4JZCURkIMy
         HT4ZBhJEudBB+R3Uhv3i2m6Fa2+eexL4qLJDJUUBxdF9mC2fxupOo3mwSq7EN/3pzlDq
         cUMQEjEZj8wquJeFNLCZNrVk5gXSRxoCcVhL/P3hBBT9OyPjAEZcaCNAX2ZJ454GVQji
         nEdQoZIzEEJan6fUAFjD4zPRnmrOQ11W4zRFmrTy+ekmsozjP5l6sTwWPJCicMNSMdqJ
         Cdwg==
MIME-Version: 1.0
Received: by 10.50.173.39 with SMTP id bh7mr1689348igc.44.1344717892937; Sat,
 11 Aug 2012 13:44:52 -0700 (PDT)
Received: by 10.50.120.40 with HTTP; Sat, 11 Aug 2012 13:44:52 -0700 (PDT)
In-Reply-To: <feec6929-2882-4972-97dd-8667713aafd8@googlegroups.com>
References: <ee3dc7bb-b488-46a1-8826-b0c942e53782@googlegroups.com>
	<CALM+mVBm6LjQDut=CBzKJBxzAQbqU6ETA08ACbSGDNytZNC...@mail.gmail.com>
	<feec6929-2882-4972-97dd-8667713aafd8@googlegroups.com>
Date: Sat, 11 Aug 2012 17:44:52 -0300
Message-ID: <CAP3BN9UW87xqt-a6ehBt-da=E5NNgc=61kBH=0UAJdDYt3B...@mail.gmail.com>
Subject: Re: wglSwapLayerBuffers versus SwapBuffers
From: claudio canepa <ccanep...@gmail.com>
To: pyglet-users@googlegroups.com
Content-Type: multipart/alternative; boundary=e89a8f5036dc54e7f304c70388e2

--e89a8f5036dc54e7f304c70388e2
Content-Type: text/plain; charset=UTF-8

On Sat, Aug 11, 2012 at 5:00 PM, Taylor Gordon <taylorgordo...@gmail.com>wrote:

> You have to link the SwapBuffers method in the wgl module. Add the line:
>
> SwapBuffers = _link_function('SwapBuffers', BOOL, [HDC], None)
>
> 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

http://www.opengl.org/discussion_boards/showthread.php/127145-How-to-use-wglSwapBuffers

http://msdn.microsoft.com/en-us/library/dd369060(v=vs.85)

http://bugs.winehq.org/show_bug.cgi?id=5310

It is not currently binded in pyglet, but you can use this GDI flavor by:

1.  En pyglet\libs\win32\__init__.py , near the line 99, add the lines

     _gdi32.SwapBuffers.restype = BOOL
     _gdi32.SwapBuffers.argtypes = [HDC]

2. in pyglet\gl\win32.py, class Win32Context, method .flip(), replace the
line

     wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE)
by
     _gdi32.SwapBuffers(self.canvas.hdc)

Now, If there were a small script demoing the defect it would be easier to
evalute solutions.

Note also that the first link does some remarks about vsync issues.

claudio

--

--e89a8f5036dc54e7f304c70388e2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">On Sat, Aug 11, 2012 at 5:00 PM, Taylor =
Gordon <span dir=3D"ltr">&lt;<a href=3D"mailto:taylorgordo...@gmail.com" ta=
rget=3D"_blank">taylorgordo...@gmail.com</a>&gt;</span> wrote:<br><blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex">
You have to link the=C2=A0SwapBuffers method in the wgl module. Add the lin=
e:<br><br>SwapBuffers =3D _link_function(&#39;SwapBuffers&#39;, BOOL, [HDC]=
, None)<br><br>On Monday, July 30, 2012 12:03:12 AM UTC-7, Andreas Schiefer=
 wrote:<div class=3D"im">
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex">On Thu, Jul 26, 2012 at 8:10 PM, Ta=
ylor Gordon &lt;<a>taylorg...@gmail.com</a>&gt; wrote:
<br>&gt; Moreover, if I replace the wglSwapLayerBuffers call with the
<br>&gt; more standard SwapBuffers call, everything works correctly (60fps)=
.
<br>
<br>What have you changed exactly to get it working with SwapBuffers?
<br>I tried replacing the line
<br>=C2=A0 =C2=A0 wgl.wglSwapLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAI=
N_PLANE)
<br>with
<br>=C2=A0 =C2=A0 wgl.SwapBuffers(self.canvas.hdc)
<br>
<br>But I always get the error
<br>=C2=A0 =C2=A0 pyglet.gl.lib.MissingFunctionException: SwapBuffers is no=
t
<br>exported by the available OpenGL driver.
<br>with current Nvidia and Intel drivers.
<br>
<br>This may of course be a bug in pyglets wrapper or be related to the
<br>dynamic linking issue Andre pointed out, but I&#39;m curious how you go=
t
<br>it working?
<br></blockquote>



-- <br>=C2=A0</div></blockquote><div><br></div><div>Ah, but there is more f=
un for this issue:</div><div><br></div><div>1. There&#39;s also a GDI funct=
ion SwapBuffers, which seems to be the recomended way, see</div><div>=C2=A0=
<a href=3D"http://www.opengl.org/discussion_boards/showthread.php/127145-Ho=
w-to-use-wglSwapBuffers">http://www.opengl.org/discussion_boards/showthread=
.php/127145-How-to-use-wglSwapBuffers</a></div>
<div><br></div><div><a href=3D"http://msdn.microsoft.com/en-us/library/dd36=
9060(v=3Dvs.85)">http://msdn.microsoft.com/en-us/library/dd369060(v=3Dvs.85=
)</a></div><div><br></div><div><a href=3D"http://bugs.winehq.org/show_bug.c=
gi?id=3D5310">http://bugs.winehq.org/show_bug.cgi?id=3D5310</a></div>
<div><br></div><div>It is not currently binded in pyglet, but you can use t=
his GDI flavor by:</div><div><br></div><div>1. =C2=A0En pyglet\libs\win32\_=
_init__.py , near the line 99, add the lines<br><br>=C2=A0 =C2=A0 =C2=A0_gd=
i32.SwapBuffers.restype =3D BOOL<br>
=C2=A0 =C2=A0 =C2=A0_gdi32.SwapBuffers.argtypes =3D [HDC]<br></div><div><br=
></div><div>2. in pyglet\gl\win32.py, class Win32Context, method     .flip(=
), replace the line</div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0wgl.wglSwa=
pLayerBuffers(self.canvas.hdc, wgl.WGL_SWAP_MAIN_PLANE)<br>
by<br>=C2=A0 =C2=A0 =C2=A0_gdi32.SwapBuffers(self.canvas.hdc)<br></div><div=
><br></div><div>Now, If there were a small script demoing the defect it wou=
ld be easier to evalute solutions.</div><div><br></div><div>Note also that =
the first link does some remarks about vsync issues.</div>
<div><br></div><div>claudio</div><div><br></div><div>--</div><div><br></div=
><div><br></div></div>

--e89a8f5036dc54e7f304c70388e2--