VTK  9.3.0
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
21struct ID3D11Device;
22struct ID3D11Texture2D;
23
24VTK_ABI_NAMESPACE_BEGIN
25class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLDXRenderWindow : public vtkWin32OpenGLRenderWindow
26{
27public:
30 void PrintSelf(ostream& os, vtkIndent indent) override;
31
35 void Initialize() override;
36
38
42 void Lock();
43 void Unlock();
45
47
51 void RegisterSharedTexture(unsigned int textureHandle);
54
56
59 void SetSize(int width, int height) override;
61
63
66 void SetMultiSamples(int samples) override;
68
70
73 void BlitToTexture(ID3D11Texture2D* texture);
75
77
80 ID3D11Device* GetDevice();
82
84
87 ID3D11Texture2D* GetD3DSharedTexture();
89
91
95 void SetAdapterId(LUID uid) { this->AdapterId = uid; }
97
98protected:
101
102private:
104 void operator=(const vtkWin32OpenGLDXRenderWindow&) = delete;
105
106 // Hide D3D resources managed by Microsoft::WRL::ComPtr
107 class PIMPL;
108 PIMPL* Private;
109
110 HANDLE DeviceHandle = 0;
111
112 unsigned int TextureId = 0; // OpenGL texture id to be shared with the D3D texture
113
114 HANDLE GLSharedTextureHandle = 0; // OpenGL-D3D shared texture id
115
116 LUID AdapterId = { 0, 0 }; // DGXI adapter id
117};
118VTK_ABI_NAMESPACE_END
119#endif
a simple class to control print indentation
Definition vtkIndent.h:29
VTK render window providing OpenGL-DirectX interop.
void Unlock()
Lock/Unlock the shared texture.
void Initialize() override
Overridden to create the D3D device, context and texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkWin32OpenGLDXRenderWindow() override
ID3D11Device * GetDevice()
Returns the D3D device associated to this render window.
void Lock()
Lock/Unlock the shared texture.
static vtkWin32OpenGLDXRenderWindow * New()
void SetAdapterId(LUID uid)
Specify the DGXI adapter to be used for initialization.
ID3D11Texture2D * GetD3DSharedTexture()
Returns the D3D texture shared with this render window.
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 texture designated by textureHandle with this render window internal D...
void BlitToTexture(ID3D11Texture2D *texture)
Blits the internal D3D shared texture into texture.
void RegisterSharedTexture(unsigned int textureHandle)
Register/Unregister the OpenGL texture designated by textureHandle with this render window internal D...