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?

 Respuesta aceptada

Matt Fig
Matt Fig el 8 de Jun. de 2011
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 comentarios

Daryl
Daryl el 8 de Jun. de 2011
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 el 8 de Jun. de 2011
It is mentioned here:
http://www.mathworks.com/support/bugreports/384622
Walter Roberson
Walter Roberson el 8 de Jun. de 2011
Heh. I didn't know about that bug report, but this is exactly the solution I would have suggested to try.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Jun. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by