Ocean
apple/GLESBitmapFramebuffer.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_APPLE_GLES_BITMAP_FRAMEBUFFER_H
9 #define META_OCEAN_RENDERING_GLES_APPLE_GLES_BITMAP_FRAMEBUFFER_H
10 
16 
19 
20 #ifdef OCEAN_PLATFORM_BUILD_APPLE_MACOS
21 
22 namespace Ocean
23 {
24 
25 namespace Rendering
26 {
27 
28 namespace GLESceneGraph
29 {
30 
31 namespace Apple
32 {
33 
34 /**
35  * This class is the base class for all GLESceneGraph bitmap framebuffers for Apple platforms.
36  * @ingroup renderinggles
37  */
38 class OCEAN_RENDERING_GLES_EXPORT GLESBitmapFramebuffer :
39  virtual public GLESFramebuffer,
40  virtual public BitmapFramebuffer
41 {
42  friend class GLESEngineApple;
43 
44  public:
45 
46  /**
47  * Sets the viewport of this framebuffer.
48  * @see Framebuffer::setViewport().
49  */
50  void setViewport(const unsigned int left, const unsigned int top, const unsigned int width, const unsigned int height) override;
51 
52  /**
53  * Renders the next frame into the framebuffer.
54  * @see Framebuffer::render().
55  */
56  void render() override;
57 
58  /**
59  * Renders the next frame and copies the image content into to a given frame.
60  * @see Framebuffer::render().
61  */
62  bool render(Frame& frame, Frame* depthFrame = nullptr) override;
63 
64  /**
65  * Makes this framebuffer to the current one.
66  * @see Framebuffer::makeCurrent().
67  */
68  void makeCurrent() override;
69 
70  /**
71  * Makes this framebuffer to non current.
72  * @see Framebuffer::makeNoncurrent().
73  */
74  void makeNoncurrent() override;
75 
76  private:
77 
78  /**
79  * Creates a new window framebuffer.
80  */
82 
83  /**
84  * Destructs a window framebuffer.
85  */
87 
88  /**
89  * Initializes the framebuffer.
90  * @see Framebuffer::initialize().
91  */
92  bool initialize(const FramebufferRef& shareFramebuffer = FramebufferRef()) override;
93 
94  /**
95  * Initialize the OpenGL ES dispaly and context.
96  * @return True, if succeeded
97  */
98  bool initializeContext() override;
99 
100  /**
101  * Releases the framebuffer.
102  * @see Framebuffer::release().
103  */
104  void release() override;
105 
106  protected:
107 
108  /// The CGL context object.
109  CGLContextObj contextObject_ = nullptr;
110 
111  /// The texture framebuffer in which this framebuffer will be rendered.
113 };
114 
115 }
116 
117 }
118 
119 }
120 
121 }
122 
123 #endif // OCEAN_PLATFORM_BUILD_APPLE_MACOS
124 
125 #endif // META_OCEAN_RENDERING_GLES_APPLE_GLES_BITMAP_FRAMEBUFFER_H
This class implements Ocean's image class.
Definition: Frame.h:1760
This class is the base class for all bitmap framebuffers.
Definition: BitmapFramebuffer.h:37
This class is the base class for all GLESceneGraph bitmap framebuffers for Apple platforms.
Definition: apple/GLESBitmapFramebuffer.h:41
void makeCurrent() override
Makes this framebuffer to the current one.
TextureFramebufferRef textureFrambuffer_
The texture framebuffer in which this framebuffer will be rendered.
Definition: apple/GLESBitmapFramebuffer.h:112
bool initialize(const FramebufferRef &shareFramebuffer=FramebufferRef()) override
Initializes the framebuffer.
bool initializeContext() override
Initialize the OpenGL ES dispaly and context.
GLESBitmapFramebuffer()
Creates a new window framebuffer.
~GLESBitmapFramebuffer() override
Destructs a window framebuffer.
void setViewport(const unsigned int left, const unsigned int top, const unsigned int width, const unsigned int height) override
Sets the viewport of this framebuffer.
void release() override
Releases the framebuffer.
void render() override
Renders the next frame into the framebuffer.
bool render(Frame &frame, Frame *depthFrame=nullptr) override
Renders the next frame and copies the image content into to a given frame.
void makeNoncurrent() override
Makes this framebuffer to non current.
This class implements the engine for Apple platforms.
Definition: GLESEngineApple.h:31
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
SmartObjectRef< Framebuffer > FramebufferRef
Definition of a smart object reference holding a framebuffer.
Definition: rendering/Framebuffer.h:31
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15