blocking Redraw

This commit is contained in:
Joachim Schoeberl 2014-12-04 10:24:45 +00:00
parent 215fd1bca7
commit 8f13c6828e
6 changed files with 32 additions and 11 deletions

View File

@ -324,7 +324,7 @@ extern "C" {
/// delete gridfunctions
DLL_HEADER void Ng_ClearSolutionData();
// redraw
DLL_HEADER void Ng_Redraw();
DLL_HEADER void Ng_Redraw(bool blocking = false);
///
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
///

View File

@ -1110,11 +1110,11 @@ namespace netgen
// void CopyFrom(const MeshingParameters & other);
void (*render_function)() = NULL;
void Render()
void (*render_function)(bool) = NULL;
void Render(bool blocking = false)
{
if (render_function)
(*render_function)();
(*render_function)(blocking);
}
};

View File

@ -112,10 +112,16 @@ namespace netgen
}
extern DLL_HEADER void Render();
DLL_HEADER void Render ()
extern DLL_HEADER void Render(bool blocking);
DLL_HEADER void Render (bool blocking)
{
multithread.redraw = 1;
if (blocking)
{
multithread.redraw = 2;
while (multithread.redraw == 2) ;
}
else
multithread.redraw = 1;
}

View File

@ -4609,14 +4609,14 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
namespace netgen
{
extern void Render ();
extern void Render (bool blocking);
}
void Ng_Redraw ()
void Ng_Redraw (bool blocking)
{
#ifdef OPENGL
netgen::vssolution.UpdateSolutionTimeStamp();
netgen::Render();
netgen::Render(blocking);
#endif
}

View File

@ -971,6 +971,7 @@ proc timer2 { } {
Ng_ReadStatus
if { $multithread_redraw == 1 } {
# non-blocking redraw
set multithread_redraw 0;
redraw;
@ -980,6 +981,20 @@ proc timer2 { } {
.ndraw Ng_VideoClip addframe
}
}
if { $multithread_redraw == 2 } {
# blocking redraw
redraw;
set multithread_redraw 0;
global videoactive
if { $videoactive == 1 } {
puts "addframe"
.ndraw Ng_VideoClip addframe
}
after 1 { timer2 }
return
}
# global mem_moveable
# set mem_moveable [Ng_MemInfo moveable]

View File

@ -1364,7 +1364,7 @@ namespace netgen
multithread.running = 1;
multithread.terminate = 0;
extern void Render();
extern void Render(bool blocking);
mparam.render_function = &Render;
for (int i = 0; i < geometryregister.Size(); i++)