Interactive Mandelbrot viewer with Qt and OpenGL.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
883 B

#pragma once
#include <QWidget>
3 years ago
#include <QOpenGLWidget>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
3 years ago
#include "Mandelbrot.h"
class OutputWidget : public QOpenGLWidget, protected QOpenGLExtraFunctions {
3 years ago
Q_OBJECT
3 years ago
public:
3 years ago
explicit OutputWidget(QWidget* parent): QOpenGLWidget(parent) {}
Mandelbrot* getMandelbrot() {return &mandelbrot;}
3 years ago
private:
void initializeGL() override;
void paintGL() override;
void resizeGL(int, int) override;
3 years ago
void wheelEvent(QWheelEvent*) override;
void mouseMoveEvent(QMouseEvent*) override;
void mousePressEvent(QMouseEvent*) override;
void mouseReleaseEvent(QMouseEvent*) override;
void keyPressEvent(QKeyEvent*) override;
3 years ago
QPoint mousePos;
void initShader();
static std::vector<QVector2D> genVertices();
GLuint createVAO();
GLuint vao;
int vertCount;
QOpenGLShaderProgram shader;
3 years ago
Mandelbrot mandelbrot;
};