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 #include "get_x11.h"
20 
21 /**
22  * A tiny specialization on GLESGraphicsStateGuardian to add some egl-specific
23  * information.
24  */
25 #ifdef OPENGLES_2
26 class eglGraphicsStateGuardian : public GLES2GraphicsStateGuardian {
27 #else
28 class eglGraphicsStateGuardian : public GLESGraphicsStateGuardian {
29 #endif
30 public:
31  INLINE const FrameBufferProperties &get_fb_properties() const;
32  void get_properties(FrameBufferProperties &properties,
33  bool &pbuffer_supported, bool &pixmap_supported,
34  bool &slow, EGLConfig config);
35  void choose_pixel_format(const FrameBufferProperties &properties,
36  X11_Display *_display,
37  int _screen,
38  bool need_pbuffer, bool need_pixmap);
39 
41  eglGraphicsStateGuardian *share_with);
42 
43  virtual ~eglGraphicsStateGuardian();
44 
45  virtual void reset();
46 
47  bool egl_is_at_least_version(int major_version, int minor_version) const;
48 
49  EGLContext _share_context;
50  EGLContext _context;
51  EGLDisplay _egl_display;
52  X11_Display *_display;
53  int _screen;
54  XVisualInfo *_visual;
55  XVisualInfo *_visuals;
56  EGLConfig _fbconfig;
57  FrameBufferProperties _fbprops;
58 
59 protected:
60  virtual void gl_flush() const;
61  virtual GLenum gl_get_error() const;
62 
63  virtual void query_gl_version();
64  virtual void get_extra_extensions();
65  virtual void *do_get_extension_func(const char *name);
66 
67 private:
68  int _egl_version_major, _egl_version_minor;
69 
70 public:
71  static TypeHandle get_class_type() {
72  return _type_handle;
73  }
74  static void init_type() {
75 #ifdef OPENGLES_2
76  GLES2GraphicsStateGuardian::init_type();
77  register_type(_type_handle, "eglGraphicsStateGuardian",
78  GLES2GraphicsStateGuardian::get_class_type());
79 #else
80  GLESGraphicsStateGuardian::init_type();
81  register_type(_type_handle, "eglGraphicsStateGuardian",
82  GLESGraphicsStateGuardian::get_class_type());
83 #endif
84  }
85  virtual TypeHandle get_type() const {
86  return get_class_type();
87  }
88  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
89 
90 private:
91  static TypeHandle _type_handle;
92 };
93 
95 
96 #endif
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:52
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:81
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...