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 =========================================================================*/
22 #ifndef vtkOpenGLTexture_h
23 #define vtkOpenGLTexture_h
24 
25 #include "vtkRenderingOpenGL2Module.h" // For export macro
26 #include "vtkTexture.h"
27 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
28 
29 class vtkRenderWindow;
30 class vtkTextureObject;
31 
32 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
33 {
34 public:
35  static vtkOpenGLTexture *New();
36  vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
37  virtual void PrintSelf(ostream& os, vtkIndent indent);
38 
42  virtual void Render(vtkRenderer* ren);
43 
45  void Load(vtkRenderer*);
46 
47  // Descsription:
48  // Clean up after the rendering is complete.
49  virtual void PostRender(vtkRenderer*);
50 
56 
58 
59  vtkGetMacro(Index, long);
61 
63  void CopyTexImage(int x, int y, int width, int height);
64 
66 
67  vtkGetMacro(IsDepthTexture,int);
68  vtkSetMacro(IsDepthTexture,int);
70 
72 
73  vtkGetMacro(TextureType,int);
74  vtkSetMacro(TextureType,int);
76 
77  vtkGetObjectMacro(TextureObject, vtkTextureObject);
78  void SetTextureObject(vtkTextureObject *);
79 
81  virtual int GetTextureUnit();
82 
86  virtual int IsTranslucent();
87 
88 protected:
91 
92  vtkTimeStamp LoadTime;
93  unsigned int Index; // actually GLuint
94  vtkWeakPointer<vtkRenderWindow> RenderWindow; // RenderWindow used for previous render
95 
98 
101 
102  // used when the texture exceeds the GL limit
103  unsigned char *ResampleToPowerOfTwo(int &xsize, int &ysize,
104  unsigned char *dptr, int bpp);
105 
106 
107 private:
108  vtkOpenGLTexture(const vtkOpenGLTexture&); // Not implemented.
109  void operator=(const vtkOpenGLTexture&); // Not implemented.
110 };
111 
112 #endif
virtual void PostRender(vtkRenderer *)
Definition: vtkTexture.h:83
vtkTextureObject * TextureObject
record modification and/or execution time
Definition: vtkTimeStamp.h:34
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkTexture.h:88
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual void Load(vtkRenderer *)
Definition: vtkTexture.h:93
void PrintSelf(ostream &os, vtkIndent indent)
OpenGL texture map.
virtual void Render(vtkRenderer *ren)
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual int IsTranslucent()
a simple class to control print indentation
Definition: vtkIndent.h:38
static vtkTexture * New()
handles properties associated with a texture map
Definition: vtkTexture.h:69
vtkWeakPointer< vtkRenderWindow > RenderWindow
virtual int GetTextureUnit()
Definition: vtkTexture.h:222
abstracts an OpenGL texture object.
create a window for renderers to draw into