Scaling QOpenGLWidget
Unsolved
General and Desktop
-
wrote on 16 Mar 2016, 17:33 last edited by
Why does scaling work with no matter that i turned glViewport in resizeGL or not?
Window::Window(QWidget *parent, Qt::WindowFlags f) : QOpenGLWidget(parent, f) { } void Window::initializeGL() { QOpenGLFunctions_1_5 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_5>(); f->glClearColor(.0f, .0f, .0f, .0f); f->glShadeModel(GL_FLAT); } void Window::resizeGL(int w, int h) { QOpenGLFunctions_1_5 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_5>(); // f->glViewport(0, 0, 1000, 1000); } void Window::paintGL() { QOpenGLFunctions_1_5 *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_5>(); f->glClear(GL_COLOR_BUFFER_BIT); f->glColor3f (1.0, 1.0, 1.0); f->glBegin(GL_POLYGON); f->glVertex2f(0.0, 0.0); f->glVertex2f(0.0, 0.5); f->glVertex2f(0.5, 0.5); f->glVertex2f(0.5, 0.0); f->glEnd(); f->glFlush(); }
-
wrote on 17 Mar 2016, 13:06 last edited by
Background color changed. It is all. If change glViewport, for example as f->glViewport(0, 0, 2000, 2000); that nothing happened.
-
Hi,
It's a little bit more complex than that. See this article about the various transformation that you can apply.
1/4