VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
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,
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 
162  VTK_LEGACY(virtual void CheckGraphicError());
163  VTK_LEGACY(virtual int HasGraphicError());
164  VTK_LEGACY(virtual const char *GetLastGraphicErrorString());
166 
168  virtual unsigned long GetContextCreationTime();
169 
172  vtkOpenGLExtensionManager* GetExtensionManager();
173 
176  vtkOpenGLHardwareSupport* GetHardwareSupport();
177 
178  //BTX
180 
182  vtkTextureUnitManager *GetTextureUnitManager();
183  //ETX
185 
188  virtual void WaitForCompletion();
189 
190 protected:
193 
196 
197  int GetPixelData(int x, int y, int x2, int y2, int front, unsigned char* data);
198  int GetRGBAPixelData(int x, int y, int x2, int y2, int front, float* data);
199  int GetRGBACharPixelData(int x, int y, int x2, int y2, int front,
200  unsigned char* data);
201 
207  int CreateHardwareOffScreenWindow(int width, int height);
208 
212  void DestroyHardwareOffScreenWindow();
213 
216 
218 
220  unsigned int TextureObjects[4]; // really GLuint
221  unsigned int FrameBufferObject; // really GLuint
222  unsigned int DepthRenderBufferObject; // really GLuint
224 
226  virtual void CreateAWindow() = 0;
227 
229  virtual void DestroyWindow() = 0;
230 
232  void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager);
233 
234  unsigned int BackLeftBuffer;
235  unsigned int BackRightBuffer;
236  unsigned int FrontLeftBuffer;
237  unsigned int FrontRightBuffer;
238  unsigned int FrontBuffer;
239  unsigned int BackBuffer;
240 
241 #ifndef VTK_LEGACY_REMOVE
242 
243 
244  unsigned int LastGraphicError;
245 #endif
246 
247 
250 
252 
254 
255 private:
256  vtkOpenGLRenderWindow(const vtkOpenGLRenderWindow&); // Not implemented.
257  void operator=(const vtkOpenGLRenderWindow&); // Not implemented.
258 
259  void SetExtensionManager(vtkOpenGLExtensionManager*);
260  void SetHardwareSupport(vtkOpenGLHardwareSupport * renderWindow);
261 
262  vtkOpenGLExtensionManager* ExtensionManager;
263  vtkOpenGLHardwareSupport* HardwareSupport;
264 };
265 
266 #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
vtkTextureUnitManager * TextureUnitManager
virtual int GetColorBufferSizes(int *rgba)=0
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
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
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