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