opengl init

master
Benjamin Kraft 3 years ago
parent d9ffbb1b6c
commit 7486e1f3bf
  1. 2
      headers/OutputWidget.h
  2. 1
      src/MainWindow.cpp
  3. 10
      src/OutputWidget.cpp

@ -6,7 +6,7 @@
#include <QOpenGLFunctions>
#include <QOpenGLWidget>
class OutputWidget : public QOpenGLWidget, protected QOpenGLFunctions {
class OutputWidget : public QOpenGLWidget, public QOpenGLFunctions {
Q_OBJECT
private:
void initializeGL() override;

@ -8,6 +8,7 @@ MainWindow::MainWindow() {
}
void MainWindow::buildUI() {
resize(700, 700);
auto sizeSlider = new QSlider(Qt::Horizontal);
sizeSlider->setRange(100, 800);

@ -1,8 +1,16 @@
#include <iostream>
#include "../headers/OutputWidget.h"
void OutputWidget::initializeGL() {
initializeOpenGLFunctions();
std::cout << "Initialize GL" << std::endl;
auto format = this->format();
std::cout << "OpenGL version: " <<
format.majorVersion() << "." << format.minorVersion()
<< std::endl;
::glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}
void OutputWidget::paintGL() {

Loading…
Cancel
Save