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 // Forget everything if we're not doing a windows compile
51 #include "OSGEGLWindow.h"
57 // Documentation for this class is emited in the
58 // OSGEGLWindowBase.cpp file.
59 // To modify it, please change the .fcd file (OSGEGLWindow.fcd) and
60 // regenerate the base file.
62 /*----------------------- constructors & destructors ----------------------*/
66 EGLWindow::EGLWindow(void) :
73 EGLWindow::EGLWindow(const EGLWindow
&source
) :
80 EGLWindow::~EGLWindow(void)
83 if(getHglrc() != NULL
)
84 wglDeleteContext(getHglrc());
88 /*----------------------------- class specific ----------------------------*/
90 //! initialize the static features of the class, e.g. action callbacks
92 void EGLWindow::initMethod(InitPhase ePhase
)
94 Inherited::initMethod(ePhase
);
97 //! react to field changes
99 void EGLWindow::changed(ConstFieldMaskArg whichField
,
103 Inherited::changed(whichField
, origin
, details
);
106 //! output the instance for debug purposes
108 void EGLWindow::dump( UInt32
,
109 const BitVector
) const
111 SLOG
<< "Dump EGLWindow NI" << std::endl
;
114 /*-------------------------- your_category---------------------------------*/
116 /*! init the window: create the HDC and HGLRC
118 void EGLWindow::init( void )
124 /*! activate the window: set the HDC and bind the OGL context
126 void EGLWindow::activate(void)
128 if(!eglMakeCurrent(getDisplay(), getWindow(), getWindow(), getContext()))
131 std::cerr << "EGLWindow::activate: failed: "
138 void EGLWindow::deactivate(void)
140 eglMakeCurrent(getDisplay(),
146 // swap front and back buffers
147 bool EGLWindow::swap( void )
149 return eglSwapBuffers(getDisplay(), getWindow());
152 #endif // OSG_USE_EGL