Getting wglSwapIntervalEXT to work.

Roman Valov <[email protected]> Tue, 29 Oct 2013 23:47:55 +0400
Newsgroups gmane.comp.python.opengl.devel
Message-ID <CAELN+SQS_nkXhNc807-Bmjr_L=vE7xURwjU=bKRLMWYs1fswBg@mail.gmail.com>
--===============6222042639107848768==
Content-Type: multipart/alternative; boundary=047d7b66ff3d61477104e9e67fdd

--047d7b66ff3d61477104e9e67fdd
Content-Type: text/plain; charset=ISO-8859-1

Hello, Mike.

Recently I've started to work on application that requires to
dynamically control over vsync. This functionality is implemented
via platform-specific GL calls. Particulary, on windows functions
to control vsync called wglSwapIntervalEXT and wglGetSwapIntervalEXT.

These functions can be imported from OpenGL.WGL, however
they are actually unresolved. After further review I've found that
all platform-specific functions are generated from C header files
and calls mentioned above are declared in file _WGL_NV.py as:
(I perform my tests on nvidia graphic card):

wglSwapIntervalEXT = platform.createBaseFunction(
    'wglSwapIntervalEXT', dll=platform.GL, resultType=BOOL,
    argTypes=[c_int],
    doc='wglSwapIntervalEXT( c_int(None) ) -> BOOL',
    argNames=['None'],
)

wglGetSwapIntervalEXT = platform.createBaseFunction(
    'wglGetSwapIntervalEXT', dll=platform.GL, resultType=c_int,
    argTypes=[],
    doc='wglGetSwapIntervalEXT(  ) -> c_int',
    argNames=[],
)

Actually, the issue could be fixed just by adding 'extension'
parameter to the createBaseFunction arguments:

wglSwapIntervalEXT = platform.createBaseFunction(
    'wglSwapIntervalEXT', dll=platform.GL, resultType=BOOL,
    argTypes=[c_int],
    doc='wglSwapIntervalEXT( c_int(None) ) -> BOOL',
    argNames=['None'],
    extension='WGL_EXT_swap_control',
)

wglGetSwapIntervalEXT = platform.createBaseFunction(
    'wglGetSwapIntervalEXT', dll=platform.GL, resultType=c_int,
    argTypes=[],
    doc='wglGetSwapIntervalEXT(  ) -> c_int',
    argNames=[],
    extension='WGL_EXT_swap_control',
)

So, since wrapper files was originally generated by gengl.py script,
I've tried to patch this script to fill extension parameter like original
gengl.py from pyglet does. But as a result I've got only mentioned
functions to be resolved with extension parameter. Thus, could
these changes (adding extension parameter) added directly to
the _WGL_NV.py without patching gengl.py?

Regards, Roman.

--047d7b66ff3d61477104e9e67fdd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello, Mike.<div><br></div><div>Recently I&#39;ve started =
to work on application that requires to</div><div>dynamically control over =
vsync. This functionality is implemented</div><div>via platform-specific GL=
 calls. Particulary, on windows functions</div>

<div>to control vsync called wglSwapIntervalEXT and wglGetSwapIntervalEXT.<=
/div><div><br></div><div>These functions can be imported from OpenGL.WGL, h=
owever</div><div>they are actually unresolved. After further review I&#39;v=
e found that</div>

<div>all platform-specific functions are generated from C header files</div=
><div>and calls mentioned above are declared in file _WGL_NV.py as:</div><d=
iv>(I perform my tests on nvidia graphic card):</div><div><br></div><div>

<div>wglSwapIntervalEXT =3D platform.createBaseFunction(</div><div>=A0 =A0 =
&#39;wglSwapIntervalEXT&#39;, dll=3Dplatform.GL, resultType=3DBOOL,</div><d=
iv>=A0 =A0 argTypes=3D[c_int],</div><div>=A0 =A0 doc=3D&#39;wglSwapInterval=
EXT( c_int(None) ) -&gt; BOOL&#39;,</div>

<div>=A0 =A0 argNames=3D[&#39;None&#39;],</div><div>)</div><div><br></div><=
div>wglGetSwapIntervalEXT =3D platform.createBaseFunction(</div><div>=A0 =
=A0 &#39;wglGetSwapIntervalEXT&#39;, dll=3Dplatform.GL, resultType=3Dc_int,=
</div><div>=A0 =A0 argTypes=3D[],</div>

<div>=A0 =A0 doc=3D&#39;wglGetSwapIntervalEXT( =A0) -&gt; c_int&#39;,</div>=
<div>=A0 =A0 argNames=3D[],</div><div>)</div></div><div><br></div><div>Actu=
ally, the issue could be fixed just by adding &#39;extension&#39;</div><div=
>parameter to the createBaseFunction arguments:</div>

<div><br></div><div><div>wglSwapIntervalEXT =3D platform.createBaseFunction=
(</div><div>=A0 =A0 &#39;wglSwapIntervalEXT&#39;, dll=3Dplatform.GL, result=
Type=3DBOOL,</div><div>=A0 =A0 argTypes=3D[c_int],</div><div>=A0 =A0 doc=3D=
&#39;wglSwapIntervalEXT( c_int(None) ) -&gt; BOOL&#39;,</div>

<div>=A0 =A0 argNames=3D[&#39;None&#39;],</div><div>=A0 =A0 extension=3D&#3=
9;WGL_EXT_swap_control&#39;,</div><div>)</div><div><br></div><div>wglGetSwa=
pIntervalEXT =3D platform.createBaseFunction(</div><div>=A0 =A0 &#39;wglGet=
SwapIntervalEXT&#39;, dll=3Dplatform.GL, resultType=3Dc_int,</div>

<div>=A0 =A0 argTypes=3D[],</div><div>=A0 =A0 doc=3D&#39;wglGetSwapInterval=
EXT( =A0) -&gt; c_int&#39;,</div><div>=A0 =A0 argNames=3D[],</div><div>=A0 =
=A0 extension=3D&#39;WGL_EXT_swap_control&#39;,</div><div>)</div></div><div=
><br></div><div>So, since wrapper files was originally generated by gengl.p=
y script,</div>

<div>I&#39;ve tried to patch this script to fill extension parameter like o=
riginal</div><div>gengl.py from pyglet does. But as a result I&#39;ve got o=
nly mentioned=A0</div><div>functions to be resolved with extension paramete=
r. Thus, could</div>

<div>these changes (adding extension parameter) added directly to</div><div=
>the _WGL_NV.py without patching gengl.py?</div><div><br></div><div>Regards=
, Roman.</div><div><br></div></div>

--047d7b66ff3d61477104e9e67fdd--


--===============6222042639107848768==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
--===============6222042639107848768==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyopengl-devel

--===============6222042639107848768==--