#ifndef VIGLAREA_H
#define VIGLAREA_H

//#include <QtGui/QWidget>
#include "ui_viglarea.h"

#include <QGLWidget>
#include <g12buffer.h>
#include <qevent.h>
#include "projective.h"
#include <disparity.h>


class ViGLArea : public QGLWidget
{
    Q_OBJECT

public:
    ViGLArea(QWidget *parent = 0);
    ~ViGLArea();

public slots:
	void leftRotate (void);
	void rightRotate (void);
	void upRotate (void);
	void downRotate (void);

	void setFocal (double focal);
	void setDisplacement (double disp);
	void setGridOnOff(int val);


	void setBuffersSlot(G12Buffer *image, DisparityBuffer *disparity, double focal);

private:
    Ui::ViGLAreaClass ui;

    virtual QSize minimumSizeHint() const;
    virtual QSize sizeHint() const;

    virtual void initializeGL();
    virtual void resizeGL(int width, int height);
    virtual void paintGL();

    virtual void mouseMoveEvent(QMouseEvent * event);
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);

    double xRot;
	double yRot;
	double zRot;

	G12Buffer *image;
	DisparityBuffer *disparity;
	double focal;
	double disp;

	GLuint grid;
	int gridOn;

	int isTracking;
	QPoint track;

	vector3Dd positon;
	vector3Dd view;
	vector3Dd left;
	vector3Dd top;

	affineTransform3D camera;

};

#endif // VIGLAREA_H
