text: /*=========================================================================
  
    Program:   OpenCVDisparityTuner
  
    Copyright (c) Julien Jomier
    All rights reserved.
  
       This software is distributed WITHOUT ANY WARRANTY; without even
       the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.  See the above copyright notice for more information.
  
  =========================================================================*/
  #ifndef CQTOPENCVVIEWERGL_H
  #define CQTOPENCVVIEWERGL_H
  
  #include <QOpenGLWidget>
  #include <opencv2/core/core.hpp>
  
  class CQtOpenCVViewerGl : public QOpenGLWidget
  {
  
  Q_OBJECT
  public:
    explicit CQtOpenCVViewerGl(QWidget *parent = 0);
  
  signals:
    void imageSizeChanged( int outW, int outH ); /// Used to resize the image outside the widget
  
  public slots:
    bool showImage(cv::Mat image); /// Used to set the image to be viewed
  
  protected:
    void 	initializeGL(); /// OpenGL initialization
    void 	paintGL(); /// OpenGL Rendering
    void 	resizeGL(int width, int height);        /// Widget Resize Event
  
    void  updateScene();
    void  renderImage();
  
  private:
    bool  mSceneChanged;          /// Indicates when OpenGL view is to be redrawn
  
    QImage   mRenderQtImg;           /// Qt image to be rendered
    cv::Mat  mOrigImage;             /// original OpenCV image to be shown
  
    QColor   mBgColor;		/// Background color
  
    int     mOutH;                  /// Resized Image height
    int     mOutW;                  /// Resized Image width
    float   mImgRatio;             /// height/width ratio
    int     mPosX;                  /// Top left X position to render image in the center of widget
    int     mPosY;                  /// Top left Y position to render image in the center of widget
  
  };
  
  #endif // CQTOPENCVVIEWERGL_H
  