1 | /****************************************************************************** |
---|
2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
3 | * |
---|
4 | * Copyright (C) 2004 Electronic Visualization Laboratory, |
---|
5 | * University of Illinois at Chicago |
---|
6 | * |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright |
---|
13 | * notice, this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above |
---|
15 | * copyright notice, this list of conditions and the following disclaimer |
---|
16 | * in the documentation and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the University of Illinois at Chicago nor |
---|
18 | * the names of its contributors may be used to endorse or promote |
---|
19 | * products derived from this software without specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
25 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | * |
---|
33 | * Direct questions, comments etc about SAGE to http://www.evl.uic.edu/cavern/forum/ |
---|
34 | * |
---|
35 | *****************************************************************************/ |
---|
36 | |
---|
37 | /*========================================================================= |
---|
38 | |
---|
39 | Program: Visualization Toolkit |
---|
40 | Module: $RCSfile: vtkXOpenGLOffScreenRenderWindow.h,v $ |
---|
41 | Language: C++ |
---|
42 | Date: $Date: 2003/03/26 14:04:59 $ |
---|
43 | Version: $Revision: 1.22 $ |
---|
44 | |
---|
45 | Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen |
---|
46 | All rights reserved. |
---|
47 | See Copyright.txt or http://www.kitware.com/Copyright.htm for details. |
---|
48 | |
---|
49 | This software is distributed WITHOUT ANY WARRANTY; without even |
---|
50 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
---|
51 | PURPOSE. See the above copyright notice for more information. |
---|
52 | |
---|
53 | =========================================================================*/ |
---|
54 | // .NAME vtkXOpenGLOffScreenRenderWindow - OpenGL rendering window |
---|
55 | // .SECTION Description |
---|
56 | // vtkXOpenGLOffScreenRenderWindow is a concrete implementation of the abstract class |
---|
57 | // vtkRenderWindow. vtkOpenGLRenderer interfaces to the OpenGL graphics |
---|
58 | // library. Application programmers should normally use vtkRenderWindow |
---|
59 | // instead of the OpenGL specific version. |
---|
60 | |
---|
61 | #ifndef __vtkXOpenGLOffScreenRenderWindow_h |
---|
62 | #define __vtkXOpenGLOffScreenRenderWindow_h |
---|
63 | |
---|
64 | #include "vtk/vtkOpenGLRenderWindow.h" |
---|
65 | #include <X11/Xlib.h> // Needed for X types used in the public interface |
---|
66 | #include <X11/Xutil.h> // Needed for X types used in the public interface |
---|
67 | |
---|
68 | class vtkIdList; |
---|
69 | class vtkXOpenGLOffScreenRenderWindowInternal; |
---|
70 | |
---|
71 | class VTK_RENDERING_EXPORT vtkXOpenGLOffScreenRenderWindow : public vtkOpenGLRenderWindow |
---|
72 | { |
---|
73 | public: |
---|
74 | static vtkXOpenGLOffScreenRenderWindow *New(); |
---|
75 | vtkTypeRevisionMacro(vtkXOpenGLOffScreenRenderWindow,vtkOpenGLRenderWindow); |
---|
76 | void PrintSelf(ostream& os, vtkIndent indent); |
---|
77 | |
---|
78 | // Description: |
---|
79 | // Begin the rendering process. |
---|
80 | virtual void Start(void); |
---|
81 | |
---|
82 | // Description: |
---|
83 | // End the rendering process and display the image. |
---|
84 | virtual void Frame(void); |
---|
85 | |
---|
86 | // Description: |
---|
87 | // Initialize the window for rendering. |
---|
88 | virtual void WindowInitialize(void); |
---|
89 | |
---|
90 | // Description: |
---|
91 | // Initialize the rendering window. |
---|
92 | virtual void Initialize(void); |
---|
93 | |
---|
94 | // Description: |
---|
95 | // Change the window to fill the entire screen. |
---|
96 | virtual void SetFullScreen(int); |
---|
97 | |
---|
98 | // Description: |
---|
99 | // Resize the window. |
---|
100 | virtual void WindowRemap(void); |
---|
101 | |
---|
102 | // Description: |
---|
103 | // Set the preferred window size to full screen. |
---|
104 | virtual void PrefFullScreen(void); |
---|
105 | |
---|
106 | // Description: |
---|
107 | // Specify the size of the rendering window. |
---|
108 | virtual void SetSize(int,int); |
---|
109 | virtual void SetSize(int a[2]) {this->SetSize(a[0], a[1]);}; |
---|
110 | |
---|
111 | // Description: |
---|
112 | // Get the X properties of an ideal rendering window. |
---|
113 | virtual Colormap GetDesiredColormap(); |
---|
114 | virtual Visual *GetDesiredVisual(); |
---|
115 | virtual XVisualInfo *GetDesiredVisualInfo(); |
---|
116 | virtual int GetDesiredDepth(); |
---|
117 | |
---|
118 | // Description: |
---|
119 | // Prescribe that the window be created in a stereo-capable mode. This |
---|
120 | // method must be called before the window is realized. This method |
---|
121 | // overrides the superclass method since this class can actually check |
---|
122 | // whether the window has been realized yet. |
---|
123 | virtual void SetStereoCapableWindow(int capable); |
---|
124 | |
---|
125 | // Description: |
---|
126 | // Make this window the current OpenGL context. |
---|
127 | void MakeCurrent(); |
---|
128 | |
---|
129 | // Description: |
---|
130 | // If called, allow MakeCurrent() to skip cache-check when called. |
---|
131 | // MakeCurrent() reverts to original behavior of cache-checking |
---|
132 | // on the next render. |
---|
133 | void SetForceMakeCurrent(); |
---|
134 | |
---|
135 | // Description: |
---|
136 | // Get report of capabilities for the render window |
---|
137 | const char *ReportCapabilities(); |
---|
138 | |
---|
139 | // Description: |
---|
140 | // Does this render window support OpenGL? 0-false, 1-true |
---|
141 | int SupportsOpenGL(); |
---|
142 | |
---|
143 | // Description: |
---|
144 | // Is this render window using hardware acceleration? 0-false, 1-true |
---|
145 | int IsDirect(); |
---|
146 | |
---|
147 | // Description: |
---|
148 | // Xwindow get set functions |
---|
149 | virtual void *GetGenericDisplayId() {return (void *)this->GetDisplayId();}; |
---|
150 | virtual void *GetGenericWindowId(); |
---|
151 | virtual void *GetGenericParentId() {return (void *)this->ParentId;}; |
---|
152 | virtual void *GetGenericContext(); |
---|
153 | virtual void *GetGenericDrawable() {return (void *)this->WindowId;}; |
---|
154 | |
---|
155 | // Description: |
---|
156 | // Get the size of the screen in pixels |
---|
157 | virtual int *GetScreenSize(); |
---|
158 | |
---|
159 | // Description: |
---|
160 | // Get this RenderWindow's X display id. |
---|
161 | Display *GetDisplayId(); |
---|
162 | |
---|
163 | // Description: |
---|
164 | // Create the default pixmap |
---|
165 | Pixmap pixmap; |
---|
166 | |
---|
167 | // Description: |
---|
168 | // Set the X display id for this RenderWindow to use to a pre-existing |
---|
169 | // X display id. |
---|
170 | void SetDisplayId(Display *); |
---|
171 | void SetDisplayId(void *); |
---|
172 | |
---|
173 | // Description: |
---|
174 | // Get this RenderWindow's parent X window id. |
---|
175 | Window GetParentId(); |
---|
176 | |
---|
177 | // Description: |
---|
178 | // Sets the parent of the window that WILL BE created. |
---|
179 | void SetParentId(Window); |
---|
180 | void SetParentId(void *); |
---|
181 | |
---|
182 | // Description: |
---|
183 | // Get this RenderWindow's X window id. |
---|
184 | Window GetWindowId(); |
---|
185 | |
---|
186 | // Description: |
---|
187 | // Set this RenderWindow's X window id to a pre-existing window. |
---|
188 | void SetWindowId(Window); |
---|
189 | void SetWindowId(void *); |
---|
190 | |
---|
191 | // Description: |
---|
192 | // Specify the X window id to use if a WindowRemap is done. |
---|
193 | void SetNextWindowId(Window); |
---|
194 | |
---|
195 | // Description: |
---|
196 | // Set the window id of the new window once a WindowRemap is done. |
---|
197 | // This is the generic prototype as required by the vtkRenderWindow |
---|
198 | // parent. |
---|
199 | void SetNextWindowId(void *); |
---|
200 | |
---|
201 | void SetWindowName(const char *); |
---|
202 | |
---|
203 | // Description: |
---|
204 | // Hide or Show the mouse cursor, it is nice to be able to hide the |
---|
205 | // default cursor if you want VTK to display a 3D cursor instead. |
---|
206 | void HideCursor(); |
---|
207 | void ShowCursor(); |
---|
208 | |
---|
209 | // Description: |
---|
210 | // Change the shape of the cursor |
---|
211 | virtual void SetCurrentCursor(int); |
---|
212 | |
---|
213 | // Description: |
---|
214 | // Check to see if a mouse button has been pressed. |
---|
215 | // All other events are ignored by this method. |
---|
216 | // This is a useful check to abort a long render. |
---|
217 | virtual int GetEventPending(); |
---|
218 | |
---|
219 | // Description: |
---|
220 | // Set this RenderWindow's X window id to a pre-existing window. |
---|
221 | void SetWindowInfo(char *info); |
---|
222 | |
---|
223 | // Description: |
---|
224 | // Set the window info that will be used after WindowRemap() |
---|
225 | void SetNextWindowInfo(char *info); |
---|
226 | |
---|
227 | // Description: |
---|
228 | // Sets the X window id of the window that WILL BE created. |
---|
229 | void SetParentInfo(char *info); |
---|
230 | |
---|
231 | // Description: |
---|
232 | // This computes the size of the render window |
---|
233 | // before calling the supper classes render |
---|
234 | void Render(); |
---|
235 | |
---|
236 | protected: |
---|
237 | vtkXOpenGLOffScreenRenderWindow(); |
---|
238 | ~vtkXOpenGLOffScreenRenderWindow(); |
---|
239 | |
---|
240 | vtkXOpenGLOffScreenRenderWindowInternal *Internal; |
---|
241 | |
---|
242 | Window ParentId; |
---|
243 | Window WindowId; |
---|
244 | Window NextWindowId; |
---|
245 | Display *DisplayId; |
---|
246 | Colormap ColorMap; |
---|
247 | int OwnWindow; |
---|
248 | int OwnDisplay; |
---|
249 | int ScreenSize[2]; |
---|
250 | int CursorHidden; |
---|
251 | int ForceMakeCurrent; |
---|
252 | int UsingHardware; |
---|
253 | char *Capabilities; |
---|
254 | |
---|
255 | // we must keep track of the cursors we are using |
---|
256 | Cursor XCArrow; |
---|
257 | Cursor XCSizeAll; |
---|
258 | Cursor XCSizeNS; |
---|
259 | Cursor XCSizeWE; |
---|
260 | Cursor XCSizeNE; |
---|
261 | Cursor XCSizeNW; |
---|
262 | Cursor XCSizeSE; |
---|
263 | Cursor XCSizeSW; |
---|
264 | |
---|
265 | private: |
---|
266 | vtkXOpenGLOffScreenRenderWindow(const vtkXOpenGLOffScreenRenderWindow&); // Not implemented. |
---|
267 | void operator=(const vtkXOpenGLOffScreenRenderWindow&); // Not implemented. |
---|
268 | }; |
---|
269 | |
---|
270 | |
---|
271 | |
---|
272 | #endif |
---|