mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
blocking Redraw
This commit is contained in:
parent
215fd1bca7
commit
8f13c6828e
@ -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);
|
||||
///
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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++)
|
||||
|
Loading…
Reference in New Issue
Block a user