This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Resolving Low-Level Graphics Issues

MATLAB® can encounter low-level issues when creating graphics on your system. For example, bar edges might be missing from bar charts, stems might be missing from stem plots, or your graphics hardware might run out of memory. You can encounter these issues while creating 2-D or 3-D charts, using a Simulink® model that contains scopes, or using UIs from a MathWorks® toolbox. These issues are often due to older graphics hardware or outdated graphics drivers. To resolve them, try the options described here.

Upgrade Your Graphics Hardware Drivers

Graphics hardware vendors frequently provide updated graphics drivers that improve hardware performance. To help ensure that your graphics hardware works with MATLAB, upgrade your graphics drivers to the latest versions available.

  • On Windows® systems, check for driver updates on the website of your manufacturer, such as Lenovo®, HP®, or Dell®. If no updates are provided, then check the website of your graphics hardware vendor, such as AMD , NVIDIA , or Intel .

  • On Linux® systems, use proprietary vendor drivers instead of open-source replacements.

  • On Macintosh systems, the graphics drivers are part of the operating system. Use the latest updates provided.

Use graphics hardware that supports a hardware-accelerated implementation of OpenGL® 2.1 or later. Most graphics hardware released since 2006 has OpenGL 2.1 or later. If you have an earlier version of OpenGL, most graphics features still work, but some advanced graphics features are unavailable. For the best performance, OpenGL 4.0 or later is recommended. For more information on determining your graphics hardware, see rendererinfo.

Choose a Renderer Implementation for Your System

MATLAB displays graphics using a hardware-accelerated, basic hardware-accelerated, or software implementation of the graphics renderer. By default, MATLAB tries to use a hardware-accelerated implementation if your graphics hardware supports it. You can work around many graphics issues by switching to either a software implementation or a basic hardware-accelerated implementation. These alternate implementations do not support some advanced graphics features.

In some cases, MATLAB automatically switches to a software implementation:

  • If your system does not have the necessary graphics hardware.

  • If you are using a graphics driver with known issues, an older NVIDIA® graphics driver, or graphics virtualization. Update your graphics drivers to the latest versions available.

  • If 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.

The availability of hardware-accelerated graphics when using remote desktop on Windows systems varies. If you try to use hardware-accelerated graphics when it is not supported, MATLAB returns a warning message and uses software OpenGL instead. It is possible that updating your graphics drivers to the latest versions will enable support for hardware-accelerated graphics.

To determine which implementation MATLAB is using, call the rendererinfo function. For example, this command gets the information for the current axes and stores it in a structure called info.

info = rendererinfo(gca)
This structure also provides the name of the graphics renderer in the GraphicsRenderer field. For example, if MATLAB is using hardware-accelerated OpenGL, the field returns 'OpenGL Hardware'. If it is using software OpenGL, the field returns 'OpenGL Software'.

Specify OpenGL Implementation for Current Session

To specify an OpenGL implementation for the current session of MATLAB, use one of these techniques.

  • Software OpenGL — Start MATLAB from the command prompt on your system using the command matlab -softwareopengl. This command works only Windows and Linux systems. Macintosh systems do not support software OpenGL.

  • Basic hardware-accelerated OpenGL — Type opengl hardwarebasic at the MATLAB command prompt.

  • Hardware-accelerated OpenGL — Type opengl hardware at the MATLAB command prompt.

Specify OpenGL Implementation for Future Sessions

To set your preferences so that MATLAB always starts with the specified implementation of OpenGL, use one of these techniques.

  • Software OpenGL — Type opengl('save','software') at the MATLAB command prompt. Then, restart MATLAB.

  • Basic hardware-accelerated OpenGL — Type opengl('save','hardwarebasic') at the MATLAB command prompt. Then, restart MATLAB.

  • Hardware-accelerated OpenGL — Type opengl('save','hardware') at the MATLAB command prompt. Then, restart MATLAB.

  • Undo preference setting — Execute opengl('save','none') at the MATLAB command line. Then, restart MATLAB.

Fix Out-of-Memory Issues

Graphics hardware with limited graphics memory can cause poor performance or lead to out-of-memory issues. Improve performance and work around memory issues with these changes:

  • Use smaller figure windows.

  • Turn off anti-aliasing by setting the GraphicsSmoothing property of the figure to 'off'.

  • Do not use transparency.

  • Use software OpenGL.

Contact Technical Support

If you cannot resolve the issues using the options described here, then you might have encountered a bug in MATLAB. Contact MathWorks technical support and provide the following information:

  • The output returned by info = rendererinfo(gca).

  • Whether your code runs without error when using software OpenGL.

  • Whether your code runs without error on a different computer. Provide the output of rendererinfo for all computers you have tested your code on.

  • Some error messages contain a link to a file with details about the graphics error you encountered. If a link to this file is provided, include this file with your service request.

Create a Service Request at https://www.mathworks.com/support/contact_us.

See Also

|

Related Topics