Qt World Summit: Submit your Presentation

QOpenGLWidget not rendering textures bound in non-Qt code

  • I'm moving my code from the old QGLWidget to QOpenGLWidget.

    In the old code I've been binding textures in non-Qt code and then rendering them on the QGLWidget.

    // Non-Qt code
    glGenTextures(1, tex);
    glBindTexture(GL_TEXTURE_2D, *tex);
    glTexImage2D(GL_TEXTURE_2D, ... );
    // ...
    // MyOpenGLWidget->drawWorld(tex);

    MyQOpenGLWidget::drawWorld(GLuint textureID)
    glBindTexture(GL_TEXTURE_2D, textureID);
    // ...

    This doesn't seem to work; I get a blank screen. Is there something I should do differently to make this happen, or is it some other problem ?

    I don't know that much about OpenGL. This is all happening on Mac.

Log in to reply