SimpleNGL 1.0
include/GLWindow.h
Go to the documentation of this file.
00001 #ifndef __GL_WINDOW_H__
00002 #define __GL_WINDOW_H__
00003 
00004 #include "ngl/Camera.h"
00005 #include "ngl/TransformStack.h"
00006 #include "ngl/Obj.h"
00007 #include "Cloth.h"
00008 
00009 // must be included after our stuff becuase GLEW needs to be first
00010 #include <QtOpenGL>
00011 
00018 class GLWindow : public QGLWidget
00019 {
00020 Q_OBJECT
00021 public :
00022 
00025   GLWindow(
00026            QWidget *_parent
00027           );
00028 
00031 void processKeyPress(QKeyEvent *_event);
00032 
00033 public slots:
00034 
00037   inline void toggleWireframe(bool _mode)
00038   {
00039       m_wireframe = _mode;
00040       updateGL();
00041   }
00042 
00043   inline void setTimeStep(double _value)
00044   {
00045       m_timeStep = (float)_value;
00046       updateGL();
00047   }
00048 
00049   void setBendStiffness(double _value);
00050   void setBendDamping(double _value);
00051 
00052   void setShearStiffness(double _value);
00053   void setShearDamping(double _value);
00054 
00055   void setStructStiffness(double _value);
00056   void setStructDamping(double _value);
00057 
00058   void reset();
00059 
00060   void setWindX(double _value);
00061   void setWindY(double _value);
00062   void setWindZ(double _value);
00063 
00064   void setGrav(double _value);
00065 
00066 protected:
00067 
00073   void genShader(const std::string &_name, const std::string &_VSname, const std::string &_FSname, const std::vector<std::string> &_attributes);
00074 
00076   void initializeGL();
00077 
00079   void resizeGL(const int _w,const int _h);
00080 
00082   void paintGL();
00083 
00086   void timerEvent(QTimerEvent *_event);
00087 
00089   ngl::TransformStack m_transformStack;
00090 
00091 private:
00092 
00093   void doWind(Cloth &_cloth);
00094 
00095   void loadTexture(const char* _texName, GLuint &_texID);
00096 
00097   int m_width,m_height;
00098 
00099   Cloth m_cloth;
00100   //Cloth m_cloth2;
00101   //Cloth m_cloth3;
00102 
00104   void setupShaders();
00105 
00106   GLuint m_texture;
00107   GLuint m_texture2;
00108   GLuint m_texture3;
00109 
00111   int m_updatetimer;
00112   int m_updatetimer2;
00113   int m_updatetimer3;
00114 
00116   float m_time;
00117 
00119   float m_timeStep;
00120 
00122   bool m_wireframe;
00123 
00125   ngl::Camera m_cam;
00126 };
00127 
00128 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator