Added EGL support into build system for GLES1 + GLES2.
Added EGL support into GraphicsWindowX11.
This commit is contained in:
@@ -20,6 +20,11 @@
|
||||
|
||||
#ifndef GL_CLIP_PLANE0
|
||||
#define GL_CLIP_PLANE0 0x3000
|
||||
#define GL_CLIP_PLANE1 0x3001
|
||||
#define GL_CLIP_PLANE2 0x3002
|
||||
#define GL_CLIP_PLANE3 0x3003
|
||||
#define GL_CLIP_PLANE4 0x3004
|
||||
#define GL_CLIP_PLANE5 0x3005
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
|
||||
#if !defined(GL_VERSION_2_0)
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
|
||||
#endif
|
||||
|
||||
#if !defined(GL_VERSION_2_0) && !defined(GL_ES_VERSION_2_0)
|
||||
#define GL_VERSION_2_0 1
|
||||
#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
|
||||
@@ -44,8 +49,6 @@ typedef char GLchar;
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
|
||||
#ifndef GL_LIGHT0
|
||||
#define GL_LIGHT0 0x4000
|
||||
#define GL_LIGHT1 0x4001
|
||||
#define GL_LIGHT2 0x4002
|
||||
#define GL_LIGHT3 0x4003
|
||||
#define GL_LIGHT4 0x4004
|
||||
#define GL_LIGHT5 0x4005
|
||||
#define GL_LIGHT6 0x4006
|
||||
#define GL_LIGHT7 0x4007
|
||||
#endif
|
||||
|
||||
#ifndef GL_LIGHTING
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
#include <osg/Matrix>
|
||||
|
||||
#ifndef GL_RESCALE_NORMAL
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#endif
|
||||
|
||||
#ifndef GL_NORMALIZE
|
||||
#define GL_NORMALIZE 0x0BA1
|
||||
#endif
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -24,7 +24,17 @@
|
||||
#define GLX_GLXEXT_PROTOTYPES 1
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
#define OSG_USE_EGL
|
||||
#include <EGL/egl.h>
|
||||
#else
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace osgViewer
|
||||
@@ -41,7 +51,10 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
_parent(0),
|
||||
_window(0),
|
||||
_visualInfo(0),
|
||||
_glxContext(0),
|
||||
_context(0),
|
||||
#ifdef OSG_USE_EGL
|
||||
_surface(0),
|
||||
#endif
|
||||
_currentCursor(0),
|
||||
_initialized(false),
|
||||
_realized(false),
|
||||
@@ -144,7 +157,15 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
|
||||
Window& getParent() { return _parent; }
|
||||
Window& getWindow() { return _window; }
|
||||
GLXContext& getGLXContext() { return _glxContext; }
|
||||
|
||||
|
||||
#ifdef OSG_USE_EGL
|
||||
typedef EGLContext Context;
|
||||
#else
|
||||
typedef GLXContext Context;
|
||||
#endif
|
||||
|
||||
Context& getContext() { return _context; }
|
||||
|
||||
Cursor getCurrentCursor() { return _currentCursor; }
|
||||
|
||||
@@ -180,7 +201,11 @@ class OSGVIEWER_EXPORT GraphicsWindowX11 : public osgViewer::GraphicsWindow
|
||||
Window _parent;
|
||||
Window _window;
|
||||
XVisualInfo* _visualInfo;
|
||||
GLXContext _glxContext;
|
||||
Context _context;
|
||||
|
||||
#ifdef OSG_USE_EGL
|
||||
EGLSurface _surface;
|
||||
#endif
|
||||
|
||||
Cursor _currentCursor;
|
||||
|
||||
|
||||
@@ -19,19 +19,14 @@
|
||||
#ifndef OSGVIEWER_PIXELBUFFERX11
|
||||
#define OSGVIEWER_PIXELBUFFERX11 1
|
||||
|
||||
#include <osg/GraphicsContext>
|
||||
#include <osgViewer/Export>
|
||||
#include <osgViewer/api/X11/GraphicsWindowX11>
|
||||
|
||||
#define GLX_GLXEXT_PROTOTYPES 1
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
typedef XID GLXPbuffer;
|
||||
#ifndef OSG_USE_EGL
|
||||
#ifndef GLX_VERSION_1_3
|
||||
typedef XID GLXPbuffer;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace osgViewer
|
||||
{
|
||||
|
||||
@@ -77,8 +72,16 @@ class OSGVIEWER_EXPORT PixelBufferX11 : public osg::GraphicsContext
|
||||
|
||||
Display* getDisplay() const { return _display; }
|
||||
|
||||
GLXPbuffer& getPbuffer() { return _pbuffer; }
|
||||
GLXContext& getGLXContext() { return _glxContext; }
|
||||
#ifdef OSG_USE_EGL
|
||||
typedef EGLContext Context;
|
||||
typedef EGLSurface Pbuffer;
|
||||
#else
|
||||
typedef GLXContext Context;
|
||||
typedef GLXPbuffer Pbuffer;
|
||||
#endif
|
||||
|
||||
Pbuffer& getPbuffer() { return _pbuffer; }
|
||||
Context& getContext() { return _context; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -90,9 +93,9 @@ class OSGVIEWER_EXPORT PixelBufferX11 : public osg::GraphicsContext
|
||||
|
||||
bool _valid;
|
||||
Display* _display;
|
||||
GLXPbuffer _pbuffer;
|
||||
Pbuffer _pbuffer;
|
||||
XVisualInfo* _visualInfo;
|
||||
GLXContext _glxContext;
|
||||
Context _context;
|
||||
|
||||
bool _initialized;
|
||||
bool _realized;
|
||||
|
||||
Reference in New Issue
Block a user