Why is it that when I create patches using the opengl renderer in MATLAB 7.7 (R2008b), the data plotted is incorrect?

1 view (last 30 days)
When I use OpenGL renderer to create patches in MATLAB 7.7 (R2008b) the data is plotted incorrectly, wheras when I use another renderer such as Painter or ZBuffer, the data is accurate.
Reproduction Code:
This gives the incorrect result:
figure
set(gcf,'renderer','opengl');
p2 = patch([500000.99 500001 500001 500000.99],[0.8 0.8 1.2 1.2],'r');
xlim([500000.99-.05 500001+.05])
This gives the correct result:
figure
set(gcf,'renderer','painters');
p2 = patch([500000.99 500001 500001 500000.99],[0.8 0.8 1.2 1.2],'r');
xlim([500000.99-.05 500001+.05])

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Jul 2009
The OpenGL renderer uses only single precision. As a result, and the numbers that are being plotted are not able to be resolved using OpenGL. The Painters and ZBuffer renderers use double precision, so, unit differences between numbers on the order of 1e7 are able to be resolved. This becomes especially relevant when using data input such as dates and trying to resolve hours.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2008b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!