Skip to content

Commit

Permalink
WGL FIX Set the resstyle for getCurrentDC in the wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfletch committed Jan 2, 2020
1 parent 143ecbc commit f12403b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OpenGL/WGL/VERSION/WGL_1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ def glInitWgl10VERSION():
return extensions.hasGLExtension( _EXTENSION_NAME )


### END AUTOGENERATED SECTION
### END AUTOGENERATED SECTION

wglGetCurrentDC.restyle = ctypes.HDC
50 changes: 50 additions & 0 deletions tests/test_wgl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from __future__ import print_function
import pytest, os, sys, unittest
import logging
log = logging.getLogger(__name__)
HERE = os.path.dirname( __file__ )
if sys.platform != 'win32':
raise pytest.skip(reason='Non-windows platform')
try:
from numpy import *
except ImportError as err:
array = None
import pygame, pygame.display
pygame.display.init()
from OpenGL.GL import *
from OpenGL.WGL import *


class TestWGL(unittest.TestCase):
width,height = 300,300
def setUp(self):
self.screen = pygame.display.set_mode(
(self.width,self.height),
pygame.OPENGL | pygame.DOUBLEBUF,
)

pygame.display.set_caption('Testing system')
pygame.key.set_repeat(500,30)
def tearDown(self):
pygame.display.flip()

def test_wgl_imported(self):
assert bool(wglCreateContext)
def test_create_context(self):
window = pygame.display.get_wm_info()['window']
wglCreateContext(window)

def test_get_extensions_low_level(self):
from OpenGL.WGL.ARB.extensions_string import wglGetExtensionsStringARB
window = pygame.display.get_wm_info()['window']
extensions = wglGetExtensionsStringARB(wglGetCurrentDC())
assert extensions
assert b'WGL_ARB_extensions_string' in extensions, extensions

def test_swap_control_interval(self):
from OpenGL.WGL.EXT import swap_control
if not swap_control.wglGetSwapIntervalEXT:
raise pytest.skip(reason='No wglGetSwapIntervalEXT available')
interval = swap_control.wglGetSwapIntervalEXT()

swap_control.wglSwapIntervalEXT(1)

0 comments on commit f12403b

Please # to comment.