src/qvgui/qvglcanvas.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #ifndef QVGLCANVAS_H
00026 #define QVGLCANVAS_H
00027 
00028 #include <qvcore/qvworker.h>
00029 #include <qvmath/qvmatrix.h>
00030 #include <qvgui/qv3dmodel.h>
00031 #include <qvmath/qvquaternion.h>
00032 
00033 #ifndef DOXYGEN_IGNORE_THIS
00034 
00063 class QVGLCanvas : public QGLWidget, public QVPropertyContainer
00064 {
00065 Q_OBJECT
00066 
00067 public:
00068         QVGLCanvas(const QString &title, QWidget* parent = 0);
00069         ~QVGLCanvas ();
00070 
00071         virtual void init() {};
00072         virtual void display() {};
00073         virtual void reshape(int w, int h) {};
00074 
00075         void linkModelMatrix(QVWorker &worker, const QString &matrixPropertyName, const QString &objectName);
00076         void add(const QV3DModel &model, const QString &name);
00077         GLuint bindTexture(const QVImage<uChar,3> &image, GLenum target = GL_TEXTURE_2D);
00078         //GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
00079         //GLuint bindTexture(const QVImage<uChar>);
00080 
00081 signals:
00082         void closed();
00083 
00084 protected:
00085 
00086         void initializeGL();
00087         void paintGL();
00088         void resizeGL(int w, int h );
00089 
00090         void drawModels();
00091 
00092         void mousePressEvent(QMouseEvent * event);
00093         void mouseReleaseEvent(QMouseEvent *event);
00094         void mouseMoveEvent(QMouseEvent *event);
00095         void wheelEvent(QWheelEvent *event);
00096         void keyPressEvent(QKeyEvent *event);
00097         
00098         void closeEvent(QCloseEvent * event);
00099 
00100         int beginx, beginy;
00101         QVQuaternion trackballQuat;
00102         double zoom;
00103         bool pressedleft,pressedright;
00104         double maxwide;
00105         double cx,cy,cz;
00106 };
00107 
00108 #endif
00109 #endif

Generated on Thu Jul 17 17:23:28 2008 for QVision by  doxygen 1.5.3