Main Content

opengl

(To be removed) Control OpenGL rendering

opengl has no effect and returns no output. This function will be removed in a future release. For more information, see Version History.

Description

opengl info prints information about the graphics renderer currently in use by MATLAB®, such as the version, vendor, and graphics features that it supports. Using this command loads OpenGL®.

example

d = opengl('data') returns the same data provided with opengl info, but stores it in a structure.

opengl software uses a software version of OpenGL to render subsequent graphics for the current MATLAB session. This command works only on Windows® systems.

example

opengl hardware uses a hardware-accelerated version of OpenGL to render subsequent graphics. If your graphics hardware does not support hardware-accelerated OpenGL, then MATLAB uses a software version instead.

opengl hardwarebasic uses a hardware-accelerated version of OpenGL, but disables some advanced graphics features that are unstable with certain graphics drivers. If your graphics hardware does not support hardware-accelerated OpenGL, then MATLAB uses a software version instead.

opengl('save',pref) sets your preferences so that future sessions of MATLAB on this computer use the preferred version of OpenGL. Specify pref as 'software', 'hardware', 'hardwarebasic', or 'none'. This command does not affect the current session.

Examples

collapse all

Starting in R2025a, this example no longer runs.

opengl info
                          Version: '3.3.0'
                           Vendor: 'NVIDIA Corporation'
                         Renderer: 'Quadro 400/PCIe/SSE2'
            RendererDriverVersion: '9.18.13.3182'
        RendererDriverReleaseDate: '11-Nov-2013'
                   MaxTextureSize: 8192
                           Visual: 'Visual 0x07, (RGBA 32 bits...'
                         Software: 'false'
             HardwareSupportLevel: 'full'
        SupportsGraphicsSmoothing: 1
    SupportsDepthPeelTransparency: 1
       SupportsAlignVertexCenters: 1
                       Extensions: {248x1 cell}
               MaxFrameBufferSize: 8192

Starting in R2025a, this example no longer runs.

opengl software

Before R2025a, this command works only on Windows systems.

Input Arguments

collapse all

Information about the OpenGL implementation currently in use by MATLAB, specified as info. The opengl info command returns the fields listed in this table.

FieldDescription
VersionVersion of the OpenGL implementation.
VendorManufacturer of the OpenGL implementation.
RendererDriverVersionVersion of the OpenGL driver (Windows systems with hardware-accelerated OpenGL only). This field does not display on virtual machines.
RendererDriverReleaseDateRelease date of the OpenGL driver (Windows systems with hardware-accelerated OpenGL only). This field does not display on virtual machines.
Renderer

Description of the OpenGL renderer. If you are using hardware-accelerated OpenGL, this field is the graphics card model name.

MaxTextureSize

Maximum texture size supported by the OpenGL implementation.

VisualDisplay properties of the OpenGL implementation.
SoftwareSoftware OpenGL enabled, returned as 'true' or 'false'.
HardwareSupportLevel

Hardware support level, returned as one of these values:

  • 'full' — Hardware-accelerated OpenGL (all graphics features enabled)

  • 'basic' — Basic hardware-accelerated OpenGL (some graphics features disabled)

  • 'none' — Software OpenGL

If MATLAB detects an unsupported driver, this field also contains 'known graphics driver issues'.

SupportsGraphicsSmoothingGraphics smoothing feature support, returned as 1 if supported or 0 otherwise.
SupportsDepthPeelTransparencyDepth peel transparency feature support, returned as 1 if supported or 0 otherwise.
SupportsAlignVertexCentersAlign vertex centers feature support, returned as 1 if supported or 0 otherwise.
Extensions

Extended capabilities supported by the OpenGL implementation.

MaxFrameBufferSize

Maximum frame buffer size supported by the OpenGL implementation.

For more information about the graphics smoothing, depth peel transparency, and align vertex centers features, see Advanced Graphics Features.

Software OpenGL, specified as software.

To switch to software OpenGL:

  • On Windows systems, execute opengl software.

  • On Linux® systems, start MATLAB with the -softwareopengl flag.

  • Macintosh systems do not support software OpenGL.

Software OpenGL can be slower than hardware-accelerated OpenGL and does not support all graphics features. For a table of supported features, see Advanced Graphics Features.

Hardware-accelerated OpenGL, specified as hardware. All systems support using the opengl hardware command to switch from basic hardware to hardware OpenGL. However, only Windows systems support using the opengl hardware command to switch from software to hardware OpenGL. To switch from software to hardware on Linux systems, start MATLAB with the -nosoftwareopengl flag.

If your system automatically switched to using software OpenGL, then forcing your system to use hardware OpenGL can cause instabilities.

Basic version of hardware-accelerated OpenGL, specified as hardwarebasic. This version of hardware-accelerated OpenGL uses your graphics hardware, but disables graphics features that are unstable with some graphics drivers. The disabled features might change in future releases as graphics features change and graphics hardware evolves. For a table of disabled features, see Advanced Graphics Features.

OpenGL version preference for future sessions, specified as one of these options:

  • 'software' — Software OpenGL. This option is not available on Macintosh systems.

  • 'hardware' — Hardware-accelerated OpenGL.

  • 'hardwarebasic' — Hardware-accelerated OpenGL with some advanced graphics features disabled. For more information, see Advanced Graphics Features.

  • 'none' — Default value for your system.

More About

collapse all

Tips

  • Before R2025a, Painters is an alternate rendering method for screen display and printing. For more information, see the figure’s Renderer property.

  • Before R2025a, by default, MATLAB uses hardware-accelerated OpenGL if your graphics hardware supports it. However, in some cases, MATLAB automatically switches to software OpenGL, for example, if it detects:

    • You are using a graphics driver with known issues or graphics virtualization.

    • A previous MATLAB session crashed due to a graphics issue. If the previous session was using software OpenGL and crashed, then subsequent sessions use a more stable version of software OpenGL that has fewer capabilities.

    • You do not have graphics hardware or your graphics hardware does not support hardware OpenGL.

Version History

Introduced before R2006a

expand all

See Also