Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
EGLOffscreenContext.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2024 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10// EGL surfaceless/pbuffer offscreen rendering is only used on Linux, where it
11// replaces the legacy OSMesa (software) headless path with GPU-accelerated
12// rendering that ships in the standard Open3D binary.
13#if defined(__linux__)
14
15#include <EGL/egl.h>
16
17#include <memory>
18
19namespace open3d {
20namespace visualization {
21
30class EGLOffscreenContext {
31public:
34 static std::unique_ptr<EGLOffscreenContext> Create(int width, int height);
35
36 ~EGLOffscreenContext();
37 EGLOffscreenContext(const EGLOffscreenContext &) = delete;
38 EGLOffscreenContext &operator=(const EGLOffscreenContext &) = delete;
39
41 bool MakeCurrent();
42
44 void ReleaseCurrent();
45
52 bool SwapBuffers();
53
54 int GetWidth() const { return width_; }
55 int GetHeight() const { return height_; }
56
57private:
58 EGLOffscreenContext() = default;
59 bool Initialize(int width, int height);
60
61 EGLDisplay display_ = EGL_NO_DISPLAY;
62 EGLContext context_ = EGL_NO_CONTEXT;
63 EGLSurface surface_ = EGL_NO_SURFACE;
64 int width_ = 0;
65 int height_ = 0;
66};
67
68} // namespace visualization
69} // namespace open3d
70
71#endif // defined(__linux__)
int width
Definition FilePCD.cpp:53
int height
Definition FilePCD.cpp:54
Definition PinholeCameraIntrinsic.cpp:16