Nokse22 / Exhibit

3D model viewer for the GNOME desktop powered by f3d
https://flathub.org/apps/io.github.nokse22.Exhibit
GNU General Public License v3.0
73 stars 7 forks source link

Unable to create a GL context #14

Closed Damond5 closed 3 months ago

Damond5 commented 3 months ago

Hey and cheers for the work! Hoping this can be a default tool in my box.

I installed the flatpak from flathub.org, tried to load this file and got "Unable to create a GL context":

https://we.tl/t-1IMDHKPgjY

Then I tried to load some step files and I'm getting the same error every time:

unable-to-create-a-gl-context

For example this step file:

https://we.tl/t-24gbSOy2Md

Terminal output:

terminal-output

Nokse22 commented 3 months ago

Hello, thank you. Could you share some information about your system?

Damond5 commented 3 months ago

Sure thing, is this sufficient or what do you need?

system-info

Nokse22 commented 3 months ago

Yes it is, thank you.

Nokse22 commented 3 months ago

You can try setting this enviroment variable GDK_DEBUG=gl-disable-gles or GDK_DEBUG=gl-prefer-gl. It is a bug in Gtk with NVidia GPUs.

Use flatpak override --env=VARIABLE_NAME=VARIABLE_VALUE full.application.Name or Flatseal

Damond5 commented 3 months ago

Thank you for the quick response!

I'm traveling for a couple of days, will have to try when I'm back at my Nvidia desktop.


From: Nokse22 @.> Sent: Monday, June 10, 2024 4:47:50 PM To: Nokse22/Exhibit @.> Cc: Damond5 @.>; Author @.> Subject: Re: [Nokse22/Exhibit] Unable to create a GL context (Issue #14)

You can try setting this enviroment variable GDK_DEBUG=gl-disable-gles or GDK_DEBUG=gl-prefer-gl. It is a bug in Gtk with NVidia GPUs.

Use flatpak override --env=VARIABLE_NAME=VARIABLE_VALUE full.application.Name or Flatseal

— Reply to this email directly, view it on GitHubhttps://github.com/Nokse22/Exhibit/issues/14#issuecomment-2158569325, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIKSCDA3DYCORSB32TZEVHLZGW4BNAVCNFSM6AAAAABJA2HSJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJYGU3DSMZSGU. You are receiving this because you authored the thread.Message ID: @.***>

theksepyro commented 3 months ago

I ran into the same issue (also using an nvidia GPU) and have tried using both of those two environment variables in flatseal. The "Unable to create a GL context" message has gone away for me, but now it is just a black screen.

Exhibit Example

I think this is a great project, btw. Thank you for putting it together!

Nokse22 commented 3 months ago

@theksepyro thank you! Is there any error if you run the app with flatpak run io.github.nokse22.Exhibit? If you want you can also test the wayland version with the nightly build and see if it works.

theksepyro commented 3 months ago

I have tried launching it through the terminal in that way, and it did not change my result. I still have just a black screen.

Are there logs I can check?

My current setup is on X11, so I won't be able to test the wayland version on my system at this time unfortunately.

Details

![image](https://github.com/Nokse22/Exhibit/assets/42880340/88fc1cc8-c0dc-4e2e-87c9-0fb2da900711)

Nokse22 commented 3 months ago

If there is a black screen on wayland GDK_DEBUG=gl-glx should fix it.

Damond5 commented 3 months ago

Just arrived home.

Can confirm, using GDK_DEBUG=gl-disable-gles or GDK_DEBUG=gl-prefer-gl, gives a black screen, instead of the error.

No output in terminal at all.

I tried enabling wayland session for gnome, but unfortunately it seems the wayland session was disabled for good reason, cause it was broken, so I havent been able to test with the wayland version either.


Fra: Nokse22 @.> Sendt: 12. juni 2024 15:48 Til: Nokse22/Exhibit @.> Cc: Damond5 @.>; Author @.> Emne: Re: [Nokse22/Exhibit] Unable to create a GL context (Issue #14)

If there is a black screen on wayland GDK_DEBUG=gl-glx should fix it.

— Reply to this email directly, view it on GitHubhttps://github.com/Nokse22/Exhibit/issues/14#issuecomment-2163058517, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIKSCDCYRTXL3CUZGPW5TYTZHBGRJAVCNFSM6AAAAABJA2HSJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTGA2TQNJRG4. You are receiving this because you authored the thread.Message ID: @.***>

NoTuxNoBux commented 3 months ago

With the release from a few hours ago, I'm also seeing this issue if I enable Wayland support in Flatseal (without it, everything fails to load now according to the toast), but it looks like an upstream Flatpak runtime issue since it seems to be trying to use NVK for Vulkan, whilst I'm using NVIDIA-DRM on my host - I don't have the former installed on my host machine, but perhaps it is in the Flatpak runtimes now:

╰─ LANG=C GDK_DEBUG=gl-glx io.github.nokse22.Exhibit Logo_MrWatts.glb                                                                     ─╯
Gsk-Message: 14:38:59.058: Failed to realize renderer of type 'GskNglRenderer' for surface 'GdkWaylandToplevel': Trying to use EGL, but X11 GLX is already in use

Gsk-Message: 14:38:59.058: Failed to realize renderer of type 'GskGLRenderer' for surface 'GdkWaylandToplevel': Trying to use EGL, but X11 GLX is already in use

DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.

(exhibit:2): Gdk-CRITICAL **: 14:39:01.393: Vulkan: ../src/nouveau/vulkan/nvk_physical_device.c:1109: VK_ERROR_INCOMPATIBLE_DRIVER
Traceback (most recent call last):
  File "/app/share/exhibit/exhibit/window.py", line 232, in on_realize
    self.gl_area.get_context().make_current()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'make_current'

I saw similar issues when you install vulkan-nouveau in Arch but are actually running on nvidia-drm when using tools such as vulkaninfo, hence the suspicion that it's somehow trying to force NVK because it's installed in the runtime despite it not being actually usable.

Running without gl-glx on Wayland also results in the black screen, but there is no console error output despite it not loading.

Nokse22 commented 3 months ago

The Flathub version is not supposed to work in Wayland, if you want you can try the Wayland builds in the actions page. gl-glx might fix the black screen if you use the app in Xwayland.

Edit: before 1.2.0

NoTuxNoBux commented 3 months ago

FWIW, the (new) issue I had on GNOME Wayland is now fixed on 1.2.0. :tada:

theksepyro commented 3 months ago

I am no longer getting a black screen with the latest update when I use the

GDK_DEBUG=gl-prefer-gl

environment variable.

RedAuburn commented 3 months ago

the var also fixed it for me 👍️ has the GTK/nvidia bug been reported upstream?

Nokse22 commented 3 months ago

It's great to hear that it is now working, I have tried setting this environment variable in the app, but if it works only after adding it I might need to do something more.

has the GTK/nvidia bug been reported upstream?

Yes it has been reported already. It's known issue that nvidia's EGL driver cannot switch between GL and GLES, so you need to tell Gtk to use GL before running.