Go to the documentation of this file.00001 #ifndef OPENTISSUE_UTILITY_GLUT_GLUT_APPLICATION_H
00002 #define OPENTISSUE_UTILITY_GLUT_GLUT_APPLICATION_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/utility/gl/gl_util.h>
00013
00014 #include<boost/shared_ptr.hpp>
00015
00016 namespace OpenTissue
00017 {
00018 namespace glut
00019 {
00020
00033 class Application
00034 {
00035 protected:
00036
00037 double m_fovy;
00038 double m_aspect;
00039 double m_z_near;
00040 double m_z_far;
00041 int m_width;
00042 int m_height;
00043 int m_main_window;
00044 bool m_idle_on;
00045
00046 public:
00047
00048 int const & main_window() const { return m_main_window; }
00049 int & main_window() { return m_main_window; }
00050 int const & width() const { return m_width; }
00051 int & width() { return m_width; }
00052 int const & height() const { return m_height; }
00053 int & height() { return m_height; }
00054 double const & aspect() const { return m_aspect; }
00055 double & aspect() { return m_aspect; }
00056 double const & fovy() const { return m_fovy; }
00057 double & fovy() { return m_fovy; }
00058 double const & z_near() const { return m_z_near; }
00059 double & z_near() { return m_z_near; }
00060 double const & z_far() const { return m_z_far; }
00061 double & z_far() { return m_z_far; }
00062 bool const & idle() const { return m_idle_on; }
00063 bool & idle() { return m_idle_on; }
00064
00065 public:
00066
00067 Application()
00068 : m_fovy(30.0)
00069 , m_aspect(1.0)
00070 , m_z_near(0.1)
00071 , m_z_far(700.0)
00072 , m_width(1024)
00073 , m_height(768)
00074 , m_main_window()
00075 , m_idle_on(false)
00076 {}
00077
00078 virtual ~Application(){}
00079
00080 public:
00081
00082 virtual char const * get_title() const=0;
00083
00084 virtual void action(unsigned char choice)=0;
00085
00086 virtual void special_action(int choice)=0;
00087
00088 virtual void reshape(){};
00089
00090 virtual void init_right_click_menu(int main_menu, void menu(int entry))=0;
00091
00092 virtual void init()=0;
00093
00094 virtual void run()=0;
00095
00096 virtual void shutdown()=0;
00097
00098 virtual void mouse_down(double cur_x,double cur_y,bool shift,bool ctrl,bool alt,bool left,bool middle,bool right)=0;
00099
00100 virtual void mouse_up(double cur_x,double cur_y,bool shift,bool ctrl,bool alt,bool left,bool middle,bool right)=0;
00101
00102 virtual void mouse_move(double cur_x,double cur_y)=0;
00103
00111 virtual void display()=0;
00112
00116 virtual void init_gl_state()=0;
00117
00124 virtual void setup_lights()=0;
00125
00131 virtual void setup_model_view_projection( )=0;
00132 };
00133
00143 typedef boost::shared_ptr<Application> instance_pointer;
00144
00145 }
00146 }
00147
00148
00157 OpenTissue::glut::instance_pointer init_glut_application(int argc, char **argv);
00158
00176 #include <OpenTissue/utility/glut/glut_main.ipp>
00177
00178
00179 #endif