00001 /*===========================================================================*\ 00002 * * 00003 * OpenFlipper * 00004 * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * 00005 * www.openflipper.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenFlipper. * 00009 * * 00010 * OpenFlipper is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenFlipper is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenFlipper. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 8521 $ * 00038 * $Author: moebius $ * 00039 * $Date: 2010-02-10 15:57:35 +0100 (Mi, 10. Feb 2010) $ * 00040 * * 00041 \*===========================================================================*/ 00042 00043 00044 //============================================================================= 00045 // 00046 // CLASS GlutViewer 00047 // 00048 //============================================================================= 00049 00050 00051 #ifndef ACG_GLUTVIEWER_HH 00052 #define ACG_GLUTVIEWER_HH 00053 00054 00055 //== INCLUDES ================================================================= 00056 00057 00058 #include "../GL/gl.hh" 00059 #include "../GL/GLState.hh" 00060 #include <map> 00061 #include "../Config/ACGDefines.hh" 00062 00063 00064 //== NAMESPACES =============================================================== 00065 00066 00067 namespace ACG { 00068 00069 00070 //== CLASS DEFINITION ========================================================= 00071 00072 00073 00079 class ACGDLLEXPORT GlutViewer 00080 { 00081 public: 00082 00083 GlutViewer(const char* _title, int _width, int _height); 00084 virtual ~GlutViewer(); 00085 00086 00087 protected: 00088 00089 virtual void draw() = 0; 00090 virtual void display(void); 00091 virtual void idle(void); 00092 virtual void keyboard(int key, int x, int y); 00093 virtual void motion(int x, int y); 00094 virtual void mouse(int button, int state, int x, int y); 00095 virtual void passivemotion(int x, int y); 00096 virtual void reshape(int w, int h); 00097 virtual void visibility(int visible); 00098 00099 void update_projection(); 00100 00101 GLState glstate_; 00102 int width_, height_; 00103 GLfloat near_, far_, fovy_; 00104 00105 00106 private: 00107 00108 void init(); 00109 00110 static void display__(void); 00111 static void idle__(void); 00112 static void keyboard__(unsigned char key, int x, int y); 00113 static void motion__(int x, int y); 00114 static void mouse__(int button, int state, int x, int y); 00115 static void passivemotion__(int x, int y); 00116 static void reshape__(int w, int h); 00117 static void special__(int key, int x, int y); 00118 static void visibility__(int visible); 00119 00120 static std::map<int, GlutViewer*> windows__; 00121 static GlutViewer* current_window(); 00122 00123 00124 int windowID_; 00125 bool fullscreen_; 00126 int bak_left_, bak_top_, bak_width_, bak_height_; 00127 }; 00128 00129 00130 //============================================================================= 00131 } // namespace ACG 00132 //============================================================================= 00133 #endif // ACG_GLUTVIEWER_HH defined 00134 //============================================================================= 00135