Optimizing drawnow for large real-time simulation
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone. I am using this basic setup for a real-time simulation. The profiler states that most of the time (60%) is spent in drawnow. My geometries are made of ~6000 vertices ( v ) and ~14000 faces ( f ). I am currently reaching 15 frames per second (fps) and would like to target ~20 fps. I have tried replacing drawnow with pause() but it either gets too slow or it starts skipping frames. Do you have any suggestions?
- I have tried switching between renderers without any success and modifying e.g. 'XData' instead of 'vertices' results in improper rendering and is not recommended (see comment below).
dt=0.02;
hsurf=trisurf(f,v(:,1),v(:,2),v(:,3));
axis([-15 15 -15 15 -15 15]);
for t:1:T
v=function_to_update_vertices(v,dt);
set(hsurf,'vertices',v); %faces stays the same
drawnow
end
0 commentaires
Réponses (1)
Sean de Wolski
le 12 Avr 2013
Modifié(e) : Sean de Wolski
le 12 Avr 2013
Have you tried using all three renderers to see which is the fastest for this application? Or are you tied to OpenGL for transparency?
My only other suggestion might be to try setting the 'XData', 'YData', 'ZData' explicitly rather than the 'Vertices' which then have to calculate the above. I do not know if this will improve speed or not.
4 commentaires
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!