1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 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 #include "OSGPassiveWindow.h"
49 #include "OSGRenderActionBase.h"
50 #include "OSGRenderActionTask.h"
53 # if defined(OSG_USE_OGL3_PROTOS) || defined(OSG_USE_OGL4_PROTOS)
54 //# include <GL3/glx3.h>
55 # include <GLArb/glxarb.h>
60 #if defined(__APPLE__) && !OSG_APPLE_IOS
61 #include "OSGCocoaWindowWrapper.h"
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 /***************************************************************************\
73 \***************************************************************************/
75 /***************************************************************************\
77 \***************************************************************************/
79 void PassiveWindow::initMethod (InitPhase ePhase
)
84 /***************************************************************************\
86 \***************************************************************************/
88 /*-------------------------------------------------------------------------*\
90 \*-------------------------------------------------------------------------*/
92 /*----------------------- constructors & destructors ----------------------*/
94 PassiveWindow::PassiveWindow(void) :
98 (_sfDrawMode
.getValue() & ~Window::ContextMask
) |
99 (Window::ExternalContext
| Window::PassiveContext
) );
102 PassiveWindow::PassiveWindow(const PassiveWindow
&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
,
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
)
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
140 Inherited::setDisplay(glXGetCurrentDisplay ());
141 Inherited::setContext(glXGetCurrentContext ());
142 Inherited::setWindow (glXGetCurrentDrawable());
150 void PassiveWindow::terminate(void)
152 Window::doTerminate();
154 Inherited::setContext(NULL
);