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 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
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)
57 #include "OSGCarbonWindow.h"
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 /***************************************************************************\
68 \***************************************************************************/
70 /***************************************************************************\
72 \***************************************************************************/
74 void CarbonWindow::initMethod(InitPhase ePhase
)
76 Inherited::initMethod(ePhase
);
78 if(ePhase
== TypeObject::SystemPost
)
84 /***************************************************************************\
86 \***************************************************************************/
88 /*-------------------------------------------------------------------------*\
90 \*-------------------------------------------------------------------------*/
92 /*----------------------- constructors & destructors ----------------------*/
94 CarbonWindow::CarbonWindow(void) :
99 CarbonWindow::CarbonWindow(const CarbonWindow
&source
) :
104 CarbonWindow::~CarbonWindow(void)
108 /*----------------------------- class specific ----------------------------*/
110 void CarbonWindow::changed(ConstFieldMaskArg whichField
,
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());
155 bool CarbonWindow::hasContext(void)
157 return (this->getContext() != NULL
);