Comments (8)
yes it works now! Thank you for addressing this so quickly!
from pyglfw.
Hello @okuma10,
currently no specific Vulkan wrapper is supported by pyGLFW, so you will need to cast the wrapper-specific arguments to ctypes.c_void_p
, e.g. using ctypes.cast(instance_pointer, ctypes.c_void_p)
. Depening on the technology used by the Vulkan wrapper you are using, you may need to perform an additional step to retrieve the instance pointer first.
Please let me know if this solved your issue, otherwise please tell me which Vulkan wrapper you are using so I can look into it.
from pyglfw.
hi
I'm using this wrapper
https://github.com/realitix/vulkan
the ctypes.cast suggestion didn't work
from pyglfw.
Thanks, the wrapper is using cffi, so you need to convert the cffi pointer to a ctypes pointer. I'll look into it.
from pyglfw.
Instead of using ctypes.cast(instance_pointer, ctypes.c_void_p)
you will need to use ctypes.c_void_p(int(ffi.cast('uintptr_t', instance_pointer)))
to convert the cffi pointer to a ctypes pointer. You should be able to import ffi
from the vulkan package, otherwise you can create a new one using:
from cffi import FFI
ffi = FFI()
from pyglfw.
I tried your first suggestion but I get an error
File "C:\Users\Okuma_10\AppData\Roaming\Python\Python37\site-packages\glfw\__init__.py", line 2561, in create_window_surface
return _glfw.glfwCreateWindowSurface(instance, window, allocator, surface)
OSError: exception: access violation writing 0x0000000000000000
glfw_VKinstance = ctypes.c_void_p(int(ffi.cast('uintptr_t',self.VKinstance)))
glfw.create_window_surface(glfw_VKinstance, self.window, None, self.surface)
self.window is the window handle I get from glfw. and self.surface is just set to None
at the moment of the function call.
On the tutorial ...since it's in C++ the variable type is pre-defined as VkSurfaceKHR . But up to this point in the tutorial the vulkan wrapper always returns the the correct type.
from pyglfw.
I just checked their repo and they have an example for using pyGLFW: https://github.com/realitix/vulkan/blob/master/example/contribs/example_glfw.py The example has the following code:
surface = ctypes.c_void_p(0)
instance = ctypes.cast(int(ffi.cast('uintptr_t', self.__instance)), ctypes.c_void_p)
glfw.create_window_surface(instance, self.__window, None, ctypes.byref(surface))
Please try and use the code from the example. I'll try to get it set up on my system and maybe I can add some support for this wrapper to pyGLFW.
from pyglfw.
I have just released pyGLFW1.12.0 which contains some utilities for working with CFFI based Vulkan wrappers. You can now do the following:
surface_ptr = ffi.new('VkSurfaceKHR[1]')
glfw.create_window_surface(instance, window, None, surface_ptr)
surface = surface_ptr[0]
and pyGLFW will automatically convert the CFFI pointers to ctypes pointers.
from pyglfw.
Related Issues (20)
- Default Error handling differs from GLFW HOT 6
- Missing Linux AArch64 wheel on PyPI
- Fails to find GLFW on Mac M1 HOT 6
- M1 MacBook Conda install issue HOT 3
- Changing OpenGL version doesn't work HOT 1
- Attempt to retrieve context when no valid context HOT 20
- What exactly is PYGLFW_PREVIEW HOT 3
- Full screen print screen on Windows 10 only captures first frame HOT 1
- set_monitor_user_pointer doesn't work HOT 1
- The `window` argument for `glfw[GS]etClipboardString` has been deprecated in libglfw 3.3 HOT 6
- MOUSE_PASSTHROUGH attr issue HOT 2
- Switching between X11 and Wayland HOT 9
- Requested OpenGL version 1.0, got version 0.0 HOT 4
- OpenGL version check crashes for frozen executables like PyInstaller/cxFreeze HOT 19
- [OS X] ImportError: Failed to load GLFW3 shared library. HOT 5
- `get_monitor_workarea()` returns zero width and height on Apple SIlicon HOT 1
- Is the latest release broken? HOT 2
- Unable to set glfw.WAYLAND_APP_ID HOT 1
- GLFWError: (65542) b'WGL: The driver does not appear to support OpenGL' HOT 14
- Compatibility with github's CI Mac OS X runner images HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyglfw.