Cannot use GETFRAME when rendering in OpenGL

I'm trying to render this code:
myVideo=VideoWriter('video.avi');
myVideo.FrameRate=4;
open(myVideo);
fnPLOT % Plots a patch graphic to an axes
for index=1:10
fnRotate % rotates the rendered graphic
drawnow
currFrame=getFrame(gcf);
writeVideo(myVideo,currFrame);
end
close(myVideo);
This makes a figure animation that rotates. The problem is that getFrame grabs a blank frame rather than the figure.
System: Windows-7x64, Matlab R2011a, Nvidia GeForce GTX 280M (SLI)
What I've tried:
1. Switching to zbuffers as the rendering engine works. However, my patch has alpha (transparancy) properties which are not rendered using zbuffers.
2. Disabled Aero interface (never used it to begin with)
3. Tried on dual monitor setup and single monitor.
4. Tried using figure embedded ("docked") within Java GUI
5. Tried assigning figure handle to figure, and using getFrame(h).
6. Tried capturing frames to a structure variable, then outputing that variable using the writeVideo command.
F(index)=getFrame;
end
writeVideo(myVideo,F);
close(myVideo);
None of these seem to work. Has anyone else run into this difficulty?

 採用された回答

Matt Fig
Matt Fig 2011 年 6 月 8 日

0 投票

Try this, but don't use a docked figure. Just use GETFRAME the normal way, but switch to software rendering of OPENGL. You should still be able to use transparency.
opengl('software')

3 件のコメント

Daryl
Daryl 2011 年 6 月 8 日
This solved the problem. I assume there must be an issue when the writeVideo function sends data to the GPU for processing. Rendering using the CPU seems to work just fine. I may have overlooked this in the bug report... if not, it should be mentioned in the writeVideo help file.
Thank you for your insight!
Matt Fig
Matt Fig 2011 年 6 月 8 日
It is mentioned here:
http://www.mathworks.com/support/bugreports/384622
Walter Roberson
Walter Roberson 2011 年 6 月 8 日
Heh. I didn't know about that bug report, but this is exactly the solution I would have suggested to try.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

質問済み:

2011 年 6 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by