OpendTect  6.3
swapbuffercallback.h
Go to the documentation of this file.
1 #ifndef swapbuffercallback_h
2 #define swapbuffercallback_h
3 
4 /*+
5  ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: Oct 2015
10 ________________________________________________________________________
11 
12 */
13 
14 #include <osg/GraphicsContext>
15 
16 #include "visscene.h"
17 #include "ui3dviewerbody.h"
18 
25 class SwapCallback : public osg::GraphicsContext::SwapCallback
26 {
27 public:
29  : scene_( 0 )
30  , nrleft_( 2 )
31  , body_( body )
32  {}
33  void swapBuffersImplementation(osg::GraphicsContext* gc)
34  {
35  gc->swapBuffersImplementation();
36  if ( scene_ && nrleft_ )
37  {
38  nrleft_--;
39  if ( !nrleft_ )
40  {
41  scene_->contextIsUp.trigger();
43  removeSwapCallback));
44  }
45  }
46  }
47 
48 
49  int nrleft_;
52 };
53 
54 #endif
visBase::Scene * scene_
Definition: swapbuffercallback.h:50
void swapBuffersImplementation(osg::GraphicsContext *gc)
Definition: swapbuffercallback.h:33
int nrleft_
Definition: swapbuffercallback.h:49
Baseclass for different body implementation (direct & indirect) of OSG.
Definition: ui3dviewerbody.h:59
Class for a swap callback. This class triggers on the second render that the context is up an running...
Definition: swapbuffercallback.h:25
#define mCB(obj, clss, fn)
To make your CallBack. Used in many places, especially the UI.
Definition: callback.h:41
SwapCallback(ui3DViewerBody *body)
Definition: swapbuffercallback.h:28
Notifier< Scene > contextIsUp
Definition: visscene.h:74
static bool addToMainThread(const CallBack &, CallBacker *=0)
Scene manages all DataObjects and has some managing functions such as the selection management and va...
Definition: visscene.h:38
ui3DViewerBody * body_
Definition: swapbuffercallback.h:51

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017