opengl

Control OpenGL rendering

The autoselect, neverselect, advise, quiet, verbose, and DriverBugWorkaround inputs have been removed in R2014b. For more information about the behavior of these syntaxes in previous releases, see opengl for R2014a.

Syntax

  • opengl info example
  • d = opengl('data')
  • opengl software example
  • opengl hardware
  • opengl('save','software') example
  • opengl('save','hardware')

Description

example

opengl info prints information about the OpenGL® library on your system, such as the version, vendor, and graphics features that it supports. The returned fields might change in future releases as graphics features change. Using this command loads the OpenGL library.

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

example

opengl software uses the software version of OpenGL built into MATLAB® to render subsequent graphics. This command works only on Windows® systems. To use software OpenGL on Linux® systems, start MATLAB with the -softwareopengl flag. Macintosh systems do not support software OpenGL.

opengl hardware uses the version of OpenGL on your operating system to render subsequent graphics. Use this option if you have graphics hardware that supports hardware-accelerated OpenGL. This command works only on Windows systems. To use hardware OpenGL on Linux systems, start MATLAB with the -nosoftwareopengl flag.

example

opengl('save','software') sets your preferences so that future sessions of MATLAB on this computer use software OpenGL. This command does not affect the current session.

opengl('save','hardware') uses the version of OpenGL on your operating system. This command does not affect the current session.

Examples

Display Information About OpenGL

Display information about the OpenGL library on your system, such as the vendor, the version, and the MATLAB graphics features that it supports. Also display whether MATLAB is using a hardware-accelerated implementation or a software implementation of OpenGL.

opengl info
                          Version: '2.1 Mesa 7.2'
                           Vendor: 'Brian Paul'
                         Renderer: 'Mesa X11'
                   MaxTextureSize: 2048
                           Visual: 'Visual 0x4d, (RGBA 32 bits (8 8 8 8), ...'
                         Software: 'true'
        SupportsGraphicsSmoothing: 0
    SupportsDepthPeelTransparency: 1
       SupportsAlignVertexCenters: 0
                       Extensions: {114x1 cell}
               MaxFrameBufferSize: 4096

Determine Graphics Hardware

Determine your graphics hardware by checking the Vendor and Renderer fields returned by the opengl info command.

opengl info
                           Version: '3.3.0'
                           Vendor: 'NVIDIA Corporation'
                         Renderer: 'Quadro 400/PCI/SSE2'
                   MaxTextureSize: 8192
                           Visual: 'Visual 0x07, (RGBA 32 bits (8 8 8 8), Z depth 24 bits, Hardware a...'
                         Software: 'false'
        SupportsGraphicsSmoothing: 1
    SupportsDepthPeelTransparency: 1
       SupportsAlignVertexCenters: 1
                       Extensions: {235x1 cell}
               MaxFrameBufferSize: 8192

If you are using software OpenGL, then the name listed in the Vendor field is not your graphics hardware vendor. The line Software: 'true' indicates that you are using software OpenGL.

If you are using software OpenGL on Windows systems, determine your graphics hardware by closing all figures, switching to hardware OpenGL, and reissuing the opengl info command. Then, switch back to software OpenGL.

close all 
opengl hardware
opengl info
opengl software

If you are using software OpenGL on Linux systems, determine your graphics hardware by starting MATLAB with the -nosoftwareopengl flag. Then, issue the opengl info command.

Mac OS X systems do not support software OpenGL, so the Vendor field always lists the name of your graphics hardware vendor.

Use Software OpenGL for Current Session

Switch to using software OpenGL to render graphics in the current session.

opengl software

Use Software OpenGL for Future Sessions

Set your preferences so that MATLAB uses software OpenGL to render graphics in all future sessions. This command does not affect the current session.

opengl('save','software')

More About

expand all

Tips

  • By default, MATLAB uses your graphics hardware if it supports hardware-accelerated OpenGL. If it is not available or if you are using a virtual machine, a Linux VNC, or a graphics driver with known issues, then MATLAB uses software OpenGL instead. For more information on graphics renderers, see the figure Renderer property.

  • For the best results with graphics, upgrade your graphics drivers to the latest version available. For more information, see System Requirements for Graphics.

Was this topic helpful?