Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.6, Windows 7 - getting OpenGL errors (1286, 1280, "Unsupported framebuffer format") in qopenglframebufferobject.cpp
Forum Updated to NodeBB v4.3 + New Features

Qt 5.6, Windows 7 - getting OpenGL errors (1286, 1280, "Unsupported framebuffer format") in qopenglframebufferobject.cpp

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 955 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Arun VA Offline
    Arun VA Offline
    Arun V
    wrote on last edited by Arun V
    #1

    Hi,

    The program I am working on uses QOpenGLWidget to render a 2D image. However, I keep getting OpenGL errors in qopenglframebufferobject.cpp (as described below). The fact that I am relatively new to OpenGL doesn't help matters either!

    I use Qt 5.6.0, and OpenGL 2.1.0. OS is Windows 7, display adapter is Intel HD graphics.

    A minimal program that reproduces the error is as follows:

    #include <GL/glew.h>
    
    #include <QtWidgets/QApplication>
    
    #include <QOpenGLWidget>
    #include <QSurfaceFormat>
    
    #include <GL/GLU.h>
    
    #include <iostream>
    
    using namespace std;
    
    class OGLErrorTest : public QOpenGLWidget
    {
    public:
        OGLErrorTest(QWidget *p = nullptr) : QOpenGLWidget(p) 
        {
            QSurfaceFormat sformat;
            sformat.setProfile(QSurfaceFormat::CompatibilityProfile);
            sformat.setMajorVersion(2);
            sformat.setMinorVersion(1);
            sformat.setDepthBufferSize(0);
            sformat.setAlphaBufferSize(0);
            sformat.setRedBufferSize(8);
            sformat.setGreenBufferSize(8);
            sformat.setBlueBufferSize(8);
            sformat.setStencilBufferSize(0);
            sformat.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
            sformat.setStereo(false);
    
            setFormat(sformat);
        }
    
        ~OGLErrorTest() {}
    
    protected:
    
        void initializeGL() 
        {
            glewExperimental = GL_TRUE;
            GLenum err = glewInit();
    
            if (err != GLEW_OK) {
                cout << "Failed to initialize GLEW" << endl;
                exit(-1);
            }
    
            const char *glv = (const char *)glGetString(GL_VERSION);
            glv = glv ? glv : "(unable to get OpenGL version)";
            cout << glv << endl;
        }
    
        void resizeGL(int w, int h) {}
    
        void paintGL() 
        {
            glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluOrtho2D(0, 100, 0, 100);
    
            glColor3f(1.0f, 1.0f, 1.0f);
            glBegin(GL_LINES);
            glVertex2d(0, 0);
            glVertex2d(100, 100);
            glEnd();
        }
    };
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        const char *qt_version = qVersion();
        qt_version = qt_version ? qt_version : "(unable to get qt version)";
        cout << qt_version << endl;
    
        OGLErrorTest w;
        w.show();
        return a.exec();
    }
    

    The output of the above program is:

    5.6.0
    2.1.0 - Build 8.15.10.2104
    [opengl\qopenglframebufferobject.cpp line 538] OpenGL Error: 1286
    QOpenGLFramebufferObject: Unsupported framebuffer format.
    QOpenGLFramebufferObject: Unsupported framebuffer format.
    [opengl\qopenglframebufferobject.cpp line 730] OpenGL Error: 1280
    

    The image gets displayed correctly. Not issues with that.

    However, my question: how can I get rid of the two OpenGL errors (1286, 1280) please? Does it look like a Qt problem, or does it look like it can be gotten rid of by (say) properly configuring the OpenGL context? I think Qt is trying to make use of some features that my hardware doesn't support. If that's the case, my question is, how can I find out what these features are, and how can I tell Qt to not expect these features to be available?

    I tried looking at the source code (qopenglframebufferobject.cpp), but couldn't figure out anything obvious that can be done to fix the error.

    Many thanks in advance!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved