Force OpenGL version on NVIDIA or force usage of MESA OpenGL

I want to run sweethome3d (nixpkgs rev 057f9aecfb71c4437d2b27d3323df7f93c010b7e) but run into

Caused by: com.jogamp.opengl.GLException: Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null

This old thread had the same issue years ago:

The difference is that I am running NVIDIA

$ glxinfo -B
name of display: :0
display: :0  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 6144 MB
    Total available memory: 6144 MB
    Currently available dedicated video memory: 4654 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 545.29.02
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 545.29.02
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 545.29.02
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

What I don’t understand is that I do use MESA drivers for OpenGL in my NixOS config

$ nix repl
Welcome to Nix 2.18.1. Type :? for help.

nix-repl> flake = __getFlake (toString ./.)                                       

nix-repl> flake.outputs.nixosConfigurations.tosaka.config.hardware.opengl.package.pname
"mesa"

and

$ find /run/opengl-driver/lib -name '*mesa*'
/run/opengl-driver/lib/libGLX_mesa.so.0
/run/opengl-driver/lib/libEGL_mesa.so.0.0.0
/run/opengl-driver/lib/libGLX_mesa.so.0.0.0
/run/opengl-driver/lib/libGLX_mesa.so
/run/opengl-driver/lib/libEGL_mesa.so.0
/run/opengl-driver/lib/libEGL_mesa.so

The package for sweethome3d on nixpkgs seems to assume that MESA OpenGL is used and can be used to override OpenGL version.

I guess I can either

  • try to force NVIDIA to use another OpenGL version (could not find about it on the web)
  • try to force sweethome3d to use MESA instead of NVIDIA (I have no idea how)

Would anyone know about it? :slight_smile:

Interesting. Following topic.

I think I reached a minimal reproduction only with JOGL (not sweethome3d itself).