Initializing rgl

Initializing the rgl system.

rgl.init(initValue = 0, onlyNULL = FALSE, 
         debug = getOption("rgl.debug", FALSE))

value for internal use only


only initialize the null (no display) device


enable some debugging messages


If useNULL is TRUE, rgl will use a “null” device. This device records objects as they are plotted, but displays nothing. It is intended for use with rglwidget and similar functions.

Currently debug only controls messages printed by the OpenGL library during initialization. In future debug = TRUE may become more verbose.

rgl requires the OpenGL system to be installed and available in order to display images on screen. If there is a problem initializing it, you may see the message 'rgl.init' failed, running with 'rgl.useNULL = TRUE'. There are several causes and remedies:

  • On any system, the OpenGL libraries need to be present for rgl to be able to start.

    • On MacOS, you need to install Xquartz. It is available from https://www.xquartz.org.

    • On Linux, you need to install Mesa 3D. One of these commands may work, depending on your system: zypper source-install --build-deps-only Mesa # openSUSE/SLED/SLES yum-builddep mesa # yum Fedora, OpenSuse(?) dnf builddep mesa # dnf Fedora apt-get build-dep mesa # Debian, Ubuntu and related

    • Windows should have OpenGL installed by default.

  • On Unix-alike systems (MacOS and Linux, for example), rgl uses the GLX system for creating displays. If the graphic is created on a remote machine, it may need to use “Indirect GLX” (IGLX). Due to security concerns, this is often disabled by default. See https://www.x.org/wiki/Development/Security/Advisory-2014-12-09/ for a discussion of the security issues, and https://www.visitusers.org/index.php?title=Re-enabling_INdirect_glx_on_your_X_server for ways to re-enable IGLX.

  • The https://www.virtualgl.org project is intended to be a way to avoid IGLX, by rendering remotely and sending bitmaps to the local machine. It's not a simple install...

  • If you don't need to see rgl displays on screen, you can use the “NULL device”. See rgl.useNULL.


Normally the user doesn't call rgl.init at all: it is called when the package is loaded. It returns no useful value.

  • rgl.init
Documentation reproduced from package rgl, version 0.100.50, License: GPL

Community examples

Looks like there are no examples yet.