VTK  9.4.20241222
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
23struct ID3D11Device;
24struct ID3D11DeviceContext;
25struct ID3D11Texture2D;
26
27VTK_ABI_NAMESPACE_BEGIN
28class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLDXRenderWindow : public vtkWin32OpenGLRenderWindow
29{
30public:
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);
73
78 VTK_DEPRECATED_IN_9_4_0("Use RegisterSharedRenderFramebuffer")
79 void RegisterSharedTexture();
80
84 void RegisterSharedDisplayFramebuffer();
85
87
90 void SetSize(int width, int height) override;
92
94
97 vtkSetMacro(SharedTextureSamples, int);
98 vtkGetMacro(SharedTextureSamples, int);
100
102
108 void BlitToTexture(ID3D11Texture2D* color, ID3D11Texture2D* depth = nullptr);
109 void BlitToTexture(void* color, void* depth = nullptr);
111
113
116 ID3D11Device* GetDevice();
118
120
123 ID3D11Texture2D* GetD3DSharedTexture();
124 ID3D11Texture2D* GetD3DSharedDepthTexture();
126
128
132 void SetAdapterId(LUID uid);
134
143 void SetColorTextureFormat(UINT format);
144
145protected:
148
152 void InitializeDX();
153
154private:
156 void operator=(const vtkWin32OpenGLDXRenderWindow&) = delete;
157
158 bool CreateTexture(UINT format, UINT bindFlags, ID3D11Texture2D** output);
159 void UpdateTextures();
160
161 class vtkInternals;
162 std::unique_ptr<vtkInternals> Impl;
163
164 // Number of multisamples used by shared textures for hardware antialiasing
165 int SharedTextureSamples = 0;
166};
167VTK_ABI_NAMESPACE_END
168#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.
void Initialize() override
Overridden to create the D3D device, context and texture.
void SetD3DDeviceContext(void *context)
Use external D3D11DeviceContext.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
static vtkWin32OpenGLDXRenderWindow * New()
void SetD3DDeviceContext(ID3D11DeviceContext *context)
Use external D3D11DeviceContext.
void UnregisterSharedTexture()
Register/Unregister the OpenGL textures designated by colorId and depthId with this render window int...
void RegisterSharedRenderFramebuffer()
Register the RenderFramebuffer of this window as a D3D shared texture.
#define VTK_DEPRECATED_IN_9_4_0(reason)