MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.42k stars 313 forks source link

Error while screen sharing: WGL: Failed to make context current: The requested transformation operation is not supported. #1398

Closed MariusDrulea closed 2 years ago

MariusDrulea commented 3 years ago

I get the error bellow while displaying images in a for loop. It happens very often when I share my screen via Microsoft Teams. The program terminates after that. Happens to my colleagues too. We all use julia 1.6.3 and GLMakie 0.4.6

julia --sysimage ..\..\julia_sysimages\glmakie_sysimage1.so .\core\player\player_test.jl

Code:

while (.....)
  fig, ax, plotobj = heatmap(rotr90(img_data), colormap=:gray1)
  heatmap!(rotr90(img_data2), colormap=(:gray1, 0.5))
  heatmap!(rotr90(ix3), colormap=(:prism, 0.5), colorrange=(1/30, 1/5))

  screen = display(fig)            
  wait(screen)
end

Error:

GLFWError (PLATFORM_ERROR): WGL: Failed to make context current: The handle is invalid. 
Stacktrace:
 [1] _ErrorCallbackWrapper(code::Int32, description::Cstring)
   @ GLFW C:\Users\some_user_name\.julia\packages\GLFW\BWxfF\src\callback.jl:43
 [2] MakeContextCurrent
   @ C:\Users\some_user_name\.julia\packages\GLFW\BWxfF\src\glfw3.jl:694 [inlined]
 [3] make_context_current
   @ C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\drawing_primitives.jl:46 [inlined]
 [4] fps_renderloop(screen::GLMakie.Screen, framerate::Float64)
   @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:26
 [5] renderloop(screen::GLMakie.Screen; framerate::Float64)
   @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:48
 [6] renderloop(screen::GLMakie.Screen)
   @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:41
 [7] (::GLMakie.var"#50#52"{GLMakie.Screen})()
   @ GLMakie .\task.jl:411
ERROR: LoadError: TaskFailedException
Stacktrace:
 [1] wait
   @ .\task.jl:322 [inlined]
 [2] wait
   @ C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\screen.jl:44 [inlined]
 [3] run_test()
   @ Main.PlayerTest D:\Software\repos\grid_scripts\julia\g3n\player\player_test.jl:45
 [4] top-level scope
   @ D:\Software\repos\grid_scripts\julia\g3n\player\player_test.jl:50

    nested task error: GLFWError (PLATFORM_ERROR): WGL: Failed to make context current: The handle is invalid. 
    Stacktrace:
     [1] _ErrorCallbackWrapper(code::Int32, description::Cstring)
       @ GLFW C:\Users\some_user_name\.julia\packages\GLFW\BWxfF\src\callback.jl:43
     [2] MakeContextCurrent
       @ C:\Users\some_user_name\.julia\packages\GLFW\BWxfF\src\glfw3.jl:694 [inlined]
     [3] make_context_current
       @ C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\drawing_primitives.jl:46 [inlined]
     [4] fps_renderloop(screen::GLMakie.Screen, framerate::Float64)
       @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:26
     [5] renderloop(screen::GLMakie.Screen; framerate::Float64)
       @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:48
     [6] renderloop(screen::GLMakie.Screen)
       @ GLMakie C:\Users\some_user_name\.julia\packages\GLMakie\TViqo\src\rendering.jl:41
     [7] (::GLMakie.var"#50#52"{GLMakie.Screen})()
       @ GLMakie .\task.jl:411
SimonDanisch commented 3 years ago

Seems like the same problem: https://github.com/JuliaPlots/Makie.jl/issues/1361 https://github.com/JuliaPlots/Makie.jl/issues/668 Can you assure that vsync is turned off?

MariusDrulea commented 3 years ago

I have edited the description to reflect the screen sharing problem, where the error occurs very often. This is not present in the other issues. I have tried the set-window-config command but Julia complains that the renderloop does not exist. In the documentation vsync seem to be false by default.

SimonDanisch commented 3 years ago

How are you screen sharing? Maybe that will help to at least reproduce it...

MariusDrulea commented 3 years ago

Well, the usual screen sharing in Microsoft Teams, in a meeting. Are there more settings behind it? We have also set the vsync to false, via setwindowconfig and the error still appear. We have nvidia gpu-s, windows 10. We use a precompiled sysimage for GLMakie. I'm wondering if the nvidia driver is used via screen sharing. Maybe the Microsoft Teams switches to the integrated intel graphics driver while screen sharing. I do remember from the past that I was unable to work with nvidia cuda devices with the Remote Desktop from Microsoft Windows. I had to use another remote desktop app for this.

SimonDanisch commented 3 years ago

Hm switching GPUs in the middle of things could certainly lead to such behaviour, so that is a good theory....

MariusDrulea commented 2 years ago

I haven't seen it happening for a while, we can close the issue.