00001 ////////////////////////////////////////////////////////////////////// 00002 // Copyright (c) 2001-2002 David Pritchard <drpritch@alumni.uwaterloo.ca> 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either 00007 // version 2 of the License, or (at your option) any later 00008 // version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 #ifndef freecloth_gfx_gfxGLWindow_h 00020 #define freecloth_gfx_gfxGLWindow_h 00021 00022 #ifndef freecloth_gfx_package_h 00023 #include <freecloth/gfx/package.h> 00024 #endif 00025 00026 #ifndef freecloth_gfx_gfxWindow_h 00027 #include <freecloth/gfx/gfxWindow.h> 00028 #endif 00029 00030 //////////////////////////////////////////////////////////////////////////////// 00031 // FORWARD DECLARATIONS 00032 00033 class GfxConfig; 00034 00035 FREECLOTH_NAMESPACE_START 00036 template <class T> class RCShdPtr; 00037 FREECLOTH_NAMESPACE_END 00038 00039 //////////////////////////////////////////////////////////////////////////////// 00040 /*! 00041 * \class GfxGLWindow freecloth/gfx/gfxGLWindow.h 00042 * \brief Window for OpenGL operations. 00043 * 00044 * This abstract base class defines an interface for implementation of an 00045 * OpenGL window. It is assumed that all operations will take place within a 00046 * single thread. 00047 */ 00048 class GfxGLWindow : public GfxWindow 00049 { 00050 public: 00051 00052 //----- static member functions ----- 00053 00054 static RCShdPtr<GfxGLWindow> create( 00055 const GfxConfig&, 00056 const String& title 00057 ); 00058 00059 //----- member functions ----- 00060 00061 virtual ~GfxGLWindow(); 00062 00063 // FIXME: need a more robust way of handling events. 00064 // Must achieve: 00065 // 1) portable 00066 // 2) works with plugin-type setups (xmms, winamp) where glutMainLoop() 00067 // type calls may not be feasible 00068 // 3) avoid "handleEvents()" type approaches, which are error-prone... 00069 virtual void handleEvents() = 0; 00070 virtual void swapBuffers() = 0; 00071 virtual void eventLoop() = 0; 00072 00073 protected: 00074 00075 //----- member functions ----- 00076 00077 GfxGLWindow(); 00078 00079 private: 00080 00081 }; 00082 #endif