VTK  9.2.6
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 =========================================================================*/
35 #ifndef vtkOpenGLTexture_h
36 #define vtkOpenGLTexture_h
37 
38 #include "vtkRenderingOpenGL2Module.h" // For export macro
39 #include "vtkTexture.h"
40 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
41 
42 class vtkRenderWindow;
43 class vtkTextureObject;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
46 {
47 public:
48  static vtkOpenGLTexture* New();
49  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
57  void Render(vtkRenderer* ren) override;
58 
62  void Load(vtkRenderer*) override;
63 
64  // Descsription:
65  // Clean up after the rendering is complete.
66  void PostRender(vtkRenderer*) override;
67 
75 
79  void CopyTexImage(int x, int y, int width, int height);
80 
82 
85  vtkGetMacro(IsDepthTexture, int);
86  vtkSetMacro(IsDepthTexture, int);
88 
90 
93  vtkGetMacro(TextureType, int);
94  vtkSetMacro(TextureType, int);
96 
97  vtkGetObjectMacro(TextureObject, vtkTextureObject);
99 
103  int GetTextureUnit() override;
104 
111  int IsTranslucent() override;
112 
113 protected:
115  ~vtkOpenGLTexture() override;
116 
118  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
119 
122 
125  int PrevBlendParams[4];
126 
127  // used when the texture exceeds the GL limit
128  unsigned char* ResampleToPowerOfTwo(
129  int& xsize, int& ysize, unsigned char* dptr, int bpp, int maxDimGL);
130 
131 private:
132  vtkOpenGLTexture(const vtkOpenGLTexture&) = delete;
133  void operator=(const vtkOpenGLTexture&) = delete;
134 };
135 
136 #endif
a simple class to control print indentation
Definition: vtkIndent.h:49
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:82
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition: vtkTexture.h:78
record modification and/or execution time
Definition: vtkTimeStamp.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ height
Definition: vtkX3D.h:260