This function toggles the rendering method used for screen and printing.
rend rend(FigureHandle) rend('NewRenderer') rend(FigureHandle,'NewRenderer') rend('NewRenderer','Default') [NewRenderer,OldRenderer] = rend(...)
rend toggles the current figure renderer by cycling through painters, zbuffer, and OpenGL. If renderer is currently set to none, painters will be used. Cycling order is
Renderers differ as follows:
- painters - The original rendering method used by MATLAB is faster when the figure contains only simple or small graphics objects.
- zbuffer - MATLAB draws graphics objects faster and more accurately because it colors objects on a per-pixel basis and MATLAB renders only those pixels that are visible in the scene (thus eliminating front-to-back sorting errors). Note that this method can consume a lot of system memory if MATLAB is displaying a complex scene.
- OpenGL - OpenGL is a renderer that is available on many computer systems. This renderer is generally faster than painters or zbuffer and in some cases enables MATLAB to access graphics hardware that is available on some systems.
rend(FigureHandle) performs rend on the figure given by FigureHandle.
rend('NewRenderer') specifies the new renderer to apply to the current figure. This is equivalent to set(gcf,'Renderer','NewRenderer').
rend(FigureHandle,'NewRenderer') specifies the new renderer to apply to the figure given by FigureHandle. This is equivalent to set(FigureHandle,'Renderer','NewRenderer').
rend('Default','NewRenderer') sets the default figure renderer to NewRenderer, which can be 'painters', 'zbuffer', 'OpenGL', or 'none'. This command is equivalent to set(0,'DefaultFigureRenderer,'NewRenderer').
[NewRenderer,OldRenderer] = rend(...) returns the new and previous renderers for the figure.
First we'll draw a figure:
h = surf(peaks); set(h,'facealpha',.5,'edgecolor',[.5 .4 .3])
That looks nice. I wonder what the current renderer is.
ans = OpenGL
Now cycle through renderers:
for n = 1:6 newRend = rend; title(newRend) snapnow end
...and so on.
The default figure renderer may easily be set by including the 'default' tag as an argument in rend:
Above we just set the default figure renderer to painters. As proof, we'll run rend again, resetting the default renderer to 'none':
[New,Old] = rend('default','none')
New = none Old = zbuffer
This function written by Chad A. Greene of the University of Texas at Austin's Institute for Geophysics (UTIG) in August of 2014.