Panda3D
eglGraphicsStateGuardian.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eglGraphicsStateGuardian.h
10  * @author rdb
11  * @date 2009-05-21
12  */
13 
14 #ifndef EGLGRAPHICSSTATEGUARDIAN_H
15 #define EGLGRAPHICSSTATEGUARDIAN_H
16 
17 #include "pandabase.h"
18 #include "eglGraphicsPipe.h"
19 
20 #ifdef USE_X11
21 #include "get_x11.h"
22 #endif
23 
24 #ifdef OPENGLES_2
25 typedef GLES2GraphicsStateGuardian BaseGraphicsStateGuardian;
26 #elif defined(OPENGLES_1)
27 typedef GLESGraphicsStateGuardian BaseGraphicsStateGuardian;
28 #else
29 typedef GLGraphicsStateGuardian BaseGraphicsStateGuardian;
30 #endif
31 
32 /**
33  * A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific
34  * information.
35  */
36 class eglGraphicsStateGuardian : public BaseGraphicsStateGuardian {
37 public:
38  INLINE const FrameBufferProperties &get_fb_properties() const;
39  void get_properties(FrameBufferProperties &properties,
40  bool &pbuffer_supported, bool &pixmap_supported,
41  bool &slow, EGLConfig config);
42  void choose_pixel_format(const FrameBufferProperties &properties,
43  eglGraphicsPipe *egl_pipe, bool need_window,
44  bool need_pbuffer, bool need_pixmap);
45 
47  eglGraphicsStateGuardian *share_with);
48 
49  virtual ~eglGraphicsStateGuardian();
50 
51  virtual void reset();
52 
53  bool egl_is_at_least_version(int major_version, int minor_version) const;
54 
55  EGLContext _share_context;
56  EGLContext _context;
57  EGLDisplay _egl_display;
58 #ifdef USE_X11
59  XVisualInfo *_visual = nullptr;
60 #endif
61  EGLConfig _fbconfig;
62  FrameBufferProperties _fbprops;
63 
64 protected:
65  virtual void gl_flush() const;
66  virtual GLenum gl_get_error() const;
67 
68  virtual void query_gl_version();
69  virtual void get_extra_extensions();
70  virtual void *do_get_extension_func(const char *name);
71 
72 private:
73  int _egl_version_major, _egl_version_minor;
74 
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  BaseGraphicsStateGuardian::init_type();
81  register_type(_type_handle, "eglGraphicsStateGuardian",
82  BaseGraphicsStateGuardian::get_class_type());
83  }
84  virtual TypeHandle get_type() const {
85  return get_class_type();
86  }
87  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
88 
89 private:
90  static TypeHandle _type_handle;
91 };
92 
94 
95 #endif
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This graphics pipe represents the interface for creating OpenGL ES graphics windows on an X-based (e....
A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific information.
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
virtual void reset()
Resets all internal state as if the gsg were newly created.
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.
void choose_pixel_format(const FrameBufferProperties &properties, eglGraphicsPipe *egl_pipe, bool need_window, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
void get_properties(FrameBufferProperties &properties, bool &pbuffer_supported, bool &pixmap_supported, bool &slow, EGLConfig config)
Gets the FrameBufferProperties to match the indicated config.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22