Hi and help! I have a problem here. Unfortunately I am not very experienced with OpenGL and need a hint in which direction I have to look to fix the following problem.
I took the HelloGL code from the examples and wanted to make it into a QML widget. I cannot my experiments are a total failure, but unfortunately they are far from a total success also. https://imageshack.com/i/59c6eip https://imageshack.com/i/jmg97op The pics above show my problem. The old TT logo is recognizable, but the parts do not 'fit'. Also there is something wrong with the ring. This is strange, because I did not change anything in the way the mesh is calculated. It is 100% as found in the HelloGL example. The only thing I did was to put the OpenGL code into a paint() function. Similar to the one in the 'OpenGL Under QML example'. The paint function is plenty of copy/paste trial/error. And it certainly will change as soon as I get a better understandig about the scene graph stuff. But until then... does anyone see why the geometry of the TT logo is distorted? Guido void Squircle::paint() { glViewport(0, 0, window()->width(), window()->height()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); #ifdef QT_OPENGL_ES_1 glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); #else glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0); #endif glMatrixMode(GL_MODELVIEW); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_MULTISAMPLE); static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 }; glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); delete m_fbo; m_fbo = 0; int width = this->width(); int height = this->height(); if (width && height){ m_fbo = new QOpenGLFramebufferObject(width, height); } if (m_fbo){ QOpenGLFunctions glFunctions(QOpenGLContext::currentContext()); glFunctions.glUseProgram(0); QObject::connect(QOpenGLContext::currentContext(), SIGNAL(aboutToBeDestroyed()), this, SLOT(cleanup()), Qt::DirectConnection); m_fbo->bind(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0, 0.0, -10.0); glRotatef(mXRot / 16.0, 1.0, 0.0, 0.0); glRotatef(mYRot / 16.0, 0.0, 1.0, 0.0); glRotatef(mZRot / 16.0, 0.0, 0.0, 1.0); mMesh->setColor("green"); mMesh->draw(); m_fbo->release(); m_fbo->blitFramebuffer(this->window()->renderTarget(), m_fbo); } } _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest