From 660e8a1df2358f4309b6fbb70babab8916d8f2b5 Mon Sep 17 00:00:00 2001 From: Benjo Date: Fri, 4 Feb 2022 11:25:56 +0100 Subject: [PATCH] init vao --- headers/OutputWidget.h | 3 +-- src/OutputWidget.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/headers/OutputWidget.h b/headers/OutputWidget.h index af4eeed..a0bc27e 100644 --- a/headers/OutputWidget.h +++ b/headers/OutputWidget.h @@ -29,8 +29,7 @@ private: void initShader(); static std::vector genVertices(); GLuint createVAO(); - GLuint vao; - int vertCount; + GLuint vao{}; QOpenGLShaderProgram shader; Mandelbrot mandelbrot; diff --git a/src/OutputWidget.cpp b/src/OutputWidget.cpp index fcf5763..76d3b3f 100644 --- a/src/OutputWidget.cpp +++ b/src/OutputWidget.cpp @@ -23,7 +23,7 @@ void OutputWidget::paintGL() { } void OutputWidget::resizeGL(int w, int h) { - + } GLuint OutputWidget::createVAO() { @@ -33,7 +33,6 @@ GLuint OutputWidget::createVAO() { auto vertices = genVertices(); size_t size = vertices.size() * sizeof(QVector2D); - vertCount = int(vertices.size()); glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)size, &vertices[0], GL_STATIC_DRAW); GLuint vaoId; @@ -41,7 +40,7 @@ GLuint OutputWidget::createVAO() { glBindVertexArray(vaoId); glBindBuffer(GL_ARRAY_BUFFER, vboId); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(QVector2D), (GLvoid const*) 0); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(QVector2D), (void*) nullptr); glEnableVertexAttribArray(0); glBindVertexArray(0); @@ -72,6 +71,7 @@ void OutputWidget::wheelEvent(QWheelEvent *e) { void OutputWidget::mouseMoveEvent(QMouseEvent *e) { QPoint newMousePos = e->pos(); QPoint diff = newMousePos - mousePos; + auto m = getMandelbrot(); } void OutputWidget::mousePressEvent(QMouseEvent *e) {