VTK  9.7.1
vtkWin32OpenGLDXRenderWindow.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
15 #ifndef vtkWin32OpenGLDXRenderWindow_h
16 #define vtkWin32OpenGLDXRenderWindow_h
17 
18 #include "vtkRenderingOpenGL2Module.h" // For export macro
20 
21 #include <memory> // For std::unique_ptr
22 
23 struct ID3D11Device;
24 struct ID3D11DeviceContext;
25 struct ID3D11Texture2D;
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLDXRenderWindow : public vtkWin32OpenGLRenderWindow
29 {
30 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
36 
47  void SetD3DDeviceContext(ID3D11DeviceContext* context);
48  void SetD3DDeviceContext(void* context);
50 
54  void Initialize() override;
55 
57 
61  void Lock();
62  void Unlock();
64 
66 
70  void RegisterSharedTexture(unsigned int colorId, unsigned int depthId = 0);
71  void UnregisterSharedTexture();
73 
77  void RegisterSharedRenderFramebuffer();
78 
82  void RegisterSharedDisplayFramebuffer();
83 
85 
88  void SetSize(int width, int height) override;
90 
92 
95  vtkSetMacro(SharedTextureSamples, int);
96  vtkGetMacro(SharedTextureSamples, int);
98 
100 
106  void BlitToTexture(ID3D11Texture2D* color, ID3D11Texture2D* depth = nullptr);
107  void BlitToTexture(void* color, void* depth = nullptr);
109 
111 
114  ID3D11Device* GetDevice();
116 
118 
121  ID3D11Texture2D* GetD3DSharedTexture();
122  ID3D11Texture2D* GetD3DSharedDepthTexture();
124 
126 
130  void SetAdapterId(LUID uid);
132 
141  void SetColorTextureFormat(UINT format);
142 
143 protected:
145  ~vtkWin32OpenGLDXRenderWindow() override;
146 
150  void InitializeDX();
151 
152 private:
154  void operator=(const vtkWin32OpenGLDXRenderWindow&) = delete;
155 
156  bool CreateTexture(UINT format, UINT bindFlags, ID3D11Texture2D** output);
157  void UpdateTextures();
158 
159  class vtkInternals;
160  std::unique_ptr<vtkInternals> Impl;
161 
162  // Number of multisamples used by shared textures for hardware antialiasing
163  int SharedTextureSamples = 0;
164 };
165 VTK_ABI_NAMESPACE_END
166 #endif
static vtkWin32OpenGLRenderWindow * New()
void Initialize() override
Initialize the rendering window.
VTK render window providing OpenGL-DirectX interop.
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetSize(int width, int height) override
Set the size (width and height) of the rendering window in screen coordinates (in pixels)...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.