VTK  9.3.1
vtkOpenGLTexture.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
14 #ifndef vtkOpenGLTexture_h
15 #define vtkOpenGLTexture_h
16 
17 #include "vtkRenderingOpenGL2Module.h" // For export macro
18 #include "vtkTexture.h"
19 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkRenderWindow;
23 class vtkTextureObject;
24 
25 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
26 {
27 public:
28  static vtkOpenGLTexture* New();
29  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
37  void Render(vtkRenderer* ren) override;
38 
42  void Load(vtkRenderer*) override;
43 
44  // Descsription:
45  // Clean up after the rendering is complete.
46  void PostRender(vtkRenderer*) override;
47 
54  void ReleaseGraphicsResources(vtkWindow*) override;
55 
59  void CopyTexImage(int x, int y, int width, int height);
60 
62 
65  vtkGetMacro(IsDepthTexture, int);
66  vtkSetMacro(IsDepthTexture, int);
68 
70 
73  vtkGetMacro(TextureType, int);
74  vtkSetMacro(TextureType, int);
76 
77  vtkGetObjectMacro(TextureObject, vtkTextureObject);
78  void SetTextureObject(vtkTextureObject*);
79 
83  int GetTextureUnit() override;
84 
91  int IsTranslucent() override;
92 
93 protected:
95  ~vtkOpenGLTexture() override;
96 
98  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
99 
102 
105  int PrevBlendParams[4];
106 
107  // used when the texture exceeds the GL limit
108  unsigned char* ResampleToPowerOfTwo(
109  int& xsize, int& ysize, unsigned char* dptr, int bpp, int maxDimGL);
110 
111 private:
112  vtkOpenGLTexture(const vtkOpenGLTexture&) = delete;
113  void operator=(const vtkOpenGLTexture&) = delete;
114 };
115 
116 VTK_ABI_NAMESPACE_END
117 #endif
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:75
vtkTimeStamp LoadTime
vtkTextureObject * TextureObject
vtkWeakPointer< vtkRenderWindow > RenderWindow
record modification and/or execution time
Definition: vtkTimeStamp.h:24
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:82
abstract specification for renderers
Definition: vtkRenderer.h:61
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:89
OpenGL texture map.
virtual void Render(vtkRenderer *ren)
Renders a texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
virtual int IsTranslucent()
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
a simple class to control print indentation
Definition: vtkIndent.h:28
static vtkTexture * New()
handles properties associated with a texture map
Definition: vtkTexture.h:57
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:243
abstracts an OpenGL texture object.
create a window for renderers to draw into
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.