Qemu with 3d acceleration terminates with an error: `The display backend does not have OpenGL support enabled`

Here’s the full error:

internal error: QEMU unexpectedly closed the monitor (vm='Cosmic'): 2025-01-22T16:37:57.574127Z qemu-system-x86_64: -device {"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}: The display backend does not have OpenGL support enabled
It can be enabled with '-display BACKEND,gl=on' where BACKEND is the name of the display backend to use.

Traceback (most recent call last):
  File "/nix/store/qmlflpwq1yrrkcdamrmdlfi7m6rrab49-virt-manager-5.0.0/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/nix/store/qmlflpwq1yrrkcdamrmdlfi7m6rrab49-virt-manager-5.0.0/share/virt-manager/virtManager/asyncjob.py", line 107, in tmpcb
    callback(*args, **kwargs)
  File "/nix/store/qmlflpwq1yrrkcdamrmdlfi7m6rrab49-virt-manager-5.0.0/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qmlflpwq1yrrkcdamrmdlfi7m6rrab49-virt-manager-5.0.0/share/virt-manager/virtManager/object/domain.py", line 1384, in startup
    self._backend.create()
  File "/nix/store/b8rp19p2g46ay6wxkrww0c0cv3c110fs-python3.12-libvirt-10.10.0/lib/python3.12/site-packages/libvirt.py", line 1379, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: internal error: QEMU unexpectedly closed the monitor (vm='Cosmic'): 2025-01-22T16:37:57.574127Z qemu-system-x86_64: -device {"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}: The display backend does not have OpenGL support enabled
It can be enabled with '-display BACKEND,gl=on' where BACKEND is the name of the display backend to use.

hardware.graphics.enable = true; and hardware.graphics.enable32Bit = true; is already in my configuration

I’m using virt-manager