OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkXOpenGLRenderWindow.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkXOpenGLRenderWindow.h,v $
5   Language:  C++
6   Date:      $Date: 2003/01/24 16:24:02 $
7   Version:   $Revision: 1.21 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkXOpenGLRenderWindow - OpenGL rendering window
19 // .SECTION Description
20 // vtkXOpenGLRenderWindow is a concrete implementation of the abstract class
21 // vtkRenderWindow. vtkOpenGLRenderer interfaces to the OpenGL graphics
22 // library. Application programmers should normally use vtkRenderWindow
23 // instead of the OpenGL specific version.
24
25 #ifndef __vtkXOpenGLRenderWindow_h
26 #define __vtkXOpenGLRenderWindow_h
27
28 #include "vtkOpenGLRenderWindow.h"
29 #include <X11/Xlib.h> // Needed for X types used in the public interface
30 #include <X11/Xutil.h> // Needed for X types used in the public interface
31
32 class vtkIdList;
33 class vtkXOpenGLRenderWindowInternal;
34
35 class VTK_RENDERING_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
36 {
37 public:
38   static vtkXOpenGLRenderWindow *New();
39   vtkTypeRevisionMacro(vtkXOpenGLRenderWindow,vtkOpenGLRenderWindow);
40   void PrintSelf(ostream& os, vtkIndent indent);
41
42   // Description:
43   // Begin the rendering process.
44   virtual void Start(void);
45
46   // Description:
47   // End the rendering process and display the image.
48   virtual void Frame(void);
49
50   // Description:
51   // Initialize the window for rendering.
52   virtual void WindowInitialize(void);
53
54   // Description:
55   // Initialize the rendering window.
56   virtual void Initialize(void);
57
58   // Description:
59   // Change the window to fill the entire screen.
60   virtual void SetFullScreen(int);
61
62   // Description:
63   // Resize the window.
64   virtual void WindowRemap(void);
65
66   // Description:
67   // Set the preferred window size to full screen.
68   virtual void PrefFullScreen(void);
69
70   // Description:
71   // Specify the size of the rendering window.
72   virtual void SetSize(int,int);
73   virtual void SetSize(int a[2]) {this->SetSize(a[0], a[1]);};
74
75   // Description:
76   // Get the X properties of an ideal rendering window.
77   virtual Colormap GetDesiredColormap();
78   virtual Visual  *GetDesiredVisual();
79   virtual XVisualInfo     *GetDesiredVisualInfo();
80   virtual int      GetDesiredDepth();
81
82   // Description:
83   // Prescribe that the window be created in a stereo-capable mode. This
84   // method must be called before the window is realized. This method
85   // overrides the superclass method since this class can actually check
86   // whether the window has been realized yet.
87   virtual void SetStereoCapableWindow(int capable);
88
89   // Description:
90   // Make this window the current OpenGL context.
91   void MakeCurrent();
92
93   // Description:
94   // If called, allow MakeCurrent() to skip cache-check when called.
95   // MakeCurrent() reverts to original behavior of cache-checking     
96   // on the next render.     
97   void SetForceMakeCurrent();
98
99   // Description:
100   // Get report of capabilities for the render window
101   const char *ReportCapabilities();
102
103   // Description:
104   // Does this render window support OpenGL? 0-false, 1-true
105   int SupportsOpenGL();
106
107   // Description:
108   // Is this render window using hardware acceleration? 0-false, 1-true
109   int IsDirect();
110
111   // Description:
112   // Xwindow get set functions
113   virtual void *GetGenericDisplayId() {return (void *)this->GetDisplayId();};
114   virtual void *GetGenericWindowId();
115   virtual void *GetGenericParentId()  {return (void *)this->ParentId;};
116   virtual void *GetGenericContext();
117   virtual void *GetGenericDrawable()  {return (void *)this->WindowId;};
118   
119   // Description:
120   // Get the size of the screen in pixels
121   virtual int     *GetScreenSize();
122
123   // Description:
124   // Get the position in screen coordinates (pixels) of the window.
125   virtual int     *GetPosition();
126
127   // Description:
128   // Get this RenderWindow's X display id.
129   Display *GetDisplayId();
130
131   // Description:
132   // Set the X display id for this RenderWindow to use to a pre-existing 
133   // X display id.
134   void     SetDisplayId(Display *);
135   void     SetDisplayId(void *);
136
137   // Description:
138   // Get this RenderWindow's parent X window id.
139   Window   GetParentId();
140
141   // Description:
142   // Sets the parent of the window that WILL BE created.
143   void     SetParentId(Window);
144   void     SetParentId(void *);
145   
146   // Description:
147   // Get this RenderWindow's X window id.
148   Window   GetWindowId();
149
150   // Description:
151   // Set this RenderWindow's X window id to a pre-existing window.
152   void     SetWindowId(Window);
153   void     SetWindowId(void *);
154
155   // Description:
156   // Specify the X window id to use if a WindowRemap is done.
157   void     SetNextWindowId(Window);
158   void     SetWindowName(const char *);
159
160   // Description:
161   // Move the window to a new position on the display.
162   void     SetPosition(int,int);
163   void     SetPosition(int a[2]) {this->SetPosition(a[0], a[1]);};
164   
165   // Description:
166   // Hide or Show the mouse cursor, it is nice to be able to hide the
167   // default cursor if you want VTK to display a 3D cursor instead.
168   void HideCursor();
169   void ShowCursor();
170
171   // Description:
172   // Change the shape of the cursor
173   virtual void SetCurrentCursor(int);
174
175   // Description:
176   // Check to see if a mouse button has been pressed.
177   // All other events are ignored by this method.
178   // This is a useful check to abort a long render.
179   virtual  int GetEventPending();
180   
181   // Description:
182   // Set this RenderWindow's X window id to a pre-existing window.
183   void     SetWindowInfo(char *info);
184
185   // Description:
186   // Sets the X window id of the window that WILL BE created.
187   void     SetParentInfo(char *info);
188
189   // Description:
190   // This computes the size of the render window 
191   // before calling the supper classes render
192   void Render();  
193
194   // Description:
195   // Render without displaying the window.
196   void SetOffScreenRendering(int i);
197
198 protected:
199   vtkXOpenGLRenderWindow();
200   ~vtkXOpenGLRenderWindow();
201
202   vtkXOpenGLRenderWindowInternal *Internal;
203   
204   Window   ParentId;
205   Window   WindowId;
206   Window   NextWindowId;
207   Display *DisplayId;
208   Colormap ColorMap;
209   int      OwnWindow;
210   int      OwnDisplay;
211   int      ScreenSize[2];
212   int      CursorHidden;
213   int      ForceMakeCurrent;
214   int      UsingHardware;
215   char    *Capabilities;
216
217   // we must keep track of the cursors we are using
218   Cursor XCArrow;
219   Cursor XCSizeAll;
220   Cursor XCSizeNS;
221   Cursor XCSizeWE;
222   Cursor XCSizeNE;
223   Cursor XCSizeNW;
224   Cursor XCSizeSE;
225   Cursor XCSizeSW;
226   
227 private:
228   vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&);  // Not implemented.
229   void operator=(const vtkXOpenGLRenderWindow&);  // Not implemented.
230 };
231
232
233
234 #endif