1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkRenderWindow.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 // .NAME vtkGenericOpenGLRenderWindow - platform independent render window 16 17 // .SECTION Description 18 // vtkGenericOpenGLRenderWindow provides a skeleton for implementing a render window 19 // using one's own OpenGL context and drawable. 20 // To be effective, one must register an observer for WindowMakeCurrentEvent, 21 // WindowIsCurrentEvent and WindowFrameEvent. When this class sends a WindowIsCurrentEvent, 22 // the call data is an bool* which one can use to return whether the context is current. 23 24 #ifndef vtkGenericOpenGLRenderWindow_hpp 25 #define vtkGenericOpenGLRenderWindow_hpp 26 27 #include "vtkRenderingOpenGLModule.h" // For export macro 28 #include "vtkOpenGLRenderWindow.h" 29 30 class VTKRENDERINGOPENGL_EXPORT vtkGenericOpenGLRenderWindow : public vtkOpenGLRenderWindow 31 { 32 public: 33 static vtkGenericOpenGLRenderWindow* New(); 34 vtkTypeMacro(vtkGenericOpenGLRenderWindow, vtkOpenGLRenderWindow); 35 void PrintSelf(ostream& os, vtkIndent indent); 36 protected: 37 vtkGenericOpenGLRenderWindow(); 38 ~vtkGenericOpenGLRenderWindow(); 39 40 public: 41 42 //! Cleans up graphics resources allocated in the context for this VTK scene. 43 void Finalize(); 44 45 //! flush the pending drawing operations 46 //! Class user may to watch for WindowFrameEvent and act on it 47 void Frame(); 48 49 //! Makes the context current. It is the class user's 50 //! responsibility to watch for WindowMakeCurrentEvent and set it current. 51 void MakeCurrent(); 52 53 //! Returns if the context is current. It is the class user's 54 //! responsibility to watch for WindowIsCurrentEvent and set the bool* flag 55 //! passed through the call data parameter. 56 bool IsCurrent(); 57 58 //! Returns if OpenGL is supported. It is the class user's 59 //! responsibility to watch for WindowSupportsOpenGLEvent and set the int* flag 60 //! passed through the call data parameter. 61 int SupportsOpenGL(); 62 63 //! Returns if the context is direct. It is the class user's 64 //! responsibility to watch for WindowIsDirectEvent and set the int* flag 65 //! passed through the call data parameter. 66 int IsDirect(); 67 68 // {@ 69 //! set the drawing buffers to use 70 void SetFrontBuffer(unsigned int); 71 void SetFrontLeftBuffer(unsigned int); 72 void SetFrontRightBuffer(unsigned int); 73 void SetBackBuffer(unsigned int); 74 void SetBackLeftBuffer(unsigned int); 75 void SetBackRightBuffer(unsigned int); 76 // }@ 77 78 //! convenience function to push the state and push/init the transform matrices 79 void PushState(); 80 //! convenience function to pop the state and pop the transform matrices 81 void PopState(); 82 83 // {@ 84 //! does nothing 85 void SetWindowId(void*); 86 void* GetGenericWindowId(); 87 void SetDisplayId(void*); 88 void SetParentId(void*); 89 void* GetGenericDisplayId(); 90 void* GetGenericParentId(); 91 void* GetGenericContext(); 92 void* GetGenericDrawable(); 93 void SetWindowInfo(char*); 94 void SetParentInfo(char*); 95 int* GetScreenSize(); 96 void Start(); 97 void HideCursor(); 98 void ShowCursor(); 99 void SetFullScreen(int); 100 void WindowRemap(); 101 int GetEventPending(); 102 void SetNextWindowId(void*); 103 void SetNextWindowInfo(char*); 104 void CreateAWindow(); 105 void DestroyWindow(); 106 // }@ 107 108 // Description: 109 // Allow to update state within observer callback without changing 110 // data argument and MTime. 111 void SetIsDirect(int newValue); 112 void SetSupportsOpenGL(int newValue); 113 void SetIsCurrent(bool newValue); 114 115 protected: 116 int DirectStatus; 117 int SupportsOpenGLStatus; 118 bool CurrentStatus; 119 120 private: 121 vtkGenericOpenGLRenderWindow(const vtkGenericOpenGLRenderWindow&); // Not implemented. 122 void operator=(const vtkGenericOpenGLRenderWindow&); // Not implemented. 123 }; 124 125 #endif 126