1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkXOpenGLRenderWindow.h,v $
6 Date: $Date: 2003/01/24 16:24:02 $
7 Version: $Revision: 1.21 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
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.
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.
25 #ifndef __vtkXOpenGLRenderWindow_h
26 #define __vtkXOpenGLRenderWindow_h
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
33 class vtkXOpenGLRenderWindowInternal;
35 class VTK_RENDERING_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
38 static vtkXOpenGLRenderWindow *New();
39 vtkTypeRevisionMacro(vtkXOpenGLRenderWindow,vtkOpenGLRenderWindow);
40 void PrintSelf(ostream& os, vtkIndent indent);
43 // Begin the rendering process.
44 virtual void Start(void);
47 // End the rendering process and display the image.
48 virtual void Frame(void);
51 // Initialize the window for rendering.
52 virtual void WindowInitialize(void);
55 // Initialize the rendering window.
56 virtual void Initialize(void);
59 // Change the window to fill the entire screen.
60 virtual void SetFullScreen(int);
64 virtual void WindowRemap(void);
67 // Set the preferred window size to full screen.
68 virtual void PrefFullScreen(void);
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]);};
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();
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);
90 // Make this window the current OpenGL context.
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();
100 // Get report of capabilities for the render window
101 const char *ReportCapabilities();
104 // Does this render window support OpenGL? 0-false, 1-true
105 int SupportsOpenGL();
108 // Is this render window using hardware acceleration? 0-false, 1-true
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;};
120 // Get the size of the screen in pixels
121 virtual int *GetScreenSize();
124 // Get the position in screen coordinates (pixels) of the window.
125 virtual int *GetPosition();
128 // Get this RenderWindow's X display id.
129 Display *GetDisplayId();
132 // Set the X display id for this RenderWindow to use to a pre-existing
134 void SetDisplayId(Display *);
135 void SetDisplayId(void *);
138 // Get this RenderWindow's parent X window id.
139 Window GetParentId();
142 // Sets the parent of the window that WILL BE created.
143 void SetParentId(Window);
144 void SetParentId(void *);
147 // Get this RenderWindow's X window id.
148 Window GetWindowId();
151 // Set this RenderWindow's X window id to a pre-existing window.
152 void SetWindowId(Window);
153 void SetWindowId(void *);
156 // Specify the X window id to use if a WindowRemap is done.
157 void SetNextWindowId(Window);
158 void SetWindowName(const char *);
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]);};
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.
172 // Change the shape of the cursor
173 virtual void SetCurrentCursor(int);
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();
182 // Set this RenderWindow's X window id to a pre-existing window.
183 void SetWindowInfo(char *info);
186 // Sets the X window id of the window that WILL BE created.
187 void SetParentInfo(char *info);
190 // This computes the size of the render window
191 // before calling the supper classes render
195 // Render without displaying the window.
196 void SetOffScreenRendering(int i);
199 vtkXOpenGLRenderWindow();
200 ~vtkXOpenGLRenderWindow();
202 vtkXOpenGLRenderWindowInternal *Internal;
213 int ForceMakeCurrent;
217 // we must keep track of the cursors we are using
228 vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&); // Not implemented.
229 void operator=(const vtkXOpenGLRenderWindow&); // Not implemented.