#ifndef CGLPREVIEW_H
#define CGLPREVIEW_H

#include <qgl.h>

class CRenderObj;
class GLUquadric;
typedef GLUquadric GLUquadricObj;

class CGLPreview : public QGLWidget
{
  Q_OBJECT

 public:
  CGLPreview ( QWidget *parent = NULL,
               const char *name = NULL );
  ~CGLPreview();

  void setObj( CRenderObj *surfaceobj )
    { m_pSurfaceObj = surfaceobj; }

 protected:
  virtual void initializeGL();
  virtual void resizeGL(int w, int h);
  virtual void paintGL();

  virtual void mousePressEvent( QMouseEvent * e );
  virtual void mouseMoveEvent( QMouseEvent * e );

 private:
  CRenderObj    *m_pSurfaceObj;
  GLUquadricObj *m_pSphere;

  int            m_CursorPosX;
  int            m_CursorPosY;


  void setProjectionMatrix() const;
  void setModelviewMatrix() const;
  void drawPlanes() const;
  void drawSphere() const;

 signals:
  void UpdatedVectorBase(void);
};

#endif  // CGLPREVIEW_H
