00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXOpenGLRenderWindow.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00033 #ifndef __vtkXOpenGLRenderWindow_h 00034 #define __vtkXOpenGLRenderWindow_h 00035 00036 #include "vtkOpenGLRenderWindow.h" 00037 #include <X11/Xlib.h> // Needed for X types used in the public interface 00038 #include <X11/Xutil.h> // Needed for X types used in the public interface 00039 00040 class vtkIdList; 00041 class vtkXOpenGLRenderWindowInternal; 00042 00043 class VTK_RENDERING_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow 00044 { 00045 public: 00046 static vtkXOpenGLRenderWindow *New(); 00047 vtkTypeMacro(vtkXOpenGLRenderWindow,vtkOpenGLRenderWindow); 00048 void PrintSelf(ostream& os, vtkIndent indent); 00049 00051 virtual void Start(void); 00052 00054 virtual void Frame(void); 00055 00057 virtual void WindowInitialize(void); 00058 00063 virtual void Initialize(void); 00064 00069 virtual void Finalize(void); 00070 00072 virtual void SetFullScreen(int); 00073 00075 virtual void WindowRemap(void); 00076 00078 virtual void PrefFullScreen(void); 00079 00081 00082 virtual void SetSize(int,int); 00083 virtual void SetSize(int a[2]) {this->SetSize(a[0], a[1]);}; 00085 00087 00088 virtual Colormap GetDesiredColormap(); 00089 virtual Visual *GetDesiredVisual(); 00090 virtual XVisualInfo *GetDesiredVisualInfo(); 00091 virtual int GetDesiredDepth(); 00093 00098 virtual void SetStereoCapableWindow(int capable); 00099 00101 void MakeCurrent(); 00102 00105 virtual bool IsCurrent(); 00106 00110 void SetForceMakeCurrent(); 00111 00113 const char *ReportCapabilities(); 00114 00116 int SupportsOpenGL(); 00117 00119 int IsDirect(); 00120 00122 00123 virtual void *GetGenericDisplayId() 00124 { 00125 return this->GetDisplayId(); 00126 } 00128 00129 virtual void *GetGenericWindowId(); 00130 virtual void *GetGenericParentId() 00131 { 00132 return reinterpret_cast<void *>(this->ParentId); 00133 } 00134 00135 virtual void *GetGenericContext(); 00136 virtual void *GetGenericDrawable() 00137 { 00138 return reinterpret_cast<void *>(this->WindowId); 00139 } 00140 00142 virtual int *GetScreenSize(); 00143 00145 virtual int *GetPosition(); 00146 00148 Display *GetDisplayId(); 00149 00151 00153 void SetDisplayId(Display *); 00154 void SetDisplayId(void *); 00156 00158 Window GetParentId(); 00159 00161 00162 void SetParentId(Window); 00163 void SetParentId(void *); 00165 00167 Window GetWindowId(); 00168 00170 00171 void SetWindowId(Window); 00172 void SetWindowId(void *); 00174 00176 void SetNextWindowId(Window); 00177 00180 void SetNextWindowId(void *); 00181 00182 void SetWindowName(const char *); 00183 00185 00186 void SetPosition(int,int); 00187 void SetPosition(int a[2]) {this->SetPosition(a[0], a[1]);}; 00189 00191 00193 void HideCursor(); 00194 void ShowCursor(); 00196 00198 virtual void SetCurrentCursor(int); 00199 00203 virtual int GetEventPending(); 00204 00206 void SetWindowInfo(char *info); 00207 00209 void SetNextWindowInfo(char *info); 00210 00212 void SetParentInfo(char *info); 00213 00216 void Render(); 00217 00219 void SetOffScreenRendering(int i); 00220 00221 protected: 00222 vtkXOpenGLRenderWindow(); 00223 ~vtkXOpenGLRenderWindow(); 00224 00225 vtkXOpenGLRenderWindowInternal *Internal; 00226 00227 Window ParentId; 00228 Window WindowId; 00229 Window NextWindowId; 00230 Display *DisplayId; 00231 Colormap ColorMap; 00232 int OwnWindow; 00233 int OwnDisplay; 00234 int ScreenSize[2]; 00235 int CursorHidden; 00236 int ForceMakeCurrent; 00237 int UsingHardware; 00238 char *Capabilities; 00239 00240 // we must keep track of the cursors we are using 00241 Cursor XCArrow; 00242 Cursor XCSizeAll; 00243 Cursor XCSizeNS; 00244 Cursor XCSizeWE; 00245 Cursor XCSizeNE; 00246 Cursor XCSizeNW; 00247 Cursor XCSizeSE; 00248 Cursor XCSizeSW; 00249 Cursor XCHand; 00250 00251 00252 void CreateAWindow(); 00253 void DestroyWindow(); 00254 void CreateOffScreenWindow(int width, int height); 00255 void DestroyOffScreenWindow(); 00256 void ResizeOffScreenWindow(int width, int height); 00257 00258 00259 private: 00260 vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&); // Not implemented. 00261 void operator=(const vtkXOpenGLRenderWindow&); // Not implemented. 00262 }; 00263 00264 00265 00266 #endif