Skip to content

Instantly share code, notes, and snippets.

View omnp's full-sized avatar
🖌️

Olli M. omnp

🖌️
  • Turku, Finland
View GitHub Profile
@omnp
omnp / color.py
Last active July 18, 2024 06:48
"Fake real" color mixing from RGB values, just something to play with (new revision updated).
import math
import matplotlib.pyplot as plot
EPS = 1e-24
red = (2.0,0.0,0.0)
green = (0.0,2.0,0.0)
blue = (0.0,0.0,2.0)
yellow = (1.0,1.0,0.0)
cyan = (0.0,1.0,1.0)
magenta = (1.0,0.0,1.0)
@omnp
omnp / gtk-python-example4.py
Created August 3, 2023 19:04
Example showing how to create a minimal GTK 4 app with a main window and on it a Wayland subsurface fed by Vulkan.
# Example showing how to create a minimal GTK 4 app with a main window and on it a Wayland subsurface fed by Vulkan.
# The FPS counter printed on the console should show about 60 fps on Gnome/Mutter.
# One may need to install vulkan (the python package) from source.
# Maybe same for pywayland. Mileage may vary.
# I happen to have two discrete GPUs installed in the test computer, one AMD, one NVIDIA, and Intel integrated to top.
# The Radeon is the main one running Gnome/Mutter (after some /usr/share/glvnd/egl_vendor.d/ symlinking happened, that is)
# "Works for me" on the Radeon, when started from Gnome Terminal as python example4.py
# Playing around with switcherooctl style env variables trying to get the Nvidia card to render vulkan while being composited to
# the main window does not work though.