VTK
vtkOpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLRenderWindow.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 =========================================================================*/
27 #ifndef __vtkOpenGLRenderWindow_h
28 #define __vtkOpenGLRenderWindow_h
29 
30 #include "vtkRenderWindow.h"
31 
32 #include "vtkOpenGL.h" // Needed for GLuint.
33 
34 class vtkIdList;
38 
40 {
41 protected:
43 
44 public:
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
49 
50  static void SetGlobalMaximumNumberOfMultiSamples(int val);
51  static int GetGlobalMaximumNumberOfMultiSamples();
53 
55  virtual void StereoUpdate();
56 
58 
59  virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front);
60  virtual int GetPixelData(int x,int y,int x2,int y2, int front,
62  virtual int SetPixelData(int x,int y,int x2,int y2,unsigned char *data,
63  int front);
64  virtual int SetPixelData(int x,int y,int x2,int y2,
65  vtkUnsignedCharArray *data, int front);
67 
69 
70  virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front);
71  virtual int GetRGBAPixelData(int x,int y,int x2,int y2, int front,
73  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, float *data,
74  int front, int blend=0);
75  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, vtkFloatArray *data,
76  int front, int blend=0);
77  virtual void ReleaseRGBAPixelData(float *data);
78  virtual unsigned char *GetRGBACharPixelData(int x,int y,int x2,int y2,
79  int front);
80  virtual int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
82  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
83  unsigned char *data, int front,
84  int blend=0);
85  virtual int SetRGBACharPixelData(int x,int y,int x2,int y2,
86  vtkUnsignedCharArray *data, int front,
87  int blend=0);
89 
91 
92  virtual float *GetZbufferData( int x1, int y1, int x2, int y2 );
93  virtual int GetZbufferData( int x1, int y1, int x2, int y2, float* z );
94  virtual int GetZbufferData( int x1, int y1, int x2, int y2,
95  vtkFloatArray* z );
96  virtual int SetZbufferData( int x1, int y1, int x2, int y2, float *buffer );
97  virtual int SetZbufferData( int x1, int y1, int x2, int y2,
98  vtkFloatArray *buffer );
100 
102  void RegisterTextureResource (GLuint id);
103 
105  int GetDepthBufferSize();
106 
109  int GetColorBufferSizes(int *rgba);
110 
112  virtual void OpenGLInit();
113 
119  unsigned int GetBackLeftBuffer();
120 
126  unsigned int GetBackRightBuffer();
127 
133  unsigned int GetFrontLeftBuffer();
134 
140  unsigned int GetFrontRightBuffer();
141 
147  unsigned int GetBackBuffer();
148 
154  unsigned int GetFrontBuffer();
155 
159  virtual void CheckGraphicError();
160 
162  virtual int HasGraphicError();
163 
165  virtual const char *GetLastGraphicErrorString();
166 
167 //BTX
169 
170  vtkGetMacro(ContextCreationTime, vtkTimeStamp);
171 //ETX
173 
176  vtkOpenGLExtensionManager* GetExtensionManager();
177 
180  vtkOpenGLHardwareSupport* GetHardwareSupport();
181 
182  //BTX
184 
186  vtkTextureUnitManager *GetTextureUnitManager();
187  //ETX
189 
192  virtual void WaitForCompletion();
193 
194 protected:
197 
199 
200  int GetPixelData(int x,int y,int x2,int y2,int front, unsigned char* data);
201  int GetRGBAPixelData(int x,int y,int x2,int y2, int front, float* data);
202  int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
203  unsigned char* data);
204 
210  int CreateHardwareOffScreenWindow(int width, int height);
211 
215  void DestroyHardwareOffScreenWindow();
216 
219 
221 
223  unsigned int TextureObjects[4]; // really GLuint
224  unsigned int FrameBufferObject; // really GLuint
225  unsigned int DepthRenderBufferObject; // really GLuint
227 
229  virtual void CreateAWindow()=0;
230 
232  virtual void DestroyWindow()=0;
233 
235  void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager);
236 
237  unsigned int BackLeftBuffer;
238  unsigned int BackRightBuffer;
239  unsigned int FrontLeftBuffer;
240  unsigned int FrontRightBuffer;
241  unsigned int FrontBuffer;
242  unsigned int BackBuffer;
243 
244  // Actual type is GLenum. Last value returned by glGetError().
245  unsigned int LastGraphicError;
246 
248 
250 
251 private:
252  vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented.
253  void operator=(const vtkOpenGLRenderWindow&); // Not implemented.
254 
255  void SetExtensionManager(vtkOpenGLExtensionManager*);
256  void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow);
257 
258  vtkOpenGLExtensionManager* ExtensionManager;
259  vtkOpenGLHardwareSupport* HardwareSupport;
260 };
261 
262 #endif