Makie - plot script returned without visualization window

I see the documentation that it might be a problem of GLMakie building, but my build seems fine without any errors. I also tried build GLMakie, it looks fine.

this is my code for test:

using ModernGL

#using Makie
#using CairoMakie
using GLMakie

x = LinRange(0, 10, 100)
y = sin.(x)
fig = lines(x, y)


NVM, I fixed this using this code.

#using ModernGL

using Makie
# using WGLMakie
# WGLMakie.activate!()
using GLMakie

    vsync = false,
    framerate = 30.0,
    float = false,
    pause_rendering = false,
    focus_on_show = false,
    decorated = true,
    title = "Makie"

function display3d()
#using CairoMakie
#using GLMakie

    x = LinRange(0, 10, 100)
    y = sin.(x)
    z = cos.(x)

    fig = lines(x, y, z)



it is not working again with the same code…
the window shows up for a few seconds, but closed after that. Nothing have showed up in the window.

If you add sleep(15) at the last line you may see the plot. What is happening is that the program is finishing, and when this happens julia exits. Because Makie takes many seconds in showing the first plot, Julia exits before you get to see the plot.

Depending on your use case, you could either pass a -i flag to julia, to make it launch the REPL after your script (julia -i myscript.jl) or add a sleep(30) at the end. However julia is not very well suited for script-based plotting due to the long time to first plot.

Also, you really don’t need the package Makie, ModernGL nor the line GLMakie.activate!(). GLMakie is enough.