1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGVIEWER_GRAPHICSHANDLEX11
15#define OSGVIEWER_GRAPHICSHANDLEX11 1
17#include <osgViewer/Export>
20#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
24 #include <X11/Xutil.h>
27 #define GLX_GLXEXT_PROTOTYPES 1
30 #include <X11/Xutil.h>
32 #ifndef GLX_VERSION_1_3
33 typedef XID GLXPbuffer;
40/** Class to encapsulate platform-specific OpenGL context handle variables.
41 * Derived osg::GraphicsContext classes can inherit from this class to
42 * share OpenGL resources.*/
44class OSGVIEWER_EXPORT GraphicsHandleX11
52 /** Set X11 display.*/
53 inline void setDisplay(Display* display) { _display = display; }
55 /** Get X11 display.*/
56 inline Display* getDisplay() const { return _display; }
59 typedef EGLContext Context;
60 typedef EGLSurface Pbuffer;
62 typedef GLXContext Context;
63 typedef GLXPbuffer Pbuffer;
66 /** Set native OpenGL graphics context.*/
67 inline void setContext(Context context) { _context = context; }
69 /** Get native OpenGL graphics context.*/
70 inline Context getContext() const { return _context; }