Open3D (C++ API)  0.19.0
GaussianSplatOpenGLContext.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 // GL context management for OpenGL compute-based Gaussian splatting.
9 // Uses a hidden GLFW window with a GL 4.6 core-profile context and exposes
10 // the native handle (GLXContext on Linux/X11/XWayland, HGLRC on Windows) so
11 // Filament can create its own context sharing the same GL object namespace.
12 //
13 // Offscreen rendering on Linux now requires an X11 or XWayland server. EGL is
14 // intentionally not used because Filament's Linux OpenGL path is GLX-only.
15 
16 #pragma once
17 
18 #if !defined(__APPLE__)
19 
20 namespace open3d {
21 namespace visualization {
22 namespace rendering {
23 
34 public:
36 
40  bool InitializeStandalone();
41 
45  bool Initialize();
46 
51  void* GetNativeContext() const;
52 
54  void Shutdown();
55 
57  bool IsValid() const;
58 
60  bool MakeCurrent();
61 
63  void ReleaseCurrent();
64 
65 private:
66  GaussianSplatOpenGLContext() = default;
68 
71  delete;
72 
73 private:
74  // Stored as void* (== GLFWwindow*) to avoid a GLFW header dependency.
75  void* glfw_window_ = nullptr;
76 
77  bool initialized_ = false;
78  bool gl_logged_ = false;
79 };
80 
81 } // namespace rendering
82 } // namespace visualization
83 } // namespace open3d
84 
85 #endif // !defined(__APPLE__)
Definition: GaussianSplatOpenGLContext.h:33
void ReleaseCurrent()
Releases the context (no context current on this thread).
Definition: GaussianSplatOpenGLContext.cpp:219
void Shutdown()
Destroys the context and associated resources.
Definition: GaussianSplatOpenGLContext.cpp:175
static GaussianSplatOpenGLContext & GetInstance()
Definition: GaussianSplatOpenGLContext.cpp:71
bool IsValid() const
Returns true if the context is initialized and valid.
Definition: GaussianSplatOpenGLContext.cpp:188
bool MakeCurrent()
Makes this context current on the calling thread.
Definition: GaussianSplatOpenGLContext.cpp:190
void * GetNativeContext() const
Definition: GaussianSplatOpenGLContext.cpp:162
bool InitializeStandalone()
Definition: GaussianSplatOpenGLContext.cpp:78
bool Initialize()
Definition: GaussianSplatOpenGLContext.cpp:150
Definition: PinholeCameraIntrinsic.cpp:16