fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / Action / RenderAction / OSGRenderActionTask.cpp
blob079ae48738e30597c4650d2a3d141ad2e686d333
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 #include <cstdlib>
40 #include <cstdio>
42 #include "OSGConfig.h"
44 #include "OSGRenderActionTask.h"
45 #include "OSGWindow.h"
46 #include "OSGDrawEnv.h"
48 OSG_BEGIN_NAMESPACE
50 /*! \class OSG::WindowDrawTask
53 RenderActionTask::RenderActionTask(UInt32 uiType) :
54 Inherited(uiType),
55 _pBarrier(NULL )
57 switch(_uiTypeTask)
59 case HandleGLFinish:
61 _pBarrier = Barrier::get(NULL, false);
62 _pBarrier->setNumWaitFor(2);
64 break;
66 default:
67 break;
71 RenderActionTask::~RenderActionTask(void)
73 _pBarrier = NULL;
76 void RenderActionTask::execute(HardwareContext *pContext, DrawEnv *pEnv)
78 #ifdef OSG_DEBUG
79 Window *pWindow = pEnv->getWindow();
81 OSG_ASSERT(pWindow != NULL);
82 #endif
84 switch(_uiTypeTask)
87 case HandleGLFinish:
89 #ifdef OSG_DUMP_RENDERTASK
90 fprintf(stderr, "HandleGLFinish\n");
91 fflush(stderr);
92 #endif
93 glFinish();
95 OSG_ASSERT(_pBarrier != NULL);
97 _pBarrier->enter();
99 break;
101 case HandleGLFinishNoWait:
103 #ifdef OSG_DUMP_RENDERTASK
104 fprintf(stderr, "HandleGLFinishNoWait\n");
105 fflush(stderr);
106 #endif
107 glFinish();
109 break;
111 default:
112 break;
116 void RenderActionTask::waitForBarrier(void)
118 OSG_ASSERT(_uiTypeTask == HandleGLFinish);
119 OSG_ASSERT(_pBarrier != NULL );
121 _pBarrier->enter();
124 void RenderActionTask::dump(UInt32 uiIndent)
126 for(UInt32 i = 0; i < uiIndent; ++i) { fprintf(stderr, " "); }
127 fprintf(stderr, "RenderActionTask : ");
129 switch(_uiTypeTask)
131 case HandleGLFinish:
133 fprintf(stderr, "HandleGLFinish\n");
135 break;
137 case HandleGLFinishNoWait:
139 fprintf(stderr, "HandleGLFinishNoWait\n");
141 break;
143 default:
145 fprintf(stderr, "Unknown\n");
147 break;
152 OSG_END_NAMESPACE