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,
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 
159  VTK_LEGACY(virtual void CheckGraphicError());
160  VTK_LEGACY(virtual int HasGraphicError());
161  VTK_LEGACY(virtual const char *GetLastGraphicErrorString());
163 
165  virtual unsigned long GetContextCreationTime();
166 
169  vtkOpenGLExtensionManager* GetExtensionManager();
170 
173  vtkOpenGLHardwareSupport* GetHardwareSupport();
174 
175  //BTX
177 
179  vtkTextureUnitManager *GetTextureUnitManager();
180  //ETX
182 
185  virtual void WaitForCompletion();
186 
187 protected:
190 
193 
194  int GetPixelData(int x, int y, int x2, int y2, int front, unsigned char* data);
195  int GetRGBAPixelData(int x, int y, int x2, int y2, int front, float* data);
196  int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
197  unsigned char* data);
198 
204  int CreateHardwareOffScreenWindow(int width, int height);
205 
209  void DestroyHardwareOffScreenWindow();
210 
213 
215 
217  unsigned int TextureObjects[4]; // really GLuint
218  unsigned int FrameBufferObject; // really GLuint
219  unsigned int DepthRenderBufferObject; // really GLuint
221 
223  virtual void CreateAWindow() = 0;
224 
226  virtual void DestroyWindow() = 0;
227 
229  void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager);
230 
231  unsigned int BackLeftBuffer;
232  unsigned int BackRightBuffer;
233  unsigned int FrontLeftBuffer;
234  unsigned int FrontRightBuffer;
235  unsigned int FrontBuffer;
236  unsigned int BackBuffer;
237 
238 #ifndef VTK_LEGACY_REMOVE
239 
240 
241  unsigned int LastGraphicError;
242 #endif
243 
244 
247 
249 
251 
252 private:
253  vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented.
254  void operator=(const vtkOpenGLRenderWindow&); // Not implemented.
255 
256  void SetExtensionManager(vtkOpenGLExtensionManager*);
257  void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow);
258 
259  vtkOpenGLExtensionManager* ExtensionManager;
260  vtkOpenGLHardwareSupport* HardwareSupport;
261 };
262 
263 #endif
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
OpenGL rendering window.
virtual int HasGraphicError()=0
VTKRENDERINGOPENGL_EXPORT PFNGLXDESTROYWINDOWPROC DestroyWindow
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
GLuint buffer
Definition: vtkgl.h:11839
virtual unsigned char * GetPixelData(int x, int y, int x2, int y2, int front)=0
typedef GLuint(APIENTRYP PFNGLCREATEPROGRAMPROC)(void)
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
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
GLint GLint GLsizei GLsizei height
Definition: vtkgl.h:11316
virtual unsigned char * GetRGBACharPixelData(int x, int y, int x2, int y2, int front)=0
GLdouble GLdouble z
Definition: vtkgl.h:11754
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void CheckGraphicError()=0
virtual void ReleaseRGBAPixelData(float *data)=0
list of point or cell ids
Definition: vtkIdList.h:35
#define VTKRENDERINGOPENGL_EXPORT
GLint GLint GLsizei width
Definition: vtkgl.h:11316
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
#define VTK_LEGACY(method)
Definition: vtkSetGet.h:800
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
GLuint GLfloat * val
Definition: vtkgl.h:13789
virtual const char * GetLastGraphicErrorString()=0