docs
Docs
C++ API
C API
Search API
Ctrl K
1.4
2.0
latest
1.4
Ultralight C++ API
1.4.0
Toggle main menu visibility
Loading...
Searching...
No Matches
RenderTarget.h
Go to the documentation of this file.
1
/**************************************************************************************************
2
* This file is a part of Ultralight. *
3
* *
4
* See <https://ultralig.ht> for licensing and more. *
5
* *
6
* (C) 2024 Ultralight, Inc. *
7
**************************************************************************************************/
8
#pragma once
9
#include <
Ultralight/Defines.h
>
10
#include <
Ultralight/Bitmap.h
>
11
#include <
Ultralight/Geometry.h
>
12
13
namespace
ultralight
{
14
15
#pragma pack(push, 1)
16
17
///
18
/// Offscreen render target, used when rendering Views via the GPU renderer.
19
///
20
/// When a View is rendered via the GPU renderer (see View::is_accelerated), it will be rendered to
21
/// an offscreen render target (View::render_target) that you can display in your application.
22
///
23
/// This is intended to be used with a custom GPUDriver implementation in a game or similar
24
/// application.
25
///
26
/// ## Displaying the Render Target
27
///
28
/// To display the View's render target, you should:
29
///
30
/// 1. Retrieve the underlying texture via RenderTarget::texture_id().
31
/// 2. Bind the texture using your custom GPUDriver implementation.
32
/// 3. Draw a textured quad with the provided UV coordinates (RenderTarget::uv_coords()).
33
///
34
struct
UExport
RenderTarget
{
35
///
36
/// Whether this target is empty (null texture)
37
///
38
bool
is_empty
;
39
40
///
41
/// The viewport width (in device coordinates).
42
///
43
uint32_t
width
;
44
45
///
46
/// The viewport height (in device coordinates).
47
///
48
uint32_t
height
;
49
50
///
51
/// The GPUDriver-specific texture ID (you should bind the texture using your custom GPUDriver
52
/// implementation before drawing a quad).
53
///
54
uint32_t
texture_id
;
55
56
///
57
/// The texture width (in pixels). This may be padded.
58
///
59
uint32_t
texture_width
;
60
61
///
62
/// The texture height (in pixels). This may be padded.
63
///
64
uint32_t
texture_height
;
65
66
///
67
/// The pixel format of the texture.
68
///
69
BitmapFormat
texture_format
;
70
71
///
72
/// UV coordinates of the texture (this is needed because the texture may be padded).
73
///
74
Rect
uv_coords
;
75
76
///
77
/// The GPUDriver-specific render buffer ID.
78
///
79
uint32_t
render_buffer_id
;
80
81
RenderTarget
();
82
};
83
84
#pragma pack(pop)
85
86
}
// namespace ultralight
Bitmap.h
UExport
#define UExport
Definition
Exports.h:25
Geometry.h
Defines.h
ultralight
Definition
Bitmap.h:14
ultralight::BitmapFormat
BitmapFormat
The various Bitmap formats.
Definition
Bitmap.h:19
ultralight::Rect
Float Rectangle Helper.
Definition
Geometry.h:419
ultralight::RenderTarget::RenderTarget
RenderTarget()
ultralight::RenderTarget::uv_coords
Rect uv_coords
UV coordinates of the texture (this is needed because the texture may be padded).
Definition
RenderTarget.h:74
ultralight::RenderTarget::texture_id
uint32_t texture_id
The GPUDriver-specific texture ID (you should bind the texture using your custom GPUDriver implementa...
Definition
RenderTarget.h:54
ultralight::RenderTarget::width
uint32_t width
The viewport width (in device coordinates).
Definition
RenderTarget.h:43
ultralight::RenderTarget::render_buffer_id
uint32_t render_buffer_id
The GPUDriver-specific render buffer ID.
Definition
RenderTarget.h:79
ultralight::RenderTarget::texture_format
BitmapFormat texture_format
The pixel format of the texture.
Definition
RenderTarget.h:69
ultralight::RenderTarget::height
uint32_t height
The viewport height (in device coordinates).
Definition
RenderTarget.h:48
ultralight::RenderTarget::is_empty
bool is_empty
Whether this target is empty (null texture).
Definition
RenderTarget.h:38
ultralight::RenderTarget::texture_height
uint32_t texture_height
The texture height (in pixels).
Definition
RenderTarget.h:64
ultralight::RenderTarget::texture_width
uint32_t texture_width
The texture width (in pixels).
Definition
RenderTarget.h:59
Ultralight
RenderTarget.h
Docs
C++ API
C API
Version
1.4
2.0
latest
1.4