-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vulkan in Processing (draft) #948
base: main
Are you sure you want to change the base?
Conversation
Wow, @TeoJT , this is an amazing PR!!! Thank you for your hard work here. It looks like your PGraphicsVulkan class inherits from PGraphicsOpenGL to benefit from all of the geometry and style functionality as well as the tessellation code, and then intercepts what would otherwise go through PGL to use Vulkan instead. Is that correct? You mention mouse events, does it handle keyboard events also? How much testing have you done? In general, does it work well? I can't wait to give this a try! |
Thanks for the kind words @hx2A :) You're correct; I effectively haven't touched any (or at least most) of the PGraphicsOpenGL code and linked PGL to GL2VK, which uses Vulkan instead. It only uses some quick 'n dirty code for mouse events and there's no keyboard or scrollwheel events sadly. The window also cannot be resized yet. I've mostly tested using the performance example sketches; It generally works well on basic sketches as long as you don't use PGraphics, and make sure you call Let me know how it goes for you! |
Update- just added mouse clicking and keyboard input just now with GLFW. |
(I'm new to PRs so let me know if you see any mistakes ^^")
This is my attempt at making a Vulkan-based renderer for Processing, using LWJGL to access a Vulkan binding. It's part of my final year dissertation where I compare OpenGL and Vulkan renderer speeds so a lot of code is still very messy.
I was also originally planning to release it as a library for Processing, but it appears that moving away from JOGL/OpenGL is now on Processing's roadmap (#881)
The new renderer can be accessed by using
PV2D
/PV3D
in thesize()
function:It works by translating OpenGL commands (through the PGL abstraction layer) to Vulkan commands through a thin OpenGL-to-Vulkan translation layer (under a new package named GL2VK). This layer is optimised for Processing (mostly the immediate and retained modes in Processing). These commands are passed to separate threads (called ThreadNodes) which offload the main thread from potentially expensive operations.
There is also a shader converter which translates OpenGL shaders to Vulkan shaders.
Also, it uses GLFW to create a window and receive mouse inputs... no AWT!