VTK  9.1.0
vtkOpenGLTexture.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLTexture.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
72 #ifndef vtkOpenGLTexture_h
73 #define vtkOpenGLTexture_h
74 
75 #include "vtkRenderingOpenGL2Module.h" // For export macro
76 #include "vtkTexture.h"
77 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
78 
79 class vtkRenderWindow;
80 class vtkTextureObject;
81 
82 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
83 {
84 public:
85  static vtkOpenGLTexture* New();
86  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
87  void PrintSelf(ostream& os, vtkIndent indent) override;
88 
94  void Render(vtkRenderer* ren) override;
95 
99  void Load(vtkRenderer*) override;
100 
101  // Descsription:
102  // Clean up after the rendering is complete.
103  void PostRender(vtkRenderer*) override;
104 
112 
116  void CopyTexImage(int x, int y, int width, int height);
117 
119 
122  vtkGetMacro(IsDepthTexture, int);
123  vtkSetMacro(IsDepthTexture, int);
125 
127 
130  vtkGetMacro(TextureType, int);
131  vtkSetMacro(TextureType, int);
133 
134  vtkGetObjectMacro(TextureObject, vtkTextureObject);
136 
140  int GetTextureUnit() override;
141 
148  int IsTranslucent() override;
149 
150 protected:
152  ~vtkOpenGLTexture() override;
153 
155  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
156 
159 
162  int PrevBlendParams[4];
163 
164  // used when the texture exceeds the GL limit
165  unsigned char* ResampleToPowerOfTwo(
166  int& xsize, int& ysize, unsigned char* dptr, int bpp, int maxDimGL);
167 
168 private:
169  vtkOpenGLTexture(const vtkOpenGLTexture&) = delete;
170  void operator=(const vtkOpenGLTexture&) = delete;
171 };
172 
173 #endif
vtkOpenGLTexture::~vtkOpenGLTexture
~vtkOpenGLTexture() override
vtkOpenGLTexture::TextureType
int TextureType
Definition: vtkOpenGLTexture.h:161
vtkOpenGLTexture::vtkOpenGLTexture
vtkOpenGLTexture()
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkOpenGLTexture::Render
void Render(vtkRenderer *ren) override
Renders a texture map.
vtkOpenGLTexture::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this texture.
vtkOpenGLTexture::IsDepthTexture
int IsDepthTexture
Definition: vtkOpenGLTexture.h:160
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkOpenGLTexture::New
static vtkOpenGLTexture * New()
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:175
vtkOpenGLTexture::ExternalTextureObject
bool ExternalTextureObject
Definition: vtkOpenGLTexture.h:157
vtkOpenGLTexture::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::height
@ height
Definition: vtkX3D.h:260
vtkOpenGLTexture::SetTextureObject
void SetTextureObject(vtkTextureObject *)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:60
vtkOpenGLTexture::PostRender
void PostRender(vtkRenderer *) override
Cleans up after the texture rendering to restore the state of the graphics context.
vtkWeakPointer.h
vtkOpenGLTexture::TextureObject
vtkTextureObject * TextureObject
Definition: vtkOpenGLTexture.h:158
vtkOpenGLTexture::LoadTime
vtkTimeStamp LoadTime
Definition: vtkOpenGLTexture.h:154
vtkTexture.h
vtkOpenGLTexture::Load
void Load(vtkRenderer *) override
Implement base class method.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:182
vtkOpenGLTexture::RenderWindow
vtkWeakPointer< vtkRenderWindow > RenderWindow
Definition: vtkOpenGLTexture.h:155
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:205
vtkOpenGLTexture
OpenGL texture map.
Definition: vtkOpenGLTexture.h:83
vtkOpenGLTexture::CopyTexImage
void CopyTexImage(int x, int y, int width, int height)
copy the renderers read buffer into this texture
vtkOpenGLTexture::GetTextureUnit
int GetTextureUnit() override
Return the texture unit used for this texture.
vtkOpenGLTexture::IsTranslucent
int IsTranslucent() override
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
vtkWeakPointer< vtkRenderWindow >
vtkOpenGLTexture::ResampleToPowerOfTwo
unsigned char * ResampleToPowerOfTwo(int &xsize, int &ysize, unsigned char *dptr, int bpp, int maxDimGL)