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 /// delete gridfunctions
DLL_HEADER void Ng_ClearSolutionData(); DLL_HEADER void Ng_ClearSolutionData();
// redraw // redraw
DLL_HEADER void Ng_Redraw(); DLL_HEADER void Ng_Redraw(bool blocking = false);
/// ///
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler); DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
/// ///

View File

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

View File

@ -112,10 +112,16 @@ namespace netgen
} }
extern DLL_HEADER void Render(); extern DLL_HEADER void Render(bool blocking);
DLL_HEADER void Render () 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 namespace netgen
{ {
extern void Render (); extern void Render (bool blocking);
} }
void Ng_Redraw () void Ng_Redraw (bool blocking)
{ {
#ifdef OPENGL #ifdef OPENGL
netgen::vssolution.UpdateSolutionTimeStamp(); netgen::vssolution.UpdateSolutionTimeStamp();
netgen::Render(); netgen::Render(blocking);
#endif #endif
} }

View File

@ -971,6 +971,7 @@ proc timer2 { } {
Ng_ReadStatus Ng_ReadStatus
if { $multithread_redraw == 1 } { if { $multithread_redraw == 1 } {
# non-blocking redraw
set multithread_redraw 0; set multithread_redraw 0;
redraw; redraw;
@ -980,6 +981,20 @@ proc timer2 { } {
.ndraw Ng_VideoClip addframe .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 # global mem_moveable
# set mem_moveable [Ng_MemInfo moveable] # set mem_moveable [Ng_MemInfo moveable]

View File

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