MATLAB Answers

Johan
1

Line smoothing in MATLAB2014b

Asked by Johan
on 7 Oct 2014
Latest activity Answered by Fernando
on 22 Oct 2014
Hello! So quick question about the new graphics system for matlab 2014b. I noticed that I do not get the nice smoothed (antialiased?) lines that I see on the website. I understand that this is related to the Opengl version but which version is required for this functionality.
Thanks in advance!

  0 Comments

Sign in to comment.

5 Answers

Answer by Benjamin Kraus on 7 Oct 2014
 Accepted Answer

The following page describes what version of OpenGL is required for different features in MATLAB R2014b. http://www.mathworks.com/help/matlab/creating_plots/system-requirements-for-matlab-graphics.html
From the page, graphics smoothing (anti-aliasing) requires OpenGL 3.0 or later. You can find out what version of OpenGL you have by executing the following command in MATLAB:
>> opengl info

  0 Comments

Sign in to comment.


Answer by Johan
on 8 Oct 2014

Thank you guys for the response. Indeed my old videocard only support opengl 2.1. Its a bit weird though I remember trying the 'hidden' -hgVersion 2 on older matlab version and I believe that there I did have the line smoothing. Maybe my memory is wrong (which is definetely a viable answer :P ) or something got changed in the way line smoothing is performed.

  0 Comments

Sign in to comment.


Answer by Mike Garrity
on 8 Oct 2014
Edited by Mike Garrity
on 8 Oct 2014

I'm planning to do a post on this soon on our new graphics blog. The subject's a bit complicated, but I'll try to do the short version here.
We've tried a few different antialiasing techniques over the years. There is no perfect one. They all have strengths and weaknesses. The big reason we chose the one which requires OpenGL 3 as the first one we support and document is that it works on a wider range of geometry types. Consider the following example.
a=linspace(0,2*pi,200);
r=(2+cos(24*a))/6;
h1 = plot(a,besselj(1,2*a));
h2 = patch(4+r.*cos(a),r.*sin(a),zeros(size(a)), ...
'FaceColor','red','EdgeColor','none')
In R2014b, both the blue line and the red patch are antialiased if you're using the OpenGL renderer. As you know, the earlier, unsupported technique allowed you to antialias the line in earlier releases, but didn't do anything for the patch.

  0 Comments

Sign in to comment.


Answer by Fernando
on 22 Oct 2014

I have a 2012 Retina Macbook Pro, which according to this page should support OpenGL 4.1 http://support.apple.com/kb/HT5942
But when I do the info command, I get the following. Anyone know what's going on?
>> opengl info
Version: '2.1 NVIDIA-10.0.43 310.41.05f01'
Vendor: 'NVIDIA Corporation'
Renderer: 'NVIDIA GeForce GT 650M OpenGL Engine'
MaxTextureSize: 16384
Visual: 'Visual (Undefined), (RGBA 32 bits (8...'
Software: 'false'
SupportsGraphicsSmoothing: 1
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 1
Extensions: {138x1 cell}
MaxFrameBufferSize: 16384

  0 Comments

Sign in to comment.


Answer by Doug Hull on 7 Oct 2014

Without knowing what card you have installed, it is hard to answer this. In general, the newer drivers are going to be better. If you contact support: http://www.mathworks.com/support they can get your information and help you out the best.

  0 Comments

Sign in to comment.