/**
 * glfractal.h
 *
 * Brief Definition of GLFractal
 *
 * This is a simple QGLWidget displaying an openGL Sierpinski Gasket
 */

#ifndef GLFRACTAL_H
#define GLFRACTAL_H

#include <qgl.h>

struct Point {
	float x;
	float y;
}; // end Point

/**
 * GLFractal inherits from QGLWidget (http://doc.trolltech.com/2.3/qglwidget.html) <BR>
 * QGLWidget basically allows you to control OpenGL through method calls
 */
class GLFractal : public QGLWidget
{
  Q_OBJECT
public:
  GLFractal( QWidget* parent, const char* name );
  ~GLFractal();

 public slots:
    void setXRotation(int degrees);
    void setYRotation(int degrees);
    void setZRotation(int degrees);
    // void setScale(int newscale);

protected:
    void initializeGL();
    void paintGL();
    void resizeGL( int w, int h );
    virtual GLuint makeObject();
    void drawTriangle(Point a, Point b, Point c);
    void drawSierpinski(Point a, Point b, Point c, int level);

private:
    GLuint object;
    GLfloat xRot, yRot, zRot, scale;
};

#endif // GLFRACTAL_H

