changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / WindowSystem / Carbon / OSGCarbonWindow.cpp
blobd76e4cda3ed82607e99d82fec9d9bd819a62e6ca
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 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 //---------------------------------------------------------------------------
40 // Includes
41 //---------------------------------------------------------------------------
43 #include <cstdlib>
44 #include <cstdio>
46 #include "OSGConfig.h"
48 // Forget everything if we're not doing a Mac OS X compile
49 #if defined(__APPLE__) || defined(OSG_DO_DOC)
51 #include <AGL/agl.h>
53 #ifdef check
54 # undef check
55 #endif
57 #include "OSGCarbonWindow.h"
59 OSG_BEGIN_NAMESPACE
61 // Documentation for this class is emitted in the
62 // OSGCarbonWindowBase.cpp file.
63 // To modify it, please change the .fcd file (OSGCarbonWindow.fcd) and
64 // regenerate the base file.
66 /***************************************************************************\
67 * Class variables *
68 \***************************************************************************/
70 /***************************************************************************\
71 * Class methods *
72 \***************************************************************************/
74 void CarbonWindow::initMethod(InitPhase ePhase)
76 Inherited::initMethod(ePhase);
78 if(ePhase == TypeObject::SystemPost)
84 /***************************************************************************\
85 * Instance methods *
86 \***************************************************************************/
88 /*-------------------------------------------------------------------------*\
89 - private -
90 \*-------------------------------------------------------------------------*/
92 /*----------------------- constructors & destructors ----------------------*/
94 CarbonWindow::CarbonWindow(void) :
95 Inherited()
99 CarbonWindow::CarbonWindow(const CarbonWindow &source) :
100 Inherited(source)
104 CarbonWindow::~CarbonWindow(void)
108 /*----------------------------- class specific ----------------------------*/
110 void CarbonWindow::changed(ConstFieldMaskArg whichField,
111 UInt32 origin,
112 BitVector details)
114 Inherited::changed(whichField, origin, details);
117 void CarbonWindow::dump( UInt32 ,
118 const BitVector ) const
120 SLOG << "Dump CarbonWindow NI" << std::endl;
123 /*-------------------------- your_category---------------------------------*/
125 /*! Init the window: create the context and setup the OpenGL.
127 void CarbonWindow::init(GLInitFunctor oFunc)
129 Inherited::init(oFunc);
132 void CarbonWindow::terminate(void)
136 // activate the window: bind the OGL context
137 void CarbonWindow::doActivate( void )
139 aglSetCurrentContext(getContext());
142 // activate the window: bind the OGL context
143 void CarbonWindow::doDeactivate( void )
145 aglSetCurrentContext(0);
148 // swap front and back buffers
149 bool CarbonWindow::doSwap( void )
151 aglSwapBuffers(getContext());
152 return true;
155 bool CarbonWindow::hasContext(void)
157 return (this->getContext() != NULL);
160 OSG_END_NAMESPACE
162 #endif // __APPLE__