VTK  9.7.1
vtkOpenGLTextureComputeShaderNormalization.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
18 #ifndef vtkOpenGLTextureComputeShaderNormalization_h
19 #define vtkOpenGLTextureComputeShaderNormalization_h
20 
22 #include "vtkRenderingOpenGL2Module.h"
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 #include "vtk_glad.h"
25 
26 VTK_ABI_NAMESPACE_BEGIN
28 
29 #ifdef GL_COMPUTE_SHADER
30 
31 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLTextureComputeShaderNormalization
33 {
34 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
44  void Initialize(vtkOpenGLRenderWindow* context);
45 
46  bool ConvertUShortToFloat(const void* sourceData, size_t numValues, int numComps,
47  unsigned int targetTexture, unsigned int width, unsigned int height) override;
48 
49  bool ConvertShortToFloat(const void* sourceData, size_t numValues, int numComps,
50  unsigned int targetTexture, unsigned int width, unsigned int height) override;
51 
52 protected:
55 
56  vtkOpenGLRenderWindow* Context = nullptr;
57  GLuint ComputeProgram = 0;
58  GLuint IntermediateStorageTexture = 0;
59 
60  bool InitializeComputeProgram();
61  bool UploadToIntermediateTexture(const void* sourceData, size_t numValues, int numComps,
62  unsigned int width, unsigned int height, GLenum sourceFormat);
63  bool RunNormalizationCompute(
64  int numComps, unsigned int targetTexture, unsigned int width, unsigned int height);
65 
66 private:
69  void operator=(const vtkOpenGLTextureComputeShaderNormalization&) = delete;
70 };
71 
72 #endif // GL_COMPUTE_SHADER
73 
74 VTK_ABI_NAMESPACE_END
75 #endif // vtkOpenGLTextureComputeShaderNormalization_h
OpenGL rendering window.
GPU-based texture normalization for GLES 3.0 without GL_EXT_texture_norm16.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
GPU compute shader implementation for 16-bit to float texture normalization.
#define VTK_MARSHALAUTO
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual bool ConvertShortToFloat(const void *sourceData, size_t numValues, int numComps, unsigned int targetTexture, unsigned int width, unsigned int height)=0
Convert signed short texture data to float in GPU memory.
virtual bool ConvertUShortToFloat(const void *sourceData, size_t numValues, int numComps, unsigned int targetTexture, unsigned int width, unsigned int height)=0
Convert unsigned short texture data to float in GPU memory.