Geoff
Geoff

Reputation: 1222

MATLAB Figure Rendering: OpenGL vs. Painters?

I'm clueless when it comes to which renderer to use for MATLAB figures or when it matters, but I have come across certain examples where it does matter:

plot(0,0,'ko','markersize',50,'linewidth',8);
set(gcf,'renderer','opengl');
set(gcf,'renderer','painters');

Left=OpenGL, Right=Painters:

OpenGL resultPainters result

(running Windows 7 Professional and MATLAB R2015b)

Are there times when using the OpenGL renderer produces better results than Painters? In general how do the two renderers differ?

Upvotes: 6

Views: 10656

Answers (1)

user1097111
user1097111

Reputation: 662

These are the differences I know of

  • OpenGL is the default renderer
  • OpenGL allows to plot transparency and Painter does not
  • If there is a graphical bug when using OpenGL or if Matlab crashes, use Painter
  • Select Painter to export figures in postscript format. Using OpenGL when the figure gets too complex, Matlab saves as Bitmap and you cannot edit it.

From the Mathworks website (Scroll down to "renderer"):

  • 'opengl' — OpenGL® renderer. This option enables MATLAB to access graphics hardware if it is available on your system. The OpenGL renderer displays objects sorted in front to back order, as seen on the monitor. Lines always draw in front of faces when at the same location on the plane of the monitor.

  • 'painters' — Painters renderer. This option works well for axes in a 2-D view. In 2-D, the Painters renderer sorts graphics objects by child order (order specified). In 3-D, the Painters renderer sorts objects in front to back order. However, it might not correctly draw intersecting polygons in 3-D.

See also this link on fixing low level graphics issues with OpenGL.

Upvotes: 1

Related Questions