1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 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 _OSGHARDWARECONTEXT_H_
40 #define _OSGHARDWARECONTEXT_H_
45 #include "OSGHardwareContextBase.h"
46 #include "OSGHardwareContextThread.h"
53 /*! \brief HardwareContext class. See \ref
54 PageBaseHardwareContext for a description.
56 \ingroup GrpBaseHardwareContext
57 \ingroup GrpLibOSGBase
62 class OSG_BASE_DLLMAPPING HardwareContext
: public HardwareContextBase
66 /*========================== PUBLIC =================================*/
70 typedef HardwareContextBase Inherited
;
71 typedef HardwareContext Self
;
75 OpenGLInitialized
= 0x0001,
76 CudaInitialized
= 0x0002,
77 OpenCLInitialized
= 0x0004
82 HasAttribAliasing
= 0x0001,
83 HasVAODListProblems
= 0x0002
86 /*---------------------------------------------------------------------*/
90 virtual void changed(ConstFieldMaskArg whichField
,
95 /*---------------------------------------------------------------------*/
99 virtual void dump( UInt32 uiIndent
= 0,
100 const BitVector bvFlags
= 0) const;
103 /*---------------------------------------------------------------------*/
107 virtual void submitTask (HardwareContextTask
*pTask
) = 0;
108 virtual void submitTaskAndWait(BlockingTask
*pTask
) = 0;
111 /*---------------------------------------------------------------------*/
115 void setCudaInit(void);
118 /*---------------------------------------------------------------------*/
122 UInt32
getOGLFeatures (void) const;
123 bool hasAttribAliasing (void) const;
124 bool hasVAODListProblems(void) const;
127 /*========================= PROTECTED ===============================*/
131 // Variables should all be in HardwareContextBase.
133 HardwareContextThreadRefPtr _pContextThread
;
135 UInt32 _uiOGLFeatures
;
137 /*---------------------------------------------------------------------*/
138 /*! \name Constructors */
141 HardwareContext(void);
142 HardwareContext(const HardwareContext
&source
);
145 /*---------------------------------------------------------------------*/
146 /*! \name Destructors */
149 virtual ~HardwareContext(void);
152 /*---------------------------------------------------------------------*/
153 /*! \name MT Construction */
156 void onCreate (const HardwareContext
*source
= NULL
);
158 void onCreateAspect (const HardwareContext
*createAspect
,
159 const HardwareContext
*source
= NULL
);
161 void onDestroy ( UInt32 uiContainerId
);
163 void onDestroyAspect( UInt32 uiContainerId
,
167 /*---------------------------------------------------------------------*/
171 void setOpenGLInit(void);
173 UInt32
getInitState (void) const;
176 /*---------------------------------------------------------------------*/
180 virtual void clearData(FieldContainer
*pContainer
,
181 ConstFieldMaskArg whichField
,
185 /*---------------------------------------------------------------------*/
189 static void initMethod(InitPhase ePhase
);
192 /*========================== PRIVATE ================================*/
196 friend class FieldContainer
;
197 friend class HardwareContextBase
;
199 // prohibit default functions (move to 'public' if you need one)
200 void operator =(const HardwareContext
&source
);
203 typedef HardwareContext
*HardwareContextP
;
207 #include "OSGHardwareContextBase.inl"
208 #include "OSGHardwareContext.inl"
210 #endif /* _OSGHARDWARECONTEXT_H_ */