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 =========================================================================*/
24 #ifndef vtkOpenGLRenderWindow_h
25 #define vtkOpenGLRenderWindow_h
26 
27 #include "vtkRenderingOpenGLModule.h" // For export macro
28 #include "vtkRenderWindow.h"
29 #include "vtkOpenGL.h" // Needed for GLuint.
30 
31 class vtkIdList;
35 class vtkStdString;
36 
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
44 
45  static void SetGlobalMaximumNumberOfMultiSamples(int val);
46  static int GetGlobalMaximumNumberOfMultiSamples();
48 
50  virtual void StereoUpdate();
51 
53 
54  virtual unsigned char *GetPixelData(int x,int y,int x2,int y2,int front);
55  virtual int GetPixelData(int x,int y,int x2,int y2, int front,
57  virtual int SetPixelData(int x,int y,int x2,int y2,unsigned char *data,
58  int front);
59  virtual int SetPixelData(int x,int y,int x2,int y2,
60  vtkUnsignedCharArray *data, int front);
62 
64 
65  virtual float *GetRGBAPixelData(int x,int y,int x2,int y2,int front);
66  virtual int GetRGBAPixelData(int x,int y,int x2,int y2, int front,
68  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, float *data,
69  int front, int blend=0);
70  virtual int SetRGBAPixelData(int x,int y,int x2,int y2, vtkFloatArray *data,
71  int front, int blend=0);
72  virtual void ReleaseRGBAPixelData(float *data);
73  virtual unsigned char *GetRGBACharPixelData(int x,int y,int x2,int y2,
74  int front);
75  virtual int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
77  virtual int SetRGBACharPixelData(int x, int y, int x2, int y2,
78  unsigned char *data, int front,
79  int blend=0);
80  virtual int SetRGBACharPixelData(int x,int y,int x2,int y2,
81  vtkUnsignedCharArray *data, int front,
82  int blend=0);
84 
86 
87  virtual float *GetZbufferData( int x1, int y1, int x2, int y2 );
88  virtual int GetZbufferData( int x1, int y1, int x2, int y2, float* z );
89  virtual int GetZbufferData( int x1, int y1, int x2, int y2,
90  vtkFloatArray* z );
91  virtual int SetZbufferData( int x1, int y1, int x2, int y2, float *buffer );
92  virtual int SetZbufferData( int x1, int y1, int x2, int y2,
93  vtkFloatArray *buffer );
95 
97  void RegisterTextureResource (GLuint id);
98 
100  int GetDepthBufferSize();
101 
104  int GetColorBufferSizes(int *rgba);
105 
107  virtual void OpenGLInit();
108 
109  // Initialize the state of OpenGL that VTK wants for this window
110  virtual void OpenGLInitState();
111 
112  // Initialize VTK for rendering in a new OpenGL context
113  virtual void OpenGLInitContext();
114 
120  unsigned int GetBackLeftBuffer();
121 
127  unsigned int GetBackRightBuffer();
128 
134  unsigned int GetFrontLeftBuffer();
135 
141  unsigned int GetFrontRightBuffer();
142 
148  unsigned int GetBackBuffer();
149 
155  unsigned int GetFrontBuffer();
156 
158  virtual unsigned long GetContextCreationTime();
159 
162  vtkOpenGLExtensionManager* GetExtensionManager();
163 
166  vtkOpenGLHardwareSupport* GetHardwareSupport();
167 
168  //BTX
170 
172  vtkTextureUnitManager *GetTextureUnitManager();
173  //ETX
175 
178  virtual void WaitForCompletion();
179 
180 protected:
183 
186 
187  int GetPixelData(int x, int y, int x2, int y2, int front, unsigned char* data);
188  int GetRGBAPixelData(int x, int y, int x2, int y2, int front, float* data);
189  int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
190  unsigned char* data);
191 
197  int CreateHardwareOffScreenWindow(int width, int height);
198 
202  void DestroyHardwareOffScreenWindow();
203 
206 
208 
210  unsigned int TextureObjects[4]; // really GLuint
211  unsigned int FrameBufferObject; // really GLuint
212  unsigned int DepthRenderBufferObject; // really GLuint
214 
216  virtual void CreateAWindow() = 0;
217 
219  virtual void DestroyWindow() = 0;
220 
222  void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager);
223 
224  unsigned int BackLeftBuffer;
225  unsigned int BackRightBuffer;
226  unsigned int FrontLeftBuffer;
227  unsigned int FrontRightBuffer;
228  unsigned int FrontBuffer;
229  unsigned int BackBuffer;
230 
233 
235 
237 
238 private:
239  vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented.
240  void operator=(const vtkOpenGLRenderWindow&); // Not implemented.
241 
242  void SetExtensionManager(vtkOpenGLExtensionManager*);
243  void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow);
244 
245  vtkOpenGLExtensionManager* ExtensionManager;
246  vtkOpenGLHardwareSupport* HardwareSupport;
247 };
248 
249 #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
#define VTKRENDERINGOPENGL_EXPORT
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