Ocean
qt/GLESWindowFramebuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_GLES_QT_GLES_WINDOW_FRAMEBUFFER_H
9 #define META_OCEAN_RENDERING_GLES_QT_GLES_WINDOW_FRAMEBUFFER_H
10 
15 
17 
18 #include <QtWidgets/QOpenGLWidget>
19 
20 namespace Ocean
21 {
22 
23 namespace Rendering
24 {
25 
26 namespace GLESceneGraph
27 {
28 
29 namespace QT
30 {
31 
32 /**
33  * This class is the base class for all GLESceneGraph window framebuffers for Qt-enabled platforms.
34  * @ingroup renderinggles
35  */
37  virtual public QOpenGLWidget,
38  virtual public GLESFramebuffer,
39  virtual public WindowFramebuffer
40 {
41  friend class GLESEngineQT;
42 
43  public:
44 
45  /**
46  * Returns the transformation between display and device.
47  * @see Framebuffer::device_T_display().
48  */
50 
51  /**
52  * Sets the transformation between display and device.
53  * @see Framebuffer::setDevice_T_display().
54  */
56 
57  /**
58  * Renders the next frame into the framebuffer.
59  * @see Framebuffer::render().
60  */
61  void render() override;
62 
63  /**
64  * Sets the platform dependent framebuffer base id or handle and initializes the framebuffer.
65  * @see WindowFramebuffer::initializeById().
66  */
67  bool initializeById(const size_t id, const FramebufferRef& shareFramebuffer) override;
68 
69  private:
70 
71  /**
72  * Creates a new window framebuffer.
73  */
75 
76  /**
77  * Destructs a window framebuffer.
78  */
80 
81  /**
82  * Initialize the OpenGL ES dispaly and context.
83  * @return True, if succeeded
84  */
85  bool initializeContext() override;
86 
87  /**
88  * This virtual function is called whenever the widget needs to be painted.
89  * @see QOpenGLWidget::paintGL().
90  */
91  void paintGL() override;
92 
93  /**
94  * This virtual function is called whenever the widget has been resized.
95  * @see QOpenGLWidget::resizeGL().
96  */
97  void resizeGL(int width, int height) override;
98 
99  /**
100  * This virtual function is called once before the first call to paintGL() or resizeGL().
101  * @see QOpenGLWidget::initializeGL().
102  */
103  void initializeGL() override;
104 
105  protected:
106 
107  /// The transformation between display and device.
109 
110  /// The previous devicePixelRatio, e.g., is > 1 on Apple's retina desplays.
112 };
113 
114 }
115 
116 }
117 
118 }
119 
120 }
121 
122 #endif // META_OCEAN_RENDERING_GLES_QT_GLES_WINDOW_FRAMEBUFFER_H
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
This class implements the engine for QT platforms.
Definition: GLESEngineQT.h:31
This class is the base class for all GLESceneGraph window framebuffers for Qt-enabled platforms.
Definition: qt/GLESWindowFramebuffer.h:40
bool initializeById(const size_t id, const FramebufferRef &shareFramebuffer) override
Sets the platform dependent framebuffer base id or handle and initializes the framebuffer.
int previousDevicePixelRatio_
The previous devicePixelRatio, e.g., is > 1 on Apple's retina desplays.
Definition: qt/GLESWindowFramebuffer.h:111
void resizeGL(int width, int height) override
This virtual function is called whenever the widget has been resized.
HomogenousMatrix4 device_T_display() const override
Returns the transformation between display and device.
HomogenousMatrix4 device_T_display_
The transformation between display and device.
Definition: qt/GLESWindowFramebuffer.h:108
bool initializeContext() override
Initialize the OpenGL ES dispaly and context.
void initializeGL() override
This virtual function is called once before the first call to paintGL() or resizeGL().
~GLESWindowFramebuffer() override
Destructs a window framebuffer.
bool setDevice_T_display(const HomogenousMatrix4 &device_T_display) override
Sets the transformation between display and device.
void paintGL() override
This virtual function is called whenever the widget needs to be painted.
void render() override
Renders the next frame into the framebuffer.
GLESWindowFramebuffer()
Creates a new window framebuffer.
This class is the base class for all window framebuffers.
Definition: rendering/WindowFramebuffer.h:55
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition: HomogenousMatrix4.h:37
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15