AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EglContext.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/config/AGX_USE_EGL.h>
20 
21 #if AGX_USE_EGL()
22 
23 #include <EGL/egl.h>
24 #include <EGL/eglext.h>
25 
26 #undef Status
27 #undef Bool
28 #undef Convex
29 
30 
32 #include <osg/GraphicsContext>
33 #include <agx/PopDisableWarnings.h>
34 
35 namespace agxOSG
36 {
37 
50  class EglContext : public osg::GraphicsContext
51  {
52  public:
53  EglContext(osg::GraphicsContext::Traits* traits);
54 
55  virtual bool isSameKindAs(const Object* object) const;
56 
57  virtual const char* libraryName() const;
58  virtual const char* className() const;
59 
60  virtual bool valid() const;
61 
63  virtual bool realizeImplementation();
64 
66  virtual bool isRealizedImplementation() const;
67 
69  virtual void closeImplementation();
70 
72  virtual bool makeCurrentImplementation();
73 
75  virtual bool makeContextCurrentImplementation(osg::GraphicsContext* readContext);
76 
78  virtual bool releaseContextImplementation();
79 
81  virtual void bindPBufferToTextureImplementation(GLenum buffer);
82 
84  virtual void swapBuffersImplementation();
85 
86  protected:
87  ~EglContext();
88 
89  void init();
90 
91  void queryDevices();
92  EGLDisplay getDisplayFromDevice( EGLDeviceEXT dev );
93 
94  EGLSurface m_eglSurface;
95  EGLDisplay m_eglDisplay;
96  EGLContext m_eglContext;
97 
98  EGLDeviceEXT* m_eglDevices;
99 
101 
102  bool m_valid;
105 
106  };
107 
108 }
109 
110 #endif
111 
EGLDisplay m_eglDisplay
Definition: EglContext.h:95
int32_t Int32
Definition: Integer.h:45
virtual void bindPBufferToTextureImplementation(GLenum buffer)
Bind the graphics context to associated texture implementation.
virtual const char * libraryName() const
unsigned int GLenum
Definition: gl.h:5449
virtual bool makeContextCurrentImplementation(osg::GraphicsContext *readContext)
Make this graphics context current with specified read context implementation.
EGLDeviceEXT * m_eglDevices
Definition: EglContext.h:98
EGLDisplay getDisplayFromDevice(EGLDeviceEXT dev)
virtual bool isSameKindAs(const Object *object) const
virtual bool releaseContextImplementation()
Release the graphics context.
EGLContext m_eglContext
Definition: EglContext.h:96
virtual bool realizeImplementation()
Realise the GraphicsContext.
agx::Int32 m_numDevices
Definition: EglContext.h:100
virtual void closeImplementation()
Close the graphics context.
virtual bool valid() const
EglContext(osg::GraphicsContext::Traits *traits)
EGLSurface m_eglSurface
Definition: EglContext.h:94
virtual void swapBuffersImplementation()
Swap the front and back buffers.
virtual const char * className() const
virtual bool makeCurrentImplementation()
Make this graphics context current.
EglContext is a class that provides a different way to setup a graphics context for 3D rendering...
Definition: EglContext.h:50
virtual bool isRealizedImplementation() const
Return true if the graphics context has been realised and is ready to use.