Closed wis closed 2 years ago
Hey wis,
the library shipped with pyGLFW wheels is version 3.3.2, the latest release of GLFW. If you want to use features from the development version of GLFW, you will need to build the library yourself and either replace the one shipped with pyGLFW, install it in one of the default search paths, or set the PYGLFW_LIBRARY
environment variable. Then you should be able to use the new window hint.
I try to add constants and function wrappers shortly after a GLFW release instead of doing it bit by bit as development of GLFW goes on. That way users can rely on the constants defined actually being valid, unless they are using their own GLFW library.
Ok, thank you.
I know this issue is closed and the flag won't be added until the 3.4 release, but it's a good solution for me at the moment and so I hacked together a solution. I wanted to write it up for anyone else who comes across this issue and would like to set the 3.4 dll up, but (like me) finds cmake an absolute nightmare.
Caveat: it's not working locally for me. I get this error from the
ctypes.CDLL(...)
call in library.py, no matter what I seem to do. But I HAVE had it working! And it works on a VM I created! I think it's something to do with Poetry? PyCharm? Or Windows 10 security? Or I installed Windows updates which screwed something up? Or caching? Or uninstalled Visual Studio Code? Or it's something with Python 3.9 and ctypes? I have no idea. I'll figure it out - I know it's something weird locally on my machine.
FileNotFoundError: Could not find module 'D:/Users/Yreh/Projects/python/proj/Overlay/glfw3.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Anyway, enough about my problems. Here's how you (the search engine engine user who came across this ticket) can (hopefully) use the 3.4 glfw dll.
Get 3.4 glfw3.dll
https://github.com/aSemy/glfw/releases
I forked glfw/glfw and set up a build job to do this, based off the .appveyor.yml
in glfw/glfw. If you want to fork glfw/glfw yourself, and copy the .github/workflows/cmakesimple.yml
I made - go ahead.
Windows: You might need to right click on the downloaded archive and uncheck the security warning? I used 7zip to extract it.
I found the pyGLFW folder virtualenvs\asdja-py3.9\Lib\site-packages\glfw
and replaced the existing glfw3.dl with the downloaded one.
I found the 'id code' for the GLFW_MOUSE_PASSTHROUGH
by searching in the glfw/glfw project (it's in file include/GLFW/glfw3.h
) - it turns out it's 0x0002000D
I edited 2 pyGLFW files, in it's module folder.
__init__.py
> insert this valueFOCUS_ON_SHOW = 0x0002000C MOUSE_PASSTHROUGH = 0x0002000D # < add this line RED_BITS = 0x00021001
GLFW.py
> Between 'FOCUS_ON_SHOW ' (line 530) and RED_BITS
(line 531) I added... FOCUS_ON_SHOW as GLFW_FOCUS_ON_SHOW, MOUSE_PASSTHROUGH as GLFW_MOUSE_PASSTHROUGH, # < add this line FORMAT_UNAVAILABLE as GLFW_FORMAT_UNAVAILABLE,
I added a print statement after the import to check it was working.
import glfw
print(glfw.get_version())
output: (3, 4, 0)
Ta da!
And check out the docs - they say that this new flag is "only supported for undecorated windows" https://www.glfw.org/docs/3.4/group__window.html#ga88981797d29800808ec242274ab5c03a
This worked flawlessly for me! Thank you @aSemy !
Is it possible to release a "Beta" version of pyGLFW that you can only install if you explicitly say pip install pyGLFW==beta2.3.0
or some such?
Something like that should be possible, yes. I'll look into it, though it might take a couple days.
@FlorianRhiem to be clear: very thankful you do any work on this at all! please take your time, appreciate what we have already.
I've just released version 2.4.0, along with a helper package glfw_preview.
With this new version, if you:
pip install glfw[preview]
, orpip install glfw_preview
after upgrading glfw, orPYGLFW_PREVIEW
to a non-empty valuethe glfw
package will include wrappers for unreleased functions and macros. There will still be a delay between them being introduced to the GLFW master and them being wrapped, as there's still manual work involved with that, but I've setup a CI script that should inform me of any unwrapped macros or functions every saturday morning, so the delay shouldn't be that long.
Please try it and let me know if there are any issues with the preview mechanism or with the newly-wrapped functions and macros.
Hello, thank you for creating this awesome library.
it was added/released in glfw hours before the last release of pyGLFW!
I tried
glfw.window_hint(0x0002000D, glfw.TRUE)
instead ofglfw.window_hint(glfw.MOUSE_PASSTHROUGH, glfw.TRUE)
but found out the compiled library needs updating.can you please release an update?