1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGWINDOWDRAWTASK_H_
40 #define _OSGWINDOWDRAWTASK_H_
46 #include "OSGDrawTask.h"
52 /*! \ingroup GrpSystemMemoryObjects
53 \ingroup GrpSystemRenderingBackendTasks
54 \ingroup GrpLibOSGSystem
57 class OSG_SYSTEM_DLLMAPPING WindowDrawTask
: public DrawTask
59 /*========================== PUBLIC =================================*/
63 static const UInt32 Init
= Inherited::LastType
+ 1;
64 static const UInt32 Activate
= Inherited::LastType
+ 2;
65 static const UInt32 FrameInit
= Inherited::LastType
+ 3;
66 static const UInt32 FrameExit
= Inherited::LastType
+ 4;
67 static const UInt32 Swap
= Inherited::LastType
+ 5;
68 static const UInt32 WaitAtBarrier
= Inherited::LastType
+ 6;
69 static const UInt32 DeactivateAndWait
= Inherited::LastType
+ 7;
70 static const UInt32 LastType
= DeactivateAndWait
;
72 typedef boost::function
<void (void)> GLInitFunctor
;
73 typedef DrawTask Inherited
;
75 /*---------------------------------------------------------------------*/
76 /*! \name Statistic */
79 WindowDrawTask(UInt32 uiType
);
82 /*---------------------------------------------------------------------*/
86 virtual void execute(HardwareContext
*pContext
, DrawEnv
*pEnv
);
89 /*---------------------------------------------------------------------*/
93 void waitForBarrier(void);
96 /*---------------------------------------------------------------------*/
100 void setInitFunc (GLInitFunctor oFunc
);
101 void setReinitExtFunctions (bool bVal
);
102 void setCreatePrivateContext(bool bVal
);
105 /*---------------------------------------------------------------------*/
109 virtual void dump(UInt32 uiIndent
);
112 /*========================= PROTECTED ===============================*/
116 /*---------------------------------------------------------------------*/
120 BarrierRefPtr _pBarrier
;
121 GLInitFunctor _oInitFunc
;
123 bool _bCreatePrivateContext
;
124 bool _bReinitExtFunctions
;
127 /*---------------------------------------------------------------------*/
128 /*! \name Destructor */
131 virtual ~WindowDrawTask(void);
134 /*========================== PRIVATE ================================*/
138 /*! \brief prohibit default function (move to 'public' if needed) */
139 WindowDrawTask(const WindowDrawTask
&source
);
140 /*! \brief prohibit default function (move to 'public' if needed) */
141 void operator =(const WindowDrawTask
&source
);
144 /*! \ingroup GrpSystemRenderingBackend
147 typedef RefCountPtr
<WindowDrawTask
,
148 MemObjRefCountPolicy
> WindowDrawTaskRefPtr
;
151 /*! \ingroup GrpSystemMemoryObjects
152 \ingroup GrpSystemRenderingBackendTasks
153 \ingroup GrpLibOSGSystem
156 class OSG_SYSTEM_DLLMAPPING ViewportDrawTask
: public DrawTask
158 /*========================== PUBLIC =================================*/
162 static const UInt32 Foregrounds
= Inherited::LastType
+ 1;
163 static const UInt32 LastType
= Foregrounds
;
165 typedef DrawTask Inherited
;
167 /*---------------------------------------------------------------------*/
168 /*! \name Statistic */
171 ViewportDrawTask(Viewport
*pPort
, UInt32 uiType
);
174 /*---------------------------------------------------------------------*/
178 virtual void execute(HardwareContext
*pContext
, DrawEnv
*pEnv
);
181 /*---------------------------------------------------------------------*/
185 void setIds (Int32 iDrawerId
,
188 Int32
getDrawerId (void ) const;
189 Int32
getDrawableId(void ) const;
192 /*---------------------------------------------------------------------*/
197 /*---------------------------------------------------------------------*/
201 virtual void dump(UInt32 uiIndent
);
204 /*========================= PROTECTED ===============================*/
208 /*---------------------------------------------------------------------*/
217 /*---------------------------------------------------------------------*/
218 /*! \name Destructor */
221 virtual ~ViewportDrawTask(void);
224 /*========================== PRIVATE ================================*/
228 /*! \brief prohibit default function (move to 'public' if needed) */
229 ViewportDrawTask(const ViewportDrawTask
&source
);
230 /*! \brief prohibit default function (move to 'public' if needed) */
231 void operator =(const ViewportDrawTask
&source
);
234 /*! \ingroup GrpSystemRenderingBackendTasks
237 typedef RefCountPtr
<ViewportDrawTask
,
238 MemObjRefCountPolicy
> ViewportDrawTaskRefPtr
;
240 /*! \ingroup GrpSystemMemoryObjects
241 \ingroup GrpSystemRenderingBackendTasks
242 \ingroup GrpLibOSGSystem
245 class OSG_SYSTEM_DLLMAPPING CallbackDrawTask
: public BlockingDrawTask
247 /*========================== PUBLIC =================================*/
251 static const UInt32 Callback
= Inherited::LastType
+ 1;
252 static const UInt32 LastType
= Callback
;
254 typedef BlockingDrawTask Inherited
;
256 typedef boost::function
<void (HardwareContext
*,
257 DrawEnv
*)> CallbackFunctor
;
259 /*---------------------------------------------------------------------*/
260 /*! \name Statistic */
263 CallbackDrawTask(UInt32 uiType
);
264 CallbackDrawTask(const CallbackFunctor
&fCallback
, UInt32 uiType
);
267 /*---------------------------------------------------------------------*/
271 virtual void execute(HardwareContext
*pContext
, DrawEnv
*pEnv
);
274 /*---------------------------------------------------------------------*/
278 void setCallback(const CallbackFunctor
&fCallback
);
281 /*---------------------------------------------------------------------*/
286 /*---------------------------------------------------------------------*/
291 /*---------------------------------------------------------------------*/
295 virtual void dump(UInt32 uiIndent
);
298 /*========================= PROTECTED ===============================*/
302 /*---------------------------------------------------------------------*/
306 CallbackFunctor _fCallback
;
309 /*---------------------------------------------------------------------*/
310 /*! \name Destructor */
313 virtual ~CallbackDrawTask(void);
316 /*========================== PRIVATE ================================*/
320 /*! \brief prohibit default function (move to 'public' if needed) */
321 CallbackDrawTask(const CallbackDrawTask
&source
);
322 /*! \brief prohibit default function (move to 'public' if needed) */
323 void operator =(const CallbackDrawTask
&source
);
326 /*! \ingroup GrpSystemRenderingBackendTasks
329 typedef RefCountPtr
<CallbackDrawTask
,
330 MemObjRefCountPolicy
> CallbackDrawTaskRefPtr
;
335 #include "OSGWindowDrawTask.inl"
337 #endif /* _OSGWINDOWDRAWTASK_H_ */