Hello,
I’ve been testing GTK.GLArea to render a grid with the gpu. However when I use glClear(0,0,0,1) it does not work; it simply does not clear with the black color, as if it was transparent, instead the background window color is shown. If I use glClear(0.0001,0,0,1) it will work as expected, same with glClear(0,0,0,0.9999) or glClear(1,0,0,1)
I’ve been thinking pure black is somehow masked by GTK4 or OpenGL but all leads have died. What’s the issue and how can I fix this?
Minimal example:
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
from OpenGL import GL
def on_render( glarea, glcontext):
GL.glClearColor(0,0,0,1)
GL.glClear(GL.GL_COLOR_BUFFER_BIT)
def on_activate(app):
win = Gtk.ApplicationWindow(application=app)
glarea = Gtk.GLArea()
glarea.connect("render", on_render )
win.set_child( glarea )
win.present()
app = Gtk.Application()
app.connect('activate', on_activate)
app.run(None)