|
VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLRenderWindow.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 =========================================================================*/ 00027 #ifndef __vtkOpenGLRenderWindow_h 00028 #define __vtkOpenGLRenderWindow_h 00029 00030 #include "vtkRenderWindow.h" 00031 00032 #include "vtkOpenGL.h" // Needed for GLuint. 00033 00034 class vtkIdList; 00035 class vtkOpenGLExtensionManager; 00036 class vtkOpenGLHardwareSupport; 00037 class vtkTextureUnitManager; 00038 00039 class VTK_RENDERING_EXPORT vtkOpenGLRenderWindow : public vtkRenderWindow 00040 { 00041 protected: 00042 long OldMonitorSetting; 00043 00044 public: 00045 vtkTypeMacro(vtkOpenGLRenderWindow,vtkRenderWindow); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00047 00049 00050 static void SetGlobalMaximumNumberOfMultiSamples(int val); 00051 static int GetGlobalMaximumNumberOfMultiSamples(); 00053 00055 virtual void StereoUpdate(); 00056 00058 00059 virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front); 00060 virtual int GetPixelData(int x,int y,int x2,int y2, int front, 00061 vtkUnsignedCharArray *data); 00062 virtual int SetPixelData(int x,int y,int x2,int y2,unsigned char *data, 00063 int front); 00064 virtual int SetPixelData(int x,int y,int x2,int y2, 00065 vtkUnsignedCharArray *data, int front); 00067 00069 00070 virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front); 00071 virtual int GetRGBAPixelData(int x,int y,int x2,int y2, int front, 00072 vtkFloatArray* data); 00073 virtual int SetRGBAPixelData(int x,int y,int x2,int y2, float *data, 00074 int front, int blend=0); 00075 virtual int SetRGBAPixelData(int x,int y,int x2,int y2, vtkFloatArray *data, 00076 int front, int blend=0); 00077 virtual void ReleaseRGBAPixelData(float *data); 00078 virtual unsigned char *GetRGBACharPixelData(int x,int y,int x2,int y2, 00079 int front); 00080 virtual int GetRGBACharPixelData(int x,int y,int x2,int y2, int front, 00081 vtkUnsignedCharArray *data); 00082 virtual int SetRGBACharPixelData(int x, int y, int x2, int y2, 00083 unsigned char *data, int front, 00084 int blend=0); 00085 virtual int SetRGBACharPixelData(int x,int y,int x2,int y2, 00086 vtkUnsignedCharArray *data, int front, 00087 int blend=0); 00089 00091 00092 virtual float *GetZbufferData( int x1, int y1, int x2, int y2 ); 00093 virtual int GetZbufferData( int x1, int y1, int x2, int y2, float* z ); 00094 virtual int GetZbufferData( int x1, int y1, int x2, int y2, 00095 vtkFloatArray* z ); 00096 virtual int SetZbufferData( int x1, int y1, int x2, int y2, float *buffer ); 00097 virtual int SetZbufferData( int x1, int y1, int x2, int y2, 00098 vtkFloatArray *buffer ); 00100 00102 void RegisterTextureResource (GLuint id); 00103 00105 int GetDepthBufferSize(); 00106 00109 int GetColorBufferSizes(int *rgba); 00110 00112 virtual void OpenGLInit(); 00113 00119 unsigned int GetBackLeftBuffer(); 00120 00126 unsigned int GetBackRightBuffer(); 00127 00133 unsigned int GetFrontLeftBuffer(); 00134 00140 unsigned int GetFrontRightBuffer(); 00141 00147 unsigned int GetBackBuffer(); 00148 00154 unsigned int GetFrontBuffer(); 00155 00159 virtual void CheckGraphicError(); 00160 00162 virtual int HasGraphicError(); 00163 00165 virtual const char *GetLastGraphicErrorString(); 00166 00168 virtual unsigned long GetContextCreationTime(); 00169 00172 vtkOpenGLExtensionManager* GetExtensionManager(); 00173 00176 vtkOpenGLHardwareSupport* GetHardwareSupport(); 00177 00178 //BTX 00180 00182 vtkTextureUnitManager *GetTextureUnitManager(); 00183 //ETX 00185 00188 virtual void WaitForCompletion(); 00189 00190 protected: 00191 vtkOpenGLRenderWindow(); 00192 ~vtkOpenGLRenderWindow(); 00193 00194 vtkIdList *TextureResourceIds; 00195 00196 int GetPixelData(int x,int y,int x2,int y2,int front, unsigned char* data); 00197 int GetRGBAPixelData(int x,int y,int x2,int y2, int front, float* data); 00198 int GetRGBACharPixelData(int x,int y,int x2,int y2, int front, 00199 unsigned char* data); 00200 00206 int CreateHardwareOffScreenWindow(int width, int height); 00207 00211 void DestroyHardwareOffScreenWindow(); 00212 00214 int OffScreenUseFrameBuffer; 00215 00217 00218 int NumberOfFrameBuffers; 00219 unsigned int TextureObjects[4]; // really GLuint 00220 unsigned int FrameBufferObject; // really GLuint 00221 unsigned int DepthRenderBufferObject; // really GLuint 00223 00225 virtual void CreateAWindow()=0; 00226 00228 virtual void DestroyWindow()=0; 00229 00231 void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager); 00232 00233 unsigned int BackLeftBuffer; 00234 unsigned int BackRightBuffer; 00235 unsigned int FrontLeftBuffer; 00236 unsigned int FrontRightBuffer; 00237 unsigned int FrontBuffer; 00238 unsigned int BackBuffer; 00239 00240 // Actual type is GLenum. Last value returned by glGetError(). 00241 unsigned int LastGraphicError; 00242 00243 vtkTimeStamp ContextCreationTime; 00244 00245 vtkTextureUnitManager *TextureUnitManager; 00246 00247 private: 00248 vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented. 00249 void operator=(const vtkOpenGLRenderWindow&); // Not implemented. 00250 00251 void SetExtensionManager(vtkOpenGLExtensionManager*); 00252 void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow); 00253 00254 vtkOpenGLExtensionManager* ExtensionManager; 00255 vtkOpenGLHardwareSupport* HardwareSupport; 00256 }; 00257 00258 #endif
1.7.6.1