VTK: Rendering/OpenGL2/vtkWin32OpenGLDXRenderWindow.h Source File

| VTK 9.3.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
19 #include "vtkWin32OpenGLRenderWindow.h"
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:
30 static vtkWin32OpenGLDXRenderWindow* New();
31 vtkTypeMacro(vtkWin32OpenGLDXRenderWindow, vtkWin32OpenGLRenderWindow);
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 textureHandle);
54 void UnregisterSharedTexture();
56
58
61 void SetSize(int width, int height) override;
63
65
68 void SetMultiSamples(int samples) override;
70
72
75 void BlitToTexture(ID3D11Texture2D* texture);
77
79
82 ID3D11Device* GetDevice();
84
86
89 ID3D11Texture2D* GetD3DSharedTexture();
91
93
97 void SetAdapterId(LUID uid) { this->AdapterId = uid; }
99
100 protected:
101 vtkWin32OpenGLDXRenderWindow();
102 ~vtkWin32OpenGLDXRenderWindow() override;
103
104 private:
105 vtkWin32OpenGLDXRenderWindow(const vtkWin32OpenGLDXRenderWindow&) = delete;
106 void operator=(const vtkWin32OpenGLDXRenderWindow&) = delete;
107
108 // Hide D3D resources managed by Microsoft::WRL::ComPtr
109 class PIMPL;
110 PIMPL* Private;
111
112 HANDLE DeviceHandle = 0;
113
114 unsigned int TextureId = 0; // OpenGL texture id to be shared with the D3D texture
115
116 HANDLE GLSharedTextureHandle = 0; // OpenGL-D3D shared texture id
117
118 LUID AdapterId = { 0, 0 }; // DGXI adapter id
119 };
120 VTK_ABI_NAMESPACE_END
121 #endif
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkWin32OpenGLDXRenderWindow
VTK render window providing OpenGL-DirectX interop.
Definition: vtkWin32OpenGLDXRenderWindow.h:28
vtkWin32OpenGLDXRenderWindow::Unlock
void Unlock()
Lock/Unlock the shared texture.
vtkWin32OpenGLDXRenderWindow::GetDevice
ID3D11Device * GetDevice()
Returns the D3D device associated to this render window.
vtkWin32OpenGLDXRenderWindow::vtkWin32OpenGLDXRenderWindow
vtkWin32OpenGLDXRenderWindow()
vtkWin32OpenGLDXRenderWindow::Initialize
void Initialize() override
Overridden to create the D3D device, context and texture.
vtkWin32OpenGLDXRenderWindow::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWin32OpenGLDXRenderWindow::~vtkWin32OpenGLDXRenderWindow
~vtkWin32OpenGLDXRenderWindow() override
vtkWin32OpenGLDXRenderWindow::Lock
void Lock()
Lock/Unlock the shared texture.
vtkWin32OpenGLDXRenderWindow::SetAdapterId
void SetAdapterId(LUID uid)
Specify the DGXI adapter to be used for initialization.
Definition: vtkWin32OpenGLDXRenderWindow.h:97
vtkWin32OpenGLDXRenderWindow::SetMultiSamples
void SetMultiSamples(int samples) override
Overridden to update the internal D3D shared texture.
vtkWin32OpenGLDXRenderWindow::SetSize
void SetSize(int width, int height) override
Overridden to resize the internal D3D shared texture.
vtkWin32OpenGLDXRenderWindow::UnregisterSharedTexture
void UnregisterSharedTexture()
Register/Unregister the OpenGL texture designated by textureHandle with this render window internal D...
vtkWin32OpenGLDXRenderWindow::GetD3DSharedTexture
ID3D11Texture2D * GetD3DSharedTexture()
Returns the D3D texture shared with this render window.
vtkWin32OpenGLDXRenderWindow::BlitToTexture
void BlitToTexture(ID3D11Texture2D *texture)
Blits the internal D3D shared texture into texture.
vtkWin32OpenGLDXRenderWindow::New
static vtkWin32OpenGLDXRenderWindow * New()
vtkWin32OpenGLDXRenderWindow::RegisterSharedTexture
void RegisterSharedTexture(unsigned int textureHandle)
Register/Unregister the OpenGL texture designated by textureHandle with this render window internal D...
vtkWin32OpenGLRenderWindow
Definition: vtkWin32OpenGLRenderWindow.h:28
vtkX3D::samples
@ samples
Definition: vtkX3D.h:473
vtkX3D::height
@ height
Definition: vtkX3D.h:254
vtkWin32OpenGLRenderWindow.h