00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkXOpenGLRenderWindow.h,v $ 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 =========================================================================*/ 00030 #ifndef __vtkXOpenGLRenderWindow_h 00031 #define __vtkXOpenGLRenderWindow_h 00032 00033 #include "vtkOpenGLRenderWindow.h" 00034 #include <X11/Xlib.h> // Needed for X types used in the public interface 00035 #include <X11/Xutil.h> // Needed for X types used in the public interface 00036 00037 class vtkIdList; 00038 class vtkXOpenGLRenderWindowInternal; 00039 00040 class VTK_RENDERING_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow 00041 { 00042 public: 00043 static vtkXOpenGLRenderWindow *New(); 00044 vtkTypeRevisionMacro(vtkXOpenGLRenderWindow,vtkOpenGLRenderWindow); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00046 00048 virtual void Start(void); 00049 00051 virtual void Frame(void); 00052 00054 virtual void WindowInitialize(void); 00055 00060 virtual void Initialize(void); 00061 00066 virtual void Finalize(void); 00067 00069 virtual void SetFullScreen(int); 00070 00072 virtual void WindowRemap(void); 00073 00075 virtual void PrefFullScreen(void); 00076 00078 00079 virtual void SetSize(int,int); 00080 virtual void SetSize(int a[2]) {this->SetSize(a[0], a[1]);}; 00082 00084 00085 virtual Colormap GetDesiredColormap(); 00086 virtual Visual *GetDesiredVisual(); 00087 virtual XVisualInfo *GetDesiredVisualInfo(); 00088 virtual int GetDesiredDepth(); 00090 00095 virtual void SetStereoCapableWindow(int capable); 00096 00098 void MakeCurrent(); 00099 00102 virtual bool IsCurrent(); 00103 00107 void SetForceMakeCurrent(); 00108 00110 const char *ReportCapabilities(); 00111 00113 int SupportsOpenGL(); 00114 00116 int IsDirect(); 00117 00119 00120 virtual void *GetGenericDisplayId() 00121 { 00122 return this->GetDisplayId(); 00123 } 00125 00126 virtual void *GetGenericWindowId(); 00127 virtual void *GetGenericParentId() 00128 { 00129 return reinterpret_cast<void *>(this->ParentId); 00130 } 00131 00132 virtual void *GetGenericContext(); 00133 virtual void *GetGenericDrawable() 00134 { 00135 return reinterpret_cast<void *>(this->WindowId); 00136 } 00137 00139 virtual int *GetScreenSize(); 00140 00142 virtual int *GetPosition(); 00143 00145 Display *GetDisplayId(); 00146 00148 00150 void SetDisplayId(Display *); 00151 void SetDisplayId(void *); 00153 00155 Window GetParentId(); 00156 00158 00159 void SetParentId(Window); 00160 void SetParentId(void *); 00162 00164 Window GetWindowId(); 00165 00167 00168 void SetWindowId(Window); 00169 void SetWindowId(void *); 00171 00173 void SetNextWindowId(Window); 00174 00177 void SetNextWindowId(void *); 00178 00179 void SetWindowName(const char *); 00180 00182 00183 void SetPosition(int,int); 00184 void SetPosition(int a[2]) {this->SetPosition(a[0], a[1]);}; 00186 00188 00190 void HideCursor(); 00191 void ShowCursor(); 00193 00195 virtual void SetCurrentCursor(int); 00196 00200 virtual int GetEventPending(); 00201 00203 void SetWindowInfo(char *info); 00204 00206 void SetNextWindowInfo(char *info); 00207 00209 void SetParentInfo(char *info); 00210 00213 void Render(); 00214 00216 void SetOffScreenRendering(int i); 00217 00218 protected: 00219 vtkXOpenGLRenderWindow(); 00220 ~vtkXOpenGLRenderWindow(); 00221 00222 vtkXOpenGLRenderWindowInternal *Internal; 00223 00224 Window ParentId; 00225 Window WindowId; 00226 Window NextWindowId; 00227 Display *DisplayId; 00228 Colormap ColorMap; 00229 int OwnWindow; 00230 int OwnDisplay; 00231 int ScreenSize[2]; 00232 int CursorHidden; 00233 int ForceMakeCurrent; 00234 int UsingHardware; 00235 char *Capabilities; 00236 00237 // we must keep track of the cursors we are using 00238 Cursor XCArrow; 00239 Cursor XCSizeAll; 00240 Cursor XCSizeNS; 00241 Cursor XCSizeWE; 00242 Cursor XCSizeNE; 00243 Cursor XCSizeNW; 00244 Cursor XCSizeSE; 00245 Cursor XCSizeSW; 00246 Cursor XCHand; 00247 00248 00249 void CreateAWindow(); 00250 void DestroyWindow(); 00251 void CreateOffScreenWindow(int width, int height); 00252 void DestroyOffScreenWindow(); 00253 void ResizeOffScreenWindow(int width, int height); 00254 00255 00256 private: 00257 vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&); // Not implemented. 00258 void operator=(const vtkXOpenGLRenderWindow&); // Not implemented. 00259 }; 00260 00261 00262 00263 #endif