From 0aaee9de337c6d5d7de05ad36a6c6ed15bcb7829 Mon Sep 17 00:00:00 2001 From: ccolin Date: Sun, 3 Jan 2021 23:07:35 +0100 Subject: [PATCH] multisampling aa! --- src/opengl_widget.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/opengl_widget.cc b/src/opengl_widget.cc index fb318ab..ccdcac5 100644 --- a/src/opengl_widget.cc +++ b/src/opengl_widget.cc @@ -26,6 +26,11 @@ OpenGLWidget *OpenGLWidget::instance = nullptr; OpenGLWidget::OpenGLWidget(QWidget *parent) :QOpenGLWidget(parent) { OpenGLWidget::instance = this; + QSurfaceFormat format; + format.setProfile(QSurfaceFormat::CoreProfile); + format.setDepthBufferSize(24); + format.setSamples(4); + setFormat(format); } @@ -115,10 +120,6 @@ void OpenGLWidget::loadGround() { void OpenGLWidget::initializeGL() { - QSurfaceFormat format; - format.setProfile(QSurfaceFormat::CoreProfile); - format.setDepthBufferSize(24); - setFormat(format); initializeOpenGLFunctions(); GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); @@ -162,7 +163,6 @@ void OpenGLWidget::initializeGL() { loadGround(); glClearColor(1, 1, 1, 0); - glCullFace(GL_BACK); emit initialized(); @@ -176,8 +176,8 @@ void OpenGLWidget::resizeGL(int w, int h) { void OpenGLWidget::paintGL() { - glEnable(GL_CULL_FACE); // shouldn't have to do that each frame, weird - glEnable(GL_DEPTH_TEST); // + glEnable(GL_CULL_FACE); // i shouldn't have to do this every frame, should i? + glEnable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QMatrix4x4 trans; trans.translate(0, 0, -cam_dist);