fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / RenderingBackend / OSGWindowDrawTask.h
blobc2319441e16db36a010e572152065d866ada092b
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGWINDOWDRAWTASK_H_
40 #define _OSGWINDOWDRAWTASK_H_
42 #ifdef __sgi
43 #pragma once
44 #endif
46 #include "OSGDrawTask.h"
48 OSG_BEGIN_NAMESPACE
50 class Viewport;
52 /*! \ingroup GrpSystemMemoryObjects
53 \ingroup GrpSystemRenderingBackendTasks
54 \ingroup GrpLibOSGSystem
57 class OSG_SYSTEM_DLLMAPPING WindowDrawTask : public DrawTask
59 /*========================== PUBLIC =================================*/
61 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 */
77 /*! \{ */
79 WindowDrawTask(UInt32 uiType);
81 /*! \} */
82 /*---------------------------------------------------------------------*/
83 /*! \name Access */
84 /*! \{ */
86 virtual void execute(HardwareContext *pContext, DrawEnv *pEnv);
88 /*! \} */
89 /*---------------------------------------------------------------------*/
90 /*! \name Access */
91 /*! \{ */
93 void waitForBarrier(void);
95 /*! \} */
96 /*---------------------------------------------------------------------*/
97 /*! \name Access */
98 /*! \{ */
100 void setInitFunc (GLInitFunctor oFunc);
101 void setReinitExtFunctions (bool bVal );
102 void setCreatePrivateContext(bool bVal );
104 /*! \} */
105 /*---------------------------------------------------------------------*/
106 /*! \name Access */
107 /*! \{ */
109 virtual void dump(UInt32 uiIndent);
111 /*! \} */
112 /*========================= PROTECTED ===============================*/
114 protected:
116 /*---------------------------------------------------------------------*/
117 /*! \name Member */
118 /*! \{ */
120 BarrierRefPtr _pBarrier;
121 GLInitFunctor _oInitFunc;
123 bool _bCreatePrivateContext;
124 bool _bReinitExtFunctions;
126 /*! \} */
127 /*---------------------------------------------------------------------*/
128 /*! \name Destructor */
129 /*! \{ */
131 virtual ~WindowDrawTask(void);
133 /*! \} */
134 /*========================== PRIVATE ================================*/
136 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 =================================*/
160 public:
162 static const UInt32 Foregrounds = Inherited::LastType + 1;
163 static const UInt32 LastType = Foregrounds;
165 typedef DrawTask Inherited;
167 /*---------------------------------------------------------------------*/
168 /*! \name Statistic */
169 /*! \{ */
171 ViewportDrawTask(Viewport *pPort, UInt32 uiType);
173 /*! \} */
174 /*---------------------------------------------------------------------*/
175 /*! \name Access */
176 /*! \{ */
178 virtual void execute(HardwareContext *pContext, DrawEnv *pEnv);
180 /*! \} */
181 /*---------------------------------------------------------------------*/
182 /*! \name Access */
183 /*! \{ */
185 void setIds (Int32 iDrawerId,
186 Int32 iDrawableId);
188 Int32 getDrawerId (void ) const;
189 Int32 getDrawableId(void ) const;
191 /*! \} */
192 /*---------------------------------------------------------------------*/
193 /*! \name Access */
194 /*! \{ */
196 /*! \} */
197 /*---------------------------------------------------------------------*/
198 /*! \name Access */
199 /*! \{ */
201 virtual void dump(UInt32 uiIndent);
203 /*! \} */
204 /*========================= PROTECTED ===============================*/
206 protected:
208 /*---------------------------------------------------------------------*/
209 /*! \name Member */
210 /*! \{ */
212 Viewport *_pPort;
213 Int32 _iDrawerId;
214 Int32 _iDrawableId;
216 /*! \} */
217 /*---------------------------------------------------------------------*/
218 /*! \name Destructor */
219 /*! \{ */
221 virtual ~ViewportDrawTask(void);
223 /*! \} */
224 /*========================== PRIVATE ================================*/
226 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 =================================*/
249 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 */
261 /*! \{ */
263 CallbackDrawTask(UInt32 uiType);
264 CallbackDrawTask(const CallbackFunctor &fCallback, UInt32 uiType);
266 /*! \} */
267 /*---------------------------------------------------------------------*/
268 /*! \name Access */
269 /*! \{ */
271 virtual void execute(HardwareContext *pContext, DrawEnv *pEnv);
273 /*! \} */
274 /*---------------------------------------------------------------------*/
275 /*! \name Access */
276 /*! \{ */
278 void setCallback(const CallbackFunctor &fCallback);
280 /*! \} */
281 /*---------------------------------------------------------------------*/
282 /*! \name Access */
283 /*! \{ */
285 /*! \} */
286 /*---------------------------------------------------------------------*/
287 /*! \name Access */
288 /*! \{ */
290 /*! \} */
291 /*---------------------------------------------------------------------*/
292 /*! \name Access */
293 /*! \{ */
295 virtual void dump(UInt32 uiIndent);
297 /*! \} */
298 /*========================= PROTECTED ===============================*/
300 protected:
302 /*---------------------------------------------------------------------*/
303 /*! \name Member */
304 /*! \{ */
306 CallbackFunctor _fCallback;
308 /*! \} */
309 /*---------------------------------------------------------------------*/
310 /*! \name Destructor */
311 /*! \{ */
313 virtual ~CallbackDrawTask(void);
315 /*! \} */
316 /*========================== PRIVATE ================================*/
318 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;
333 OSG_END_NAMESPACE
335 #include "OSGWindowDrawTask.inl"
337 #endif /* _OSGWINDOWDRAWTASK_H_ */