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 =========================================================================*/ 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 vtkTypeRevisionMacro(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 00106 void SetForceMakeCurrent(); 00107 00109 const char *ReportCapabilities(); 00110 00112 int SupportsOpenGL(); 00113 00115 int IsDirect(); 00116 00118 00119 virtual void *GetGenericDisplayId() 00120 { 00121 return this->GetDisplayId(); 00122 } 00124 00125 virtual void *GetGenericWindowId(); 00126 virtual void *GetGenericParentId() 00127 { 00128 return reinterpret_cast<void *>(this->ParentId); 00129 } 00130 00131 virtual void *GetGenericContext(); 00132 virtual void *GetGenericDrawable() 00133 { 00134 return reinterpret_cast<void *>(this->WindowId); 00135 } 00136 00138 virtual int *GetScreenSize(); 00139 00141 virtual int *GetPosition(); 00142 00144 Display *GetDisplayId(); 00145 00147 00149 void SetDisplayId(Display *); 00150 void SetDisplayId(void *); 00152 00154 Window GetParentId(); 00155 00157 00158 void SetParentId(Window); 00159 void SetParentId(void *); 00161 00163 Window GetWindowId(); 00164 00166 00167 void SetWindowId(Window); 00168 void SetWindowId(void *); 00170 00172 void SetNextWindowId(Window); 00173 00176 void SetNextWindowId(void *); 00177 00178 void SetWindowName(const char *); 00179 00181 00182 void SetPosition(int,int); 00183 void SetPosition(int a[2]) {this->SetPosition(a[0], a[1]);}; 00185 00187 00189 void HideCursor(); 00190 void ShowCursor(); 00192 00194 virtual void SetCurrentCursor(int); 00195 00199 virtual int GetEventPending(); 00200 00202 void SetWindowInfo(char *info); 00203 00205 void SetNextWindowInfo(char *info); 00206 00208 void SetParentInfo(char *info); 00209 00212 void Render(); 00213 00215 void SetOffScreenRendering(int i); 00216 00217 protected: 00218 vtkXOpenGLRenderWindow(); 00219 ~vtkXOpenGLRenderWindow(); 00220 00221 vtkXOpenGLRenderWindowInternal *Internal; 00222 00223 Window ParentId; 00224 Window WindowId; 00225 Window NextWindowId; 00226 Display *DisplayId; 00227 Colormap ColorMap; 00228 int OwnWindow; 00229 int OwnDisplay; 00230 int ScreenSize[2]; 00231 int CursorHidden; 00232 int ForceMakeCurrent; 00233 int UsingHardware; 00234 char *Capabilities; 00235 00236 // we must keep track of the cursors we are using 00237 Cursor XCArrow; 00238 Cursor XCSizeAll; 00239 Cursor XCSizeNS; 00240 Cursor XCSizeWE; 00241 Cursor XCSizeNE; 00242 Cursor XCSizeNW; 00243 Cursor XCSizeSE; 00244 Cursor XCSizeSW; 00245 Cursor XCHand; 00246 00247 00248 void CreateAWindow(); 00249 void DestroyWindow(); 00250 void CreateOffScreenWindow(int width, int height); 00251 void DestroyOffScreenWindow(); 00252 void ResizeOffScreenWindow(int width, int height); 00253 00254 00255 private: 00256 vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&); // Not implemented. 00257 void operator=(const vtkXOpenGLRenderWindow&); // Not implemented. 00258 }; 00259 00260 00261 00262 #endif