Panda3D
eglGraphicsStateGuardian.h
1 // Filename: eglGraphicsStateGuardian.h
2 // Created by: pro-rsoft (21May09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGLGRAPHICSSTATEGUARDIAN_H
16 #define EGLGRAPHICSSTATEGUARDIAN_H
17 
18 #include "pandabase.h"
19 #include "eglGraphicsPipe.h"
20 #include "get_x11.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : eglGraphicsStateGuardian
24 // Description : A tiny specialization on GLESGraphicsStateGuardian
25 // to add some egl-specific information.
26 ////////////////////////////////////////////////////////////////////
27 #ifdef OPENGLES_2
28 class eglGraphicsStateGuardian : public GLES2GraphicsStateGuardian {
29 #else
30 class eglGraphicsStateGuardian : public GLESGraphicsStateGuardian {
31 #endif
32 public:
33  INLINE const FrameBufferProperties &get_fb_properties() const;
34  void get_properties(FrameBufferProperties &properties,
35  bool &pbuffer_supported, bool &pixmap_supported,
36  bool &slow, EGLConfig config);
37  void choose_pixel_format(const FrameBufferProperties &properties,
38  X11_Display *_display,
39  int _screen,
40  bool need_pbuffer, bool need_pixmap);
41 
43  eglGraphicsStateGuardian *share_with);
44 
45  virtual ~eglGraphicsStateGuardian();
46 
47  virtual void reset();
48 
49  bool egl_is_at_least_version(int major_version, int minor_version) const;
50 
51  EGLContext _share_context;
52  EGLContext _context;
53  EGLDisplay _egl_display;
54  X11_Display *_display;
55  int _screen;
56  XVisualInfo *_visual;
57  XVisualInfo *_visuals;
58  EGLConfig _fbconfig;
59  FrameBufferProperties _fbprops;
60 
61 protected:
62  virtual void gl_flush() const;
63  virtual GLenum gl_get_error() const;
64 
65  virtual void query_gl_version();
66  virtual void get_extra_extensions();
67  virtual void *do_get_extension_func(const char *name);
68 
69 private:
70  int _egl_version_major, _egl_version_minor;
71 
72 public:
73  static TypeHandle get_class_type() {
74  return _type_handle;
75  }
76  static void init_type() {
77 #ifdef OPENGLES_2
78  GLES2GraphicsStateGuardian::init_type();
79  register_type(_type_handle, "eglGraphicsStateGuardian",
80  GLES2GraphicsStateGuardian::get_class_type());
81 #else
82  GLESGraphicsStateGuardian::init_type();
83  register_type(_type_handle, "eglGraphicsStateGuardian",
84  GLESGraphicsStateGuardian::get_class_type());
85 #endif
86  }
87  virtual TypeHandle get_type() const {
88  return get_class_type();
89  }
90  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
91 
92 private:
93  static TypeHandle _type_handle;
94 };
95 
96 #include "eglGraphicsStateGuardian.I"
97 
98 #endif
bool egl_is_at_least_version(int major_version, int minor_version) const
Returns true if the runtime GLX version number is at least the indicated value, false otherwise...
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
void choose_pixel_format(const FrameBufferProperties &properties, X11_Display *_display, int _screen, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
virtual void reset()
Resets all internal state as if the gsg were newly created.
A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific information.
This class is the main interface to controlling the render process.
void get_properties(FrameBufferProperties &properties, bool &pbuffer_supported, bool &pixmap_supported, bool &slow, EGLConfig config)
Gets the FrameBufferProperties to match the indicated config.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...