Selecting Drawing Methods

Double Buffering

Overview

Set DoubleBuffer to on when you are animating lines rendered in painters with EraseMode set to normal.

More Details

Double buffering is the process of drawing into an offscreen pixel buffer and then blitting the buffer contents to the screen once the drawing is complete (instead of drawing directly to the screen, where the process of drawing is visible as it progresses). Double buffering generally produces flash-free rendering for simple animations (such as those involving lines, as opposed to objects containing large numbers of polygons).

The figure DoubleBuffer property accepts the values on and off, with on being the default. You can select double buffering only when the figure Renderer property is set to painters. zbuffer and opengl always use double buffering and ignore this property.

Use double buffering with the animated object's EraseMode property set to normal.

Selecting a Renderer

Overview

The MATLAB software automatically selects the best renderer based on the complexity of the graphics objects and the options available on your system.

More Details

A renderer is the software that processes graphics data (such as vertex coordinates) into a form that MATLAB can use to draw into the figure. MATLAB supports three renderers:

Painters

Painters method is faster when the figure contains only simple or small graphics. It cannot be used with lighting.

Z-Buffer

Z-buffering is the process of determining how to render each pixel by drawing only the front-most object, as opposed to drawing all objects back to front, redrawing objects that obscure those behind. The pixel data is buffered and then blitted to the screen all at once.

Z-buffering is generally faster for more complex graphics, but can be slower for very simple graphics. You can set the Renderer property to whatever produces the fastest drawing (either zbuffer or painters), or let MATLAB decide which method to use by setting the RendererMode property to auto (the default).

Printing from Z-Buffer.   You can select the resolution of the PostScript file produced by the print command using the -r option. By default, MATLAB prints Z-buffered figures at a medium resolution of 150 dpi (the default with Renderer set to painters is 864 dpi).

The size of the file generated from a Z-buffer figure does not depend on its contents, just the size of the figure. To decrease the file size, make the PaperPosition property smaller before printing (or set PaperPositionMode to auto and resize the figure window).

OpenGL

OpenGL is available on many computer systems. It is generally faster than either painters or Z-buffer and in some cases enables MATLAB to use the system's graphics hardware (which results in significant speed increase). See the figure Renderer property for more information.

Limitations of OpenGL.   OpenGL has two limitations when compared to painters and Z-buffer:

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS