VTK  9.7.1
vtkOpenXRManagerOpenGLGraphics.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkOpenXRManagerOpenGLGraphics_h
12 #define vtkOpenXRManagerOpenGLGraphics_h
13 
15 #include "vtkRenderingOpenXRModule.h" // For export macro
16 
17 #include "vtkRenderingOpenGLConfigure.h" // For VTK_USE_X / WIN32
18 
19 #include <memory> // For shared_ptr
20 #include <vector> // For std::vector
21 
22 // Forward declare the graphics binding struct depending on the platform being used
23 #ifdef VTK_USE_X
24 struct XrGraphicsBindingOpenGLXlibKHR;
25 typedef XrGraphicsBindingOpenGLXlibKHR XrGraphicsBindingOpenGL;
26 #elif defined(_WIN32)
27 struct XrGraphicsBindingOpenGLWin32KHR;
28 typedef XrGraphicsBindingOpenGLWin32KHR XrGraphicsBindingOpenGL;
29 #endif
30 struct XrSwapchainImageOpenGLKHR;
31 
32 namespace vtk::detail
33 {
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkOpenXRManager;
36 VTK_ABI_NAMESPACE_END
37 }
38 
39 VTK_ABI_NAMESPACE_BEGIN
40 class VTKRENDERINGOPENXR_EXPORT vtkOpenXRManagerOpenGLGraphics : public vtkOpenXRManagerGraphics
41 {
42 public:
45 
49  void SetNumberOfSwapchains(uint32_t viewCount) override;
50 
52 
56  void GetColorSwapchainImage(uint32_t scIndex, uint32_t imgIndex, void* texture) override;
57  void GetDepthSwapchainImage(uint32_t scIndex, uint32_t imgIndex, void* texture) override;
59 
61 
64  void EnumerateColorSwapchainImages(XrSwapchain swapchain, uint32_t scIndex) override;
65  void EnumerateDepthSwapchainImages(XrSwapchain swapchain, uint32_t scIndex) override;
67 
69 
73  const std::vector<int64_t>& GetSupportedColorFormats() override;
74  const std::vector<int64_t>& GetSupportedDepthFormats() override;
76 
80  bool CreateGraphicsBinding(vtkOpenGLRenderWindow* helperWindow) override;
81 
85  const void* GetGraphicsBinding() override { return this->GraphicsBinding.get(); };
86 
90  const char* GetBackendExtensionName() override;
91 
92 protected:
95 
100  {
101  std::vector<XrSwapchainImageOpenGLKHR> Images;
102  };
103 
107  void EnumerateSwapchainImages(XrSwapchain swapchain, SwapchainImagesOpenGL& swapchainImages);
108 
109  std::shared_ptr<XrGraphicsBindingOpenGL> GraphicsBinding;
110 
115 
116 private:
118  void operator=(const vtkOpenXRManagerOpenGLGraphics&) = delete;
119 
120  class PIMPL;
121  PIMPL* Private;
122 };
123 
124 VTK_ABI_NAMESPACE_END
125 #endif
OpenGL rendering window.
Singleton class that holds a collection of utility functions and member variables to communicate with...
virtual void GetColorSwapchainImage(uint32_t eyeIndex, uint32_t imgIndex, void *texture)=0
Fill texture with the swapchain image for the specified eye.
std::shared_ptr< XrGraphicsBindingOpenGL > GraphicsBinding
const void * GetGraphicsBinding() override
Return pointer to the XrGraphicsBindingOpenGL structure required to create the OpenXR session...
virtual void GetDepthSwapchainImage(uint32_t eyeIndex, uint32_t imgIndex, void *texture)=0
Fill texture with the swapchain image for the specified eye.
virtual void EnumerateDepthSwapchainImages(XrSwapchain swapchain, uint32_t eyeIndex)=0
Acquire swapchain images using xrEnumerateSwapchainImages and store them at the specified eye index...
virtual bool CheckGraphicsRequirements(vtk::detail::vtkOpenXRManager &manager)=0
OpenXR requires checking graphics requirements before creating a session.
virtual const std::vector< int64_t > & GetSupportedDepthFormats()=0
Return the list of pixel formats supported by VTK.
virtual const char * GetBackendExtensionName()=0
Return the extension name to enable a specific rendering backend.
OpenXR manager OpenGL graphics implementation.
OpenXR manager graphics implementation.
virtual const std::vector< int64_t > & GetSupportedColorFormats()=0
Return the list of pixel formats supported by VTK.
virtual void SetNumberOfSwapchains(uint32_t viewCount)=0
Resize the internal vectors storing the color and depth swapchains.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual bool CreateGraphicsBinding(vtkOpenGLRenderWindow *helperWindow)=0
Create the graphics binding and store it in GraphicsBindings ptr.
virtual void EnumerateColorSwapchainImages(XrSwapchain swapchain, uint32_t eyeIndex)=0
Acquire swapchain images using xrEnumerateSwapchainImages and store them at the specified eye index...