VTK
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 =========================================================================*/
26 #ifndef vtkOpenGLTexture_h
27 #define vtkOpenGLTexture_h
28 
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 #include "vtkTexture.h"
31 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
32 
33 class vtkRenderWindow;
34 class vtkTextureObject;
35 
36 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
37 {
38 public:
39  static vtkOpenGLTexture *New();
40  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
41  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
42 
48  virtual void Render(vtkRenderer* ren);
49 
53  void Load(vtkRenderer*);
54 
55  // Descsription:
56  // Clean up after the rendering is complete.
57  virtual void PostRender(vtkRenderer*);
58 
66 
70  void CopyTexImage(int x, int y, int width, int height);
71 
73 
76  vtkGetMacro(IsDepthTexture,int);
77  vtkSetMacro(IsDepthTexture,int);
79 
81 
84  vtkGetMacro(TextureType,int);
85  vtkSetMacro(TextureType,int);
87 
88  vtkGetObjectMacro(TextureObject, vtkTextureObject);
89  void SetTextureObject(vtkTextureObject *);
90 
94  virtual int GetTextureUnit();
95 
102  virtual int IsTranslucent();
103 
104 protected:
106  ~vtkOpenGLTexture();
107 
108  vtkTimeStamp LoadTime;
109  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
110 
113 
116  int PrevBlendParams[4];
117 
118  // used when the texture exceeds the GL limit
119  unsigned char *ResampleToPowerOfTwo(int &xsize, int &ysize,
120  unsigned char *dptr, int bpp);
121 
122 
123 private:
124  vtkOpenGLTexture(const vtkOpenGLTexture&) VTK_DELETE_FUNCTION;
125  void operator=(const vtkOpenGLTexture&) VTK_DELETE_FUNCTION;
126 };
127 
128 #endif
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:88
vtkTextureObject * TextureObject
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:95
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:102
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
OpenGL texture map.
virtual void Render(vtkRenderer *ren)
Renders a texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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:39
static vtkTexture * New()
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkWeakPointer< vtkRenderWindow > RenderWindow
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:257
abstracts an OpenGL texture object.
create a window for renderers to draw into