#define OCC_REDRAW_WINDOWAREA 2
#define OCC_REDRAW_BITMAP 3
-/*
- This flag, when bitwise OR`ed with the "reason" value,
- informs the callback that it is called before redrawing the overlayer .
- Otherwise, the callback is invoked after the overlayer is redrawn.
-*/
+// The flags below provide additional information to define the moment when
+// callback was invoked in redraw procedure. These flags are bitwise OR'ed
+// with the "reason" value of callback:
+// 1) OCC_PRE_REDRAW - callback was invoked before redrawing underlayer
+// ( at the beginning of redraw procedure );
+// 2) OCC_PRE_OVERLAY - callback was invoked before redrawing overlayer;
+// Otherwise, if no flags added to the "reason" value, the callback was
+// invoked at the end of redraw ( after the overlayer is redrawn )
+#define OCC_PRE_REDRAW 0x4000
#define OCC_PRE_OVERLAY 0x8000
+// mask for all additional callbacks that invoked in process of redrawing
+#define OCC_REDRAW_ADDITIONAL_CALLBACKS ( OCC_PRE_REDRAW | OCC_PRE_OVERLAY )
+
typedef struct {
int reason;
int wsID;
int NIS_View::MyCallback (Aspect_Drawable /* Window ID */,
void* ptrData,
- Aspect_GraphicCallbackStruct* /* call data */)
+ Aspect_GraphicCallbackStruct* callData /* call data */)
{
+ // Avoid multiple rendering of the scene ( accordingly with update of
+ // callback mechanism, that invokes additional callbacks before
+ // underlay and overlay redrawing with OCC_PRE_REDRAW and OCC_PRE_OVERLAY
+ // bits added to the "reason" value of the callback data structure;
+ // see comments to OCC_REDRAW_ADDITIONAL_CALLBACKS definition )
+ if (callData->reason & OCC_REDRAW_ADDITIONAL_CALLBACKS)
+ return 0;
+
const Handle(NIS_View) thisView (static_cast<NIS_View *> (ptrData));
NCollection_List<NIS_InteractiveContext *>::Iterator anIter;
#ifdef CLIP
{
// prepare for redraw
call_func_redraw_all_structs_begin (aview->WsId);
+ call_subr_displayCB (aview, OCC_REDRAW_BITMAP | OCC_PRE_REDRAW);
call_togl_setplane (aview);
// clear background
}
OpenGl_ResourceCleaner::GetInstance()->Cleanup();
call_func_redraw_all_structs_begin (aview->WsId);
+ call_subr_displayCB (aview, OCC_REDRAW_WINDOW | OCC_PRE_REDRAW);
call_togl_setplane( aview );
if (anunderlayer->ptrLayer)
{
(GLsizei )width, (GLsizei )height);
OpenGl_ResourceCleaner::GetInstance()->Cleanup();
call_func_redraw_all_structs_begin (aview->WsId);
+ call_subr_displayCB (aview, OCC_REDRAW_WINDOWAREA | OCC_PRE_REDRAW);
call_togl_setplane( aview );
if (anunderlayer->ptrLayer)
{