setting core profile gets a blank background



  • I was following the cube tutorial the other day, and was trying to get it work with OpenGL 3.3 core profile. I have set my QSurfaceFormat in main correctly as you can see in the following code:

    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QSurfaceFormat format;
        format.setDepthBufferSize(24);
        format.setVersion(3,3);
        format.setRenderableType(QSurfaceFormat::OpenGL);
        format.setProfile(QSurfaceFormat::CoreProfile);
        QSurfaceFormat::setDefaultFormat(format);
    
        app.setApplicationName("textured cube");
        app.setApplicationVersion("0.1.0");
    #ifndef QT_NO_OPENGL
        Dialog w;
        w.show();
    #else
        QLabel note("OpenGL Support required");
        note.show();
    #endif
        return app.exec();
    }
    

    I did also added #version 330 in both my vertex and fragment shader
    here is my result
    What did I do wrong?

    another question:
    My application is tend to be cross desktop platforms in the future, should I choose OpenGL 2.0 ES over OpenGL 3.3 Core?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.