GLMakie

GLMakie is the native, desktop-based backend, and is the most feature-complete. It requires an OpenGL enabled graphics card with OpenGL version 3.3 or higher.

Activation and screen config

Activate the backend by calling GLMakie.activate!() with the following options:

GLMakie.activate!(; screen_config...)          

Sets GLMakie as the currently active backend and also allows to quickly set the screen_config . Note, that the screen_config can also be set permanently via Makie.set_theme!(GLMakie=(screen_config...,)) .

Arguments one can pass via screen_config :

Renderloop

  • renderloop = GLMakie.renderloop : sets a function renderloop(::GLMakie.Screen) which starts a renderloop for the screen.

!!! warning
The below are not effective if renderloop isn't set to `GLMakie.renderloop`, unless implemented in custom renderloop:          
  • pause_renderloop = false : creates a screen with paused renderlooop. Can be started with GLMakie.start_renderloop!(screen) or paused again with GLMakie.pause_renderloop!(screen) .

  • vsync = false : enables vsync for the window.

  • render_on_demand = true : renders the scene only if something has changed in it.

  • framerate = 30.0 : sets the currently rendered frames per second.

GLFW window attributes

  • float = false : Lets the opened window float above anything else.

  • focus_on_show = false : Focusses the window when newly opened.

  • decorated = true : shows the window decorations or not.

  • title::String = "Makie" : Sets the window title.

  • fullscreen = false : Starts the window in fullscreen.

  • debugging = false : Starts the GLFW.Window/OpenGL context with debug output.

  • monitor::Union{Nothing, GLFW.Monitor} = nothing : Sets the monitor on which the Window should be opened.

Postprocessor

  • oit = false : Enles order independent transparency for the window.

  • fxaa = true : Enables fxaa (anti-aliasing) for the window.

  • ssao = true : Enables screen space ambient occlusion, which simulates natural shadowing at inner edges and crevices.

  • transparency_weight_scale = 1000f0 : This adjusts a factor in the rendering shaders for order independent transparency. This should be the same for all of them (within one rendering pipeline) otherwise depth "order" will be broken.

Multiple Windows

GLMakie has experimental support for displaying multiple independent figures (or scenes). To open a new window, use display(GLMakie.Screen(), figure_or_scene) .

Forcing Dedicated GPU Use In Linux

Normally the dedicated GPU is used for rendering. If instead an integrated GPU is used, one can tell Julia to use the dedicated GPU while launching julia as $ sudo DRI_PRIME=1 julia in the bash terminal. To have it permanently used, add the line export DRI_PRIME=1 in your .bashrc or .zshrc file.

Troubleshooting OpenGL

If you get any error loading GLMakie, it likely means, you don't have an OpenGL capable Graphic Card, or you don't have an OpenGL 3.3 capable driver installed. Note, that most GPUs, even 8 year old integrated ones, support OpenGL 3.3.

On Linux, you can find out your OpenGL version with: glxinfo | grep "OpenGL version"

If you're using an AMD or Intel gpu on linux, you may run into GLFW#198 .

If you're on a headless server, you still need to install x-server and proper graphics drivers.

You can find a demo on how to set that up in this nextjournal article .

GLMakie's CI has no GPU, so you can also look at .github/workflows/glmakie.yaml for a working setup.

If none of these work for you, take a look at the other backends , which all work without a GPU.

If you get an error pointing to GLFW.jl , please look into the existing GLFW issues , and also google for those errors. This is then very likely something that needs fixing in the glfw c library or in the GPU drivers.

WSL setup or X-forwarding

From: Microsoft/WSL/issues/2855

WSL runs OpenGL alright, but it is not a supported scenario. From a clean Ubuntu install from the store do:

sudo apt install ubuntu-desktop mesa-utils
export DISPLAY=localhost:0
glxgears          

On the Windows side:

  1. install VcXsrv

  2. choose multiple windows -> display 0 -> start no client -> disable native opengl

Troubleshooting:

1.) install: sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev

2.) WSL has some problems with passing through localhost, so one may need to use: export DISPLAY=192.168.178.31:0 , with the local ip of the pcs network adapter, which runs VcXsrv

3.) One may need mv /opt/julia-1.5.2/lib/julia/libstdc++.so.6 /opt/julia-1.5.2/lib/julia/libcpp.backup , another form of GLFW#198