This repository was archived by the owner on Apr 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoffscreen_render_target.hpp
More file actions
125 lines (109 loc) · 4.03 KB
/
Copy pathoffscreen_render_target.hpp
File metadata and controls
125 lines (109 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#pragma once
#include <interfaces/image_format.hpp>
#include <interfaces/pixel_buffer.hpp>
#include <interfaces/render_context.hpp>
namespace bnb::oep::interfaces
{
class offscreen_render_target;
}
using rendered_texture_t = void*;
using offscreen_render_target_sptr = std::shared_ptr<bnb::oep::interfaces::offscreen_render_target>;
namespace bnb::oep::interfaces
{
class offscreen_render_target
{
public:
/**
* Create the offscreen render target.
*
* @param rc - shared pointer to rendering context
*
* @return - shared pointer to the offscreen render target
*
* @example bnb::oep::interfaces::offscreen_render_target::create(my_rc)
*/
static offscreen_render_target_sptr create(render_context_sptr rc);
virtual ~offscreen_render_target() = default;
/**
* Offscreen Render Target initialization. Includes initialization of gl context's
* buffers and support objects.
* Called by offscreen effect player.
*
* @param width Initial width of the offscreen render target
* @param width Initial height of the offscreen render target
*
* @example init(1280, 720)
*/
virtual void init(int32_t width, int32_t height) = 0;
/**
* Offscreen Render Target deinitialization. Should be called within the same thread as init();
* Called by offscreen effect player.
*
* @example deinit()
*/
virtual void deinit() = 0;
/**
* Notify about rendering surface being resized.
* Called by offscreen effect player.
*
* @param width New width for the rendering surface
* @param height New height for the rendering surface
*
* @example surface_changed(1280, 720)
*/
virtual void surface_changed(int32_t width, int32_t height) = 0;
/**
* Activate context for current thread
*
* @example activate_context()
*/
virtual void activate_context() = 0;
/**
* Deactivate context in the corresponding thread
* In the certain cases (GLFW on Windows) when it is intended to make OGL resource sharing
* it is required that sharing context is not active in any thread.
*
* @example deactivate_context()
*/
virtual void deactivate_context() = 0;
/**
* Preparing texture for effect_player
* Called by offscreen effect player.
*
* @example prepare_rendering()
*/
virtual void prepare_rendering() = 0;
/**
* Orientates the image
* Called by offscreen effect player.
*
* @param orient output image orientation
*
* @example orient_image(rotation::deg180)
*/
virtual void orient_image(rotation orient) = 0;
/**
* Reading current buffer of active texture.
* The implementation must definitely support for reading format image_format::bpc8_rgba
* Called by image_processing_result
*
* @param format requested output image format
*
* @return pixel_buffer_sptr - the smart pointer to the instance of the pixel_buffer interface,
* providing access to the output image byte data, or nullptr if the specified format is not supported.
* Must have support for format image_format::bpc8_rgba
*
* @example read_current_buffer(image_format::bpc8_rgba)
*/
virtual pixel_buffer_sptr read_current_buffer(image_format format) = 0;
/**
* Get texture id used for rendering of frame
* Called by offscreen effect player.
*
* @return texture id
*
* @example get_current_buffer_texture()
*/
virtual rendered_texture_t get_current_buffer_texture() = 0;
}; /* class offscreen_render_target INTERFACE */
} /* namespace bnb::oep::interfaces */