VTK  9.7.1
vtkOpenGLTextureNormalizationHelper.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
26 #ifndef vtkOpenGLTextureNormalizationHelper_h
27 #define vtkOpenGLTextureNormalizationHelper_h
28 
29 #include "vtkObject.h"
30 #include "vtkRenderingOpenGL2Module.h" // For export macro
31 #include "vtkSmartPointer.h" // For ivar
32 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
33 
34 VTK_ABI_NAMESPACE_BEGIN
36 
37 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLTextureNormalizationHelper
38  : public vtkObject
39 {
40 public:
41  vtkAbstractTypeMacro(vtkOpenGLTextureNormalizationHelper, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
44  enum class ConversionMode
45  {
46  CPU, // CPU conversion (fallback)
47  ComputeShader, // Compute shader (fastest if available)
48  CopyTexImage, // Framebuffer blit with shader conversion
49  Unsupported // No conversion available
50  };
51 
57  vtkOpenGLRenderWindow* context);
58 
62  ConversionMode GetConversionMode() const { return this->Mode; }
63 
68  {
69  return this->Mode != ConversionMode::CPU && this->Mode != ConversionMode::Unsupported;
70  }
71 
83  virtual bool ConvertUShortToFloat(const void* sourceData, size_t numValues, int numComps,
84  unsigned int targetTexture, unsigned int width, unsigned int height) = 0;
85 
97  virtual bool ConvertShortToFloat(const void* sourceData, size_t numValues, int numComps,
98  unsigned int targetTexture, unsigned int width, unsigned int height) = 0;
99 
100 protected:
102  ~vtkOpenGLTextureNormalizationHelper() override = default;
103 
104  ConversionMode Mode = ConversionMode::CPU;
105 
106 private:
108  void operator=(const vtkOpenGLTextureNormalizationHelper&) = delete;
109 };
110 
111 VTK_ABI_NAMESPACE_END
112 #endif // vtkOpenGLTextureNormalizationHelper_h
OpenGL rendering window.
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
GPU-based texture normalization for GLES 3.0 without GL_EXT_texture_norm16.
bool IsGPUConversionAvailable() const
Check if GPU-assisted conversion is available.
a simple class to control print indentation
Definition: vtkIndent.h:28
#define VTK_MARSHALAUTO
ConversionMode GetConversionMode() const
Get the preferred conversion mode for this context.