FlorianRhiem / pyGLFW

Python bindings for GLFW
MIT License
232 stars 36 forks source link

Invalid window hint when setting CENTER_CURSOR #31

Closed alejandroengineer closed 5 years ago

alejandroengineer commented 5 years ago

I was trying to disable the feature which moves the cursor to the center of a newly created fullscreen window by setting the GLFW_CENTER_CURSOR window hint (glfw.CENTER_CURSOR for this package). This returns the following error when glfw.create_window is called:

Traceback (most recent call last): File "d:/Alejandro/HSCDMV2/Test-Codes/glfwbug.py", line 5, in <module> glfw.window_hint(glfw.CENTER_CURSOR, glfw.FALSE) File "C:\Users\shilab\AppData\Local\Programs\Python\Python37\lib\site-packages\glfw\__init__.py", line 1110, in window_hint _glfw.glfwWindowHint(hint, value) File "C:\Users\shilab\AppData\Local\Programs\Python\Python37\lib\site-packages\glfw\__init__.py", line 609, in errcheck _reraise(exc[1], exc[2]) File "C:\Users\shilab\AppData\Local\Programs\Python\Python37\lib\site-packages\glfw\__init__.py", line 45, in _reraise raise exception.with_traceback(traceback) File "C:\Users\shilab\AppData\Local\Programs\Python\Python37\lib\site-packages\glfw\__init__.py", line 588, in callback_wrapper return func(*args, **kwargs) File "C:\Users\shilab\AppData\Local\Programs\Python\Python37\lib\site-packages\glfw\__init__.py", line 800, in _raise_glfw_errors_as_exceptions raise GLFWError(message) glfw.GLFWError: (65539) b'Invalid window hint 131081'

Below is a code which reproduces the issue on my machine:

https://github.com/alejandroengineer/HSCDMV2/blob/4d82de9d00bf6b296b4face7dcb5b71743b21fb6/Test-Codes/glfwbug.py#L1-L7

FlorianRhiem commented 5 years ago

Hello Alejandro, thank you for the bug report. This is likely due to an old version of GLFW being shipped in the Windows wheel. The window hint is correct, but the old version of GLFW doesn't recognize it. I'll release a bugfix version of the glfw package so that the right GLFW version will be installed. You can download the current version of GLFW here or wait a little until the bugfix version is on PyPI, then run pip install -U glfw to update to it.

alejandroengineer commented 5 years ago

That was it, thank you!

FlorianRhiem commented 5 years ago

Great, I've uploaded a new version of the glfw package (1.8.3) containing GLFW 3.3.