VTK  9.2.5
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 =========================================================================*/
135 #ifndef vtkOpenGLTexture_h
136 #define vtkOpenGLTexture_h
137 
138 #include "vtkRenderingOpenGL2Module.h" // For export macro
139 #include "vtkTexture.h"
140 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
141 
142 class vtkRenderWindow;
143 class vtkTextureObject;
144 
145 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
146 {
147 public:
149  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
150  void PrintSelf(ostream& os, vtkIndent indent) override;
151 
157  void Render(vtkRenderer* ren) override;
158 
162  void Load(vtkRenderer*) override;
163 
164  // Descsription:
165  // Clean up after the rendering is complete.
166  void PostRender(vtkRenderer*) override;
167 
175 
179  void CopyTexImage(int x, int y, int width, int height);
180 
182 
185  vtkGetMacro(IsDepthTexture, int);
186  vtkSetMacro(IsDepthTexture, int);
188 
190 
193  vtkGetMacro(TextureType, int);
194  vtkSetMacro(TextureType, int);
196 
197  vtkGetObjectMacro(TextureObject, vtkTextureObject);
199 
203  int GetTextureUnit() override;
204 
211  int IsTranslucent() override;
212 
213 protected:
215  ~vtkOpenGLTexture() override;
216 
218  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
219 
222 
225  int PrevBlendParams[4];
226 
227  // used when the texture exceeds the GL limit
228  unsigned char* ResampleToPowerOfTwo(
229  int& xsize, int& ysize, unsigned char* dptr, int bpp, int maxDimGL);
230 
231 private:
232  vtkOpenGLTexture(const vtkOpenGLTexture&) = delete;
233  void operator=(const vtkOpenGLTexture&) = delete;
234 };
235 
236 #endif
a simple class to control print indentation
Definition: vtkIndent.h:119
OpenGL texture map.
void Load(vtkRenderer *) override
Implement base class method.
int GetTextureUnit() override
Return the texture unit used for this texture.
void CopyTexImage(int x, int y, int width, int height)
copy the renderers read buffer into this texture
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this texture.
unsigned char * ResampleToPowerOfTwo(int &xsize, int &ysize, unsigned char *dptr, int bpp, int maxDimGL)
int IsTranslucent() override
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
void PostRender(vtkRenderer *) override
Cleans up after the texture rendering to restore the state of the graphics context.
void SetTextureObject(vtkTextureObject *)
void Render(vtkRenderer *ren) override
Renders a texture map.
vtkWeakPointer< vtkRenderWindow > RenderWindow
~vtkOpenGLTexture() override
vtkTextureObject * TextureObject
vtkTimeStamp LoadTime
static vtkOpenGLTexture * New()
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:182
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition: vtkTexture.h:178
record modification and/or execution time
Definition: vtkTimeStamp.h:55
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ height
Definition: vtkX3D.h:260