VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL2/vtkOpenGLTexture.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOpenGLTexture.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00022 #ifndef vtkOpenGLTexture_h
00023 #define vtkOpenGLTexture_h
00024 
00025 #include "vtkRenderingOpenGL2Module.h" // For export macro
00026 #include "vtkTexture.h"
00027 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00028 
00029 class vtkRenderWindow;
00030 class vtkTextureObject;
00031 
00032 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLTexture : public vtkTexture
00033 {
00034 public:
00035   static vtkOpenGLTexture *New();
00036   vtkTypeMacro(vtkOpenGLTexture, vtkTexture);
00037   virtual void PrintSelf(ostream& os, vtkIndent indent);
00038 
00042   virtual void Render(vtkRenderer* ren);
00043 
00045   void Load(vtkRenderer*);
00046 
00047   // Descsription:
00048   // Clean up after the rendering is complete.
00049   virtual void PostRender(vtkRenderer*);
00050 
00055   void ReleaseGraphicsResources(vtkWindow*);
00056 
00058 
00059   vtkGetMacro(Index, long);
00061 
00063   void CopyTexImage(int x, int y, int width, int height);
00064 
00066 
00067   vtkGetMacro(IsDepthTexture,int);
00068   vtkSetMacro(IsDepthTexture,int);
00070 
00072 
00073   vtkGetMacro(TextureType,int);
00074   vtkSetMacro(TextureType,int);
00076 
00077   vtkGetObjectMacro(TextureObject, vtkTextureObject);
00078   void SetTextureObject(vtkTextureObject *);
00079 
00081   virtual int GetTextureUnit();
00082 
00086   virtual int IsTranslucent();
00087 
00088 protected:
00089   vtkOpenGLTexture();
00090   ~vtkOpenGLTexture();
00091 
00092   vtkTimeStamp   LoadTime;
00093   unsigned int Index; // actually GLuint
00094   vtkWeakPointer<vtkRenderWindow> RenderWindow;   // RenderWindow used for previous render
00095 
00096   bool ExternalTextureObject;
00097   vtkTextureObject *TextureObject;
00098 
00099   int IsDepthTexture;
00100   int TextureType;
00101 
00102   // used when the texture exceeds the GL limit
00103   unsigned char *ResampleToPowerOfTwo(int &xsize, int &ysize,
00104                                       unsigned char *dptr, int bpp);
00105 
00106 
00107 private:
00108   vtkOpenGLTexture(const vtkOpenGLTexture&);  // Not implemented.
00109   void operator=(const vtkOpenGLTexture&);  // Not implemented.
00110 };
00111 
00112 #endif