Ocean
Loading...
Searching...
No Matches
windows/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_WINDOWS_GLES_BITMAP_FRAMEBUFFER_H
9#define META_OCEAN_RENDERING_GLES_WINDOWS_GLES_BITMAP_FRAMEBUFFER_H
10
11#ifndef _WINDOWS
12 #error This file is available on Windows platforms only!
13#endif
14
20
22
25
26#include <gl/wglext.h>
27
28namespace Ocean
29{
30
31namespace Rendering
32{
33
34namespace GLESceneGraph
35{
36
37namespace Windows
38{
39
40/**
41 * This class is the base class for all GLESceneGraph window framebuffers for Windows platforms.
42 * @ingroup renderinggles
43 */
44class OCEAN_RENDERING_GLES_EXPORT GLESBitmapFramebuffer :
45 virtual public GLESFramebuffer,
46 virtual public BitmapFramebuffer
47{
48 friend class GLESEngineWindows;
49
50 public:
51
52 /**
53 * Sets the viewport of this framebuffer.
54 * @see Framebuffer::setViewport().
55 */
56 void setViewport(const unsigned int left, const unsigned int top, const unsigned int width, const unsigned int height) override;
57
58 /**
59 * Renders the next frame into the framebuffer.
60 * @see Framebuffer::render().
61 */
62 void render() override;
63
64 /**
65 * Renders the next frame and copies the image content into to a given frame.
66 * @see Framebuffer::render().
67 */
68 bool render(Frame& frame, Frame* depthFrame = nullptr) override;
69
70 /**
71 * Makes this framebuffer to the current one.
72 * @see Framebuffer::makeCurrent().
73 */
74 void makeCurrent() override;
75
76 /**
77 * Makes this framebuffer to non current.
78 * @see Framebuffer::makeNoncurrent().
79 */
80 void makeNoncurrent() override;
81
82 /**
83 * Returns the texture framebuffer object of this framebuffer.
84 * @return The framebuffer's texture framebuffer object
85 */
86 inline TextureFramebufferRef textureFramebuffer() const;
87
88 private:
89
90 /**
91 * Creates a new GLESceneGraph bitmap framebuffer.
92 */
94
95 /**
96 * Destructs a GLESceneGraph bitmap framebuffer.
97 */
99
100 /**
101 * Initializes the framebuffer.
102 * @see Framebuffer::initialize().
103 */
104 bool initialize(const FramebufferRef& shareFramebuffer = FramebufferRef()) override;
105
106 /**
107 * Initialize the OpenGL ES display and context.
108 * @return True, if succeeded
109 */
110 bool initializeContext() override;
111
112 /**
113 * Releases the framebuffer.
114 * @see Framebuffer::release().
115 */
116 void release() override;
117
118 /**
119 * Acquires all OpenGL function pointers.
120 * @return True, if succeeded
121 */
123
124 protected:
125
126 /// The OpenGL context handle.
127 HGLRC contextHandle_ = nullptr;
128
129 /// The function pointer to wglCreateContextAttribsARB.
130 PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB_ = nullptr;
131
132 /// The function pointer to wglChoosePixelFormatARB.
133 PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB_ = nullptr;
134
135 /// The bitmap of the framebuffer for which the OpenGL context will be created.
137
138 /// The texture framebuffer in which this framebuffer will be rendered.
140};
141
146
147}
148
149}
150
151}
152
153}
154
155#endif // META_OCEAN_RENDERING_GLES_WINDOWS_GLES_BITMAP_FRAMEBUFFER_H
This class implements Ocean's image class.
Definition Frame.h:1808
This class implements a main window.
Definition win/BitmapWindow.h:29
This class is the base class for all bitmap framebuffers.
Definition BitmapFramebuffer.h:37
This class implements a base for all GLESceneGraph framebuffers.
Definition rendering/glescenegraph/GLESFramebuffer.h:34
This class is the base class for all GLESceneGraph window framebuffers for Windows platforms.
Definition windows/GLESBitmapFramebuffer.h:47
void render() override
Renders the next frame into the framebuffer.
~GLESBitmapFramebuffer() override
Destructs a GLESceneGraph bitmap framebuffer.
GLESBitmapFramebuffer()
Creates a new GLESceneGraph bitmap framebuffer.
void makeNoncurrent() override
Makes this framebuffer to non current.
bool render(Frame &frame, Frame *depthFrame=nullptr) override
Renders the next frame and copies the image content into to a given frame.
bool initializeContext() override
Initialize the OpenGL ES display and context.
TextureFramebufferRef textureFrambuffer_
The texture framebuffer in which this framebuffer will be rendered.
Definition windows/GLESBitmapFramebuffer.h:139
bool initialize(const FramebufferRef &shareFramebuffer=FramebufferRef()) override
Initializes the framebuffer.
void makeCurrent() override
Makes this framebuffer to the current one.
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.
Platform::Win::BitmapWindow contextBitmapWindow_
The bitmap of the framebuffer for which the OpenGL context will be created.
Definition windows/GLESBitmapFramebuffer.h:136
TextureFramebufferRef textureFramebuffer() const
Returns the texture framebuffer object of this framebuffer.
Definition windows/GLESBitmapFramebuffer.h:142
bool acquireGLFunctions()
Acquires all OpenGL function pointers.
This class implements the engine for Windows platforms.
Definition GLESEngineWindows.h:31
The namespace covering the entire Ocean framework.
Definition Accessor.h:15