multisampling aa!
This commit is contained in:
parent
e3cb8532fc
commit
0aaee9de33
@ -26,6 +26,11 @@ OpenGLWidget *OpenGLWidget::instance = nullptr;
|
|||||||
OpenGLWidget::OpenGLWidget(QWidget *parent)
|
OpenGLWidget::OpenGLWidget(QWidget *parent)
|
||||||
:QOpenGLWidget(parent) {
|
:QOpenGLWidget(parent) {
|
||||||
OpenGLWidget::instance = this;
|
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() {
|
void OpenGLWidget::initializeGL() {
|
||||||
QSurfaceFormat format;
|
|
||||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
|
||||||
format.setDepthBufferSize(24);
|
|
||||||
setFormat(format);
|
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
GLint major, minor;
|
GLint major, minor;
|
||||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||||
@ -162,7 +163,6 @@ void OpenGLWidget::initializeGL() {
|
|||||||
loadGround();
|
loadGround();
|
||||||
|
|
||||||
glClearColor(1, 1, 1, 0);
|
glClearColor(1, 1, 1, 0);
|
||||||
|
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
|
||||||
emit initialized();
|
emit initialized();
|
||||||
@ -176,8 +176,8 @@ void OpenGLWidget::resizeGL(int w, int h) {
|
|||||||
|
|
||||||
|
|
||||||
void OpenGLWidget::paintGL() {
|
void OpenGLWidget::paintGL() {
|
||||||
glEnable(GL_CULL_FACE); // shouldn't have to do that each frame, weird
|
glEnable(GL_CULL_FACE); // i shouldn't have to do this every frame, should i?
|
||||||
glEnable(GL_DEPTH_TEST); //
|
glEnable(GL_DEPTH_TEST);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
QMatrix4x4 trans;
|
QMatrix4x4 trans;
|
||||||
trans.translate(0, 0, -cam_dist);
|
trans.translate(0, 0, -cam_dist);
|
||||||
|
Loading…
Reference in New Issue
Block a user