[PyOpenGL-Devel] Getting wglSwapIntervalEXT to work.
Brought to you by:
mcfletch
|
From: Roman V. <red...@gm...> - 2013-10-29 19:48:24
|
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.
|