AGX Dynamics  2.37.3.2
EglContext.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
100  agx::Int32 m_numDevices;
101 
102  bool m_valid;
103  bool m_initialized;
104  bool m_realized;
105 
106  };
107 
108 }
109 
110 #endif
111 
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
int32_t Int32
Definition: Integer.h:45
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.