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. Trouble with QOpenGLDebugLogger

Trouble with QOpenGLDebugLogger

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmlopengldebugger
1 Posts 1 Posters 936 Views
  • 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.
  • K Offline
    K Offline
    Kruste
    wrote on 14 Jul 2017, 13:57 last edited by
    #1

    Hi,
    when trying to add a Debuglogger to the Scene Graph example (http://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html) to embedd an OpenGL context into a QQuickItem i've stumbled upon the problem, that, whatever i try, the loggers initialize function always prints out:

    QOpenGLDebugLogger::initialize(): the current context is not a debug context:
        this means that the GL may not generate any debug output at all.
        To avoid this warning, try creating the context with the
        QSurfaceFormat::DebugContext surface format option.
    

    To show how i did the initialization i put the header and source file here:

    class GLRenderEngine : public QOpenGLContext
    {
    public:
        GLRenderEngine();
        ~GLRenderEngine();
    
        void setViewportSize(const QSize &size) { m_Viewport = size; }
        void setWindow(QQuickWindow *window) { m_pWindow = window; }
    
    public slots:
        void paint();
        void onMessageLogged(QOpenGLDebugMessage message);
    signals:
        void messageLogged( QOpenGLDebugMessage message );
    
    private:
        bool m_bInit;
        QSize m_Viewport;
        QQuickWindow* m_pWindow;
    
        QOpenGLDebugLogger* m_pLogger;
    };
    
    void GLRenderEngine::onMessageLogged(QOpenGLDebugMessage message)
    {
        qDebug() << message;
    }
    
    void GLRenderEngine::paint()
    {
        if(!m_bInit)
        {
            QSurfaceFormat format;
            format.setMajorVersion(3);
            format.setMinorVersion(2);
            format.setProfile(QSurfaceFormat::CoreProfile);
            format.setOption(QSurfaceFormat::DebugContext);
            setFormat(format);
    
            create();
    
            m_pLogger = new QOpenGLDebugLogger(currentContext());//using 'this' didn't change anything
            connect( m_pLogger, SIGNAL( messageLogged( QOpenGLDebugMessage ) ),
                         this, SLOT( onMessageLogged( QOpenGLDebugMessage ) ),
                         Qt::DirectConnection );
    
            m_pLogger->initialize();
            m_pLogger->startLogging();
            FontRenderer::getInstance().initGL(functions());
            m_bInit = true;
        }
    
        glViewport(0, 0, m_Viewport.width(), m_Viewport.height());
    
        float fOrthoMatrix[16] = {0};
        float fViewMatrix[16] = {0};
        float fProjMatrix[16] = {0};
    
        ortho(fOrthoMatrix, 0.f, m_Viewport.width(), m_Viewport.height(), 0.f, 0, 50);
        // Set the camera position (View matrix)
        setLookAt(fViewMatrix, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.0f, 0.0f);
        // Calculate the projection and view transformation
        multiply(fProjMatrix, fOrthoMatrix, fViewMatrix);
    
        glClearColor(0, 0, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    
        TextUnit aText = { "Hello World", "./Sniglet-Regular.ttf", 18, 100, 100, 0xffffffff };
        FontRenderer::getInstance().drawText(&aText, fProjMatrix);
    
        // Not strictly needed for this example, but generally useful for when
        // mixing with raw OpenGL.
        m_pWindow->resetOpenGLState();
    }
    

    I've got an NVIDIA GTX 750, which has Debug support so it's not the graphics card fault.
    Also I'm using Ubuntu 16.04 with NVIDIA drivers version 375.66.
    I' appreciate help with this, because a subsequent part of my opengl code is not working and thus needs debugging.

    Thanks in advance.

    1 Reply Last reply
    2

    1/1

    14 Jul 2017, 13:57

    • Login

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