OpenGL and print
3 views (last 30 days)
Show older comments
I've searched the blogs and answers but haven't found a satisfactory answer except that there is no satisfactory answer... so i'll ask here just to check. I am running R2011a 64bit Ubuntu O/S, fyi.
I am making a figure that uses transparency and was using jbfill from the file exchange. The script is great and produces a nice looking screen figure. However, when I print the figure to a file using print('-dpsc2','-r300','example.ps'), the ps file is total junk when using transparency<1 (in jbfill) and the ps file is fine when transparency is off (=1 in jbfill). seems like OpenGL is the problem. Is there any additional settings I can use to successfully print a figure with transparency (ie. with OpenGL) to a postscript or other file type? here's a sample script based on something in jbfill.m:
a=rand(1,20);
b=a+2*rand(1,20);
x=1:20;
% no transparency, ps file is fine
figure(1)
[ph,msg]=jbfill(x,a,b,'b','b',0,1);
print('-dpsc2','-r300','example1.ps');
% transparency, ps file is total junk
figure(2)
[ph,msg]=jbfill(x,a,b,'b','b',0,0.5);
print('-dpsc2','-r300','example2.ps');
1 Comment
Oliver Woodford
on 24 Dec 2011
I would rename the question "Exporting figures with transparency as vector graphics" as it is more informative.
Answers (6)
Walter Roberson
on 20 Dec 2011
Transparency like you would like to use is not supported by Postscript. See http://en.wikipedia.org/wiki/Transparency_%28graphic%29#Transparency_in_PostScript
Meanwhile, have you tried Oliver's FEX contribution export_fig ?
Brian
on 20 Dec 2011
1 Comment
Walter Roberson
on 20 Dec 2011
The only known issue I see on that page is that transparency is not supported for the painters renderer. It isn't supported for zbuffer either but the page doesn't mention that. The portion of the page describing the -transparency flag indicates that you can use full blended transparency if you are exporting to PNG files (using OpenGL renderer)
Brian
on 21 Dec 2011
7 Comments
Walter Roberson
on 21 Dec 2011
That doesn't happen to mention the card model of your card. When I poke around the FireGL drivers, it appears the drivers are generally in the 8 series of versions, and it appears there is a beta version from January,
http://support.amd.com/us/gpudownload/fire/Pages/fire_beta_linux.aspx?type=2.4.3;2.4.5;2.4.7&product=2.4.3.3.2.3.17&lang=us&rev=8.801%20Beta&ostype=Linux%20x86_64
reference page http://support.amd.com/us/psearch/Pages/psearch.aspx?type=2.4.3%3b2.4.5%3b2.4.7&product=2.4.3.3.2.3.17&contentType=GPU+Download+Detail&ostype=Linux+x86_64&keywords=&items=20
If you are using the most recent driver, perhaps you could consider installing Mesa ?
Oliver Woodford
on 24 Dec 2011
To get transparency in vector graphics output, export your figure to an SVG file. Then convert to any other vector format you want using an external application such as Inkscape.
0 Comments
Lisandro
on 23 Sep 2014
Hi, I had the same issue (I could print the figures using 'opengl software' but I couldn't with 'opengl hardware' in Matlab) and the problem was solved when I updated the video drivers
In my case I was using Ubuntu 12.04 (and afterwards 14.04) with an Intel Ivy Bridge. I downloaded and installed Mesa plus the Intel graphics Downloader manager (it's in the Ubuntu repository).
The problem was solved after I upgraded the drivers to their latest version.
Hope this helps
Best
0 Comments
Catherine
on 11 Nov 2014
Hi,
I had a similar problem trying to export figures with transparency (patch objects with the FaceAlpha property set to 0.5 for instance) in a PNG format with export_fig.
I filed a support request at MathWorks and the thing that resolved the issue was to set the OpenGL option 'software' to 'true' before doing anything else.
So just after startup, I type :
>> opengl software
And the call to export_fig works fine. I get a PNG file with transparency.
Hope this can help!
0 Comments
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!