VTK  9.3.20240329
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 ID3D11Texture2D;
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLDXRenderWindow : public vtkWin32OpenGLRenderWindow
28 {
29 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  void Initialize() override;
38 
40 
44  void Lock();
45  void Unlock();
47 
49 
53  void RegisterSharedTexture(unsigned int colorId, unsigned int depthId = 0);
56 
58 
61  void SetSize(int width, int height) override;
63 
65 
68  void SetMultiSamples(int samples) override;
70 
72 
75  void BlitToTexture(ID3D11Texture2D* color, ID3D11Texture2D* depth = nullptr);
77 
79 
82  ID3D11Device* GetDevice();
84 
86 
89  ID3D11Texture2D* GetD3DSharedTexture();
90  ID3D11Texture2D* GetD3DSharedDepthTexture();
92 
94 
98  void SetAdapterId(LUID uid);
100 
101 protected:
104 
108  void InitializeDX();
109 
110 private:
112  void operator=(const vtkWin32OpenGLDXRenderWindow&) = delete;
113 
114  bool CreateTexture(UINT format, UINT bindFlags, ID3D11Texture2D** output);
115  void UpdateTextures();
116 
117  class vtkInternals;
118  std::unique_ptr<vtkInternals> Impl;
119 };
120 VTK_ABI_NAMESPACE_END
121 #endif
a simple class to control print indentation
Definition: vtkIndent.h:108
VTK render window providing OpenGL-DirectX interop.
void Unlock()
Lock/Unlock the shared texture.
ID3D11Device * GetDevice()
Returns the D3D device associated to this render window.
void Initialize() override
Overridden to create the D3D device, context and texture.
void BlitToTexture(ID3D11Texture2D *color, ID3D11Texture2D *depth=nullptr)
Blits the internal D3D shared texture into color and optionally depth.
void InitializeDX()
Initialize D3D adapter, device and shared texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkWin32OpenGLDXRenderWindow() override
void RegisterSharedTexture(unsigned int colorId, unsigned int depthId=0)
Register/Unregister the OpenGL textures designated by colorId and depthId with this render window int...
void Lock()
Lock/Unlock the shared texture.
void SetAdapterId(LUID uid)
Specify the DGXI adapter to be used for initialization.
void SetMultiSamples(int samples) override
Overridden to update the internal D3D shared texture.
void SetSize(int width, int height) override
Overridden to resize the internal D3D shared texture.
void UnregisterSharedTexture()
Register/Unregister the OpenGL textures designated by colorId and depthId with this render window int...
ID3D11Texture2D * GetD3DSharedTexture()
Returns the D3D texture shared with this render window.
static vtkWin32OpenGLDXRenderWindow * New()
ID3D11Texture2D * GetD3DSharedDepthTexture()
Returns the D3D texture shared with this render window.
@ samples
Definition: vtkX3D.h:473
@ color
Definition: vtkX3D.h:221
@ height
Definition: vtkX3D.h:254