aboutsummaryrefslogtreecommitdiff
path: root/src/opengl_widget.cc
diff options
context:
space:
mode:
authorccolin2021-01-03 23:07:35 +0100
committerccolin2021-01-03 23:07:35 +0100
commit0aaee9de337c6d5d7de05ad36a6c6ed15bcb7829 (patch)
tree2760430130de9e7c07143c82b5e6a92183c7a9a7 /src/opengl_widget.cc
parente3cb8532fcc863897b6aa9430b0ab786f421cb95 (diff)
multisampling aa!
Diffstat (limited to 'src/opengl_widget.cc')
-rw-r--r--src/opengl_widget.cc14
1 files 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);