changed: gcc8 base update
[opensg.git] / Source / System / Window / Passive / OSGPassiveWindow.cpp
blob0c8f72a5ae73aa68caaf2fa5f68cf6d2916f88d3
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 //---------------------------------------------------------------------------
40 // Includes
41 //---------------------------------------------------------------------------
43 #include <cstdlib>
44 #include <cstdio>
46 #include "OSGConfig.h"
48 #include "OSGPassiveWindow.h"
49 #include "OSGRenderActionBase.h"
50 #include "OSGRenderActionTask.h"
52 #ifdef OSG_USE_GLX
53 # if defined(OSG_USE_OGL3_PROTOS) || defined(OSG_USE_OGL4_PROTOS)
54 //# include <GL3/glx3.h>
55 # include <GLArb/glxarb.h>
56 # else
57 # include <GL/glx.h>
58 # endif
59 #endif
60 #if defined(__APPLE__) && !OSG_APPLE_IOS
61 #include "OSGCocoaWindowWrapper.h"
62 #endif
64 OSG_USING_NAMESPACE
66 // Documentation for this class is emited in the
67 // OSGPassiveWindowBase.cpp file.
68 // To modify it, please change the .fcd file (OSGPassiveWindow.fcd) and
69 // regenerate the base file.
71 /***************************************************************************\
72 * Class variables *
73 \***************************************************************************/
75 /***************************************************************************\
76 * Class methods *
77 \***************************************************************************/
79 void PassiveWindow::initMethod (InitPhase ePhase)
84 /***************************************************************************\
85 * Instance methods *
86 \***************************************************************************/
88 /*-------------------------------------------------------------------------*\
89 - private -
90 \*-------------------------------------------------------------------------*/
92 /*----------------------- constructors & destructors ----------------------*/
94 PassiveWindow::PassiveWindow(void) :
95 Inherited()
97 _sfDrawMode.setValue(
98 (_sfDrawMode.getValue() & ~Window::ContextMask ) |
99 (Window::ExternalContext | Window::PassiveContext) );
102 PassiveWindow::PassiveWindow(const PassiveWindow &source) :
103 Inherited(source)
105 _sfDrawMode.setValue(
106 (_sfDrawMode.getValue() & ~Window::ContextMask ) |
107 (Window::ExternalContext | Window::PassiveContext) );
110 PassiveWindow::~PassiveWindow(void)
114 /*----------------------------- class specific ----------------------------*/
116 void PassiveWindow::changed(ConstFieldMaskArg whichField,
117 UInt32 origin,
118 BitVector details)
120 Inherited::changed(whichField, origin, details);
123 void PassiveWindow::dump( UInt32 ,
124 const BitVector ) const
126 SLOG << "Dump PassiveWindow NI" << std::endl;
129 /*! Just call the standard OpenGL setup.
131 void PassiveWindow::init(GLInitFunctor oFunc)
133 #if defined(WIN32)
134 Inherited::setHdc (wglGetCurrentDC ());
135 Inherited::setHglrc(wglGetCurrentContext());
136 #elif defined(__APPLE__) && !OSG_APPLE_IOS
137 Inherited::setContext(cocoaWrapperCurrentContext());
138 #elif defined(__APPLE__) && OSG_APPLE_IOS
139 #else
140 Inherited::setDisplay(glXGetCurrentDisplay ());
141 Inherited::setContext(glXGetCurrentContext ());
142 Inherited::setWindow (glXGetCurrentDrawable());
143 #endif
145 this->doActivate();
147 Window::init(oFunc);
150 void PassiveWindow::terminate(void)
152 Window::doTerminate();
154 Inherited::setContext(NULL);