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 "vtkRenderingOpenGLModule.h" // For export macro
31 #include "vtkRenderWindow.h"
32 #include "vtkOpenGL.h" // Needed for GLuint.
33 
34 class vtkIdList;
38 class vtkStdString;
39 
40 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLRenderWindow : public vtkRenderWindow
41 {
42 public:
44  void PrintSelf(ostream& os, vtkIndent indent);
45 
47 
48  static void SetGlobalMaximumNumberOfMultiSamples(int val);
49  static int GetGlobalMaximumNumberOfMultiSamples();
51 
53  virtual void StereoUpdate();
54 
56 
57  virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front);
58  virtual int GetPixelData(int x,int y,int x2,int y2, int front,
60  virtual int SetPixelData(int x,int y,int x2,int y2,unsigned char *data,
61  int front);
62  virtual int SetPixelData(int x,int y,int x2,int y2,
63  vtkUnsignedCharArray *data, int front);
65 
67 
68  virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front);
69  virtual int GetRGBAPixelData(int x,int y,int x2,int y2, int front,
71  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, float *data,
72  int front, int blend=0);
73  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, vtkFloatArray *data,
74  int front, int blend=0);
75  virtual void ReleaseRGBAPixelData(float *data);
76  virtual unsigned char *GetRGBACharPixelData(int x,int y,int x2,int y2,
77  int front);
78  virtual int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
80  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
81  unsigned char *data, int front,
82  int blend=0);
83  virtual int SetRGBACharPixelData(int x,int y,int x2,int y2,
84  vtkUnsignedCharArray *data, int front,
85  int blend=0);
87 
89 
90  virtual float *GetZbufferData( int x1, int y1, int x2, int y2 );
91  virtual int GetZbufferData( int x1, int y1, int x2, int y2, float* z );
92  virtual int GetZbufferData( int x1, int y1, int x2, int y2,
93  vtkFloatArray* z );
94  virtual int SetZbufferData( int x1, int y1, int x2, int y2, float *buffer );
95  virtual int SetZbufferData( int x1, int y1, int x2, int y2,
96  vtkFloatArray *buffer );
98 
100  void RegisterTextureResource (GLuint id);
101 
103  int GetDepthBufferSize();
104 
107  int GetColorBufferSizes(int *rgba);
108 
110  virtual void OpenGLInit();
111 
112  // Initialize the state of OpenGL that VTK wants for this window
113  virtual void OpenGLInitState();
114 
115  // Initialize VTK for rendering in a new OpenGL context
116  virtual void OpenGLInitContext();
117 
123  unsigned int GetBackLeftBuffer();
124 
130  unsigned int GetBackRightBuffer();
131 
137  unsigned int GetFrontLeftBuffer();
138 
144  unsigned int GetFrontRightBuffer();
145 
151  unsigned int GetBackBuffer();
152 
158  unsigned int GetFrontBuffer();
159 
161  virtual unsigned long GetContextCreationTime();
162 
165  vtkOpenGLExtensionManager* GetExtensionManager();
166 
169  vtkOpenGLHardwareSupport* GetHardwareSupport();
170 
171  //BTX
173 
175  vtkTextureUnitManager *GetTextureUnitManager();
176  //ETX
178 
181  virtual void WaitForCompletion();
182 
183 protected:
186 
189 
190  int GetPixelData(int x, int y, int x2, int y2, int front, unsigned char* data);
191  int GetRGBAPixelData(int x, int y, int x2, int y2, int front, float* data);
192  int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
193  unsigned char* data);
194 
200  int CreateHardwareOffScreenWindow(int width, int height);
201 
205  void DestroyHardwareOffScreenWindow();
206 
209 
211 
213  unsigned int TextureObjects[4]; // really GLuint
214  unsigned int FrameBufferObject; // really GLuint
215  unsigned int DepthRenderBufferObject; // really GLuint
217 
219  virtual void CreateAWindow() = 0;
220 
222  virtual void DestroyWindow() = 0;
223 
225  void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager);
226 
227  unsigned int BackLeftBuffer;
228  unsigned int BackRightBuffer;
229  unsigned int FrontLeftBuffer;
230  unsigned int FrontRightBuffer;
231  unsigned int FrontBuffer;
232  unsigned int BackBuffer;
233 
236 
238 
240 
241 private:
242  vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented.
243  void operator=(const vtkOpenGLRenderWindow&); // Not implemented.
244 
245  void SetExtensionManager(vtkOpenGLExtensionManager*);
246  void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow);
247 
248  vtkOpenGLExtensionManager* ExtensionManager;
249  vtkOpenGLHardwareSupport* HardwareSupport;
250 };
251 
252 #endif
OpenGL rendering window.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
virtual unsigned char * GetPixelData(int x, int y, int x2, int y2, int front)=0
record modification and/or execution time
Definition: vtkTimeStamp.h:34
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
virtual int GetColorBufferSizes(int *rgba)=0
vtkTextureUnitManager * TextureUnitManager
virtual int SetRGBAPixelData(int x, int y, int x2, int y2, float *, int front, int blend=0)=0
virtual unsigned char * GetRGBACharPixelData(int x, int y, int x2, int y2, int front)=0
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void ReleaseRGBAPixelData(float *data)=0
list of point or cell ids
Definition: vtkIdList.h:35
virtual int GetDepthBufferSize()=0
void PrintSelf(ostream &os, vtkIndent indent)
virtual int SetZbufferData(int x, int y, int x2, int y2, float *z)=0
virtual float * GetRGBAPixelData(int x, int y, int x2, int y2, int front)=0
virtual void StereoUpdate()
Interface class for querying and using OpenGL extensions.
dynamic, self-adjusting array of unsigned char
allocate/free texture units.
create a window for renderers to draw into
OpenGL rendering window.
virtual float * GetZbufferData(int x, int y, int x2, int y2)=0
virtual int SetPixelData(int x, int y, int x2, int y2, unsigned char *data, int front)=0
virtual int SetRGBACharPixelData(int x, int y, int x2, int y2, unsigned char *data, int front, int blend=0)=0
virtual void WaitForCompletion()=0