QXcbConnection: XCB error: 8 (BadMatch),



  • {linux 3.19 QT5.6}...

    I using OpenCV3 OpenGL SQLITE3 .... and at lauch of my app appear :

    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1587, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1635, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1647, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1659, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1671, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1724, resource id: 65011835, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1828, resource id: 65011922, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1900, resource id: 65011922, major code: 130 (Unknown), minor code: 3
    QXcbConnection: XCB error: 8 (BadMatch), sequence: 1901, resource id: 65011922, major code: 130 (Unknown), minor code: 3
    

    the error appear after I add on my app Qlabel with opengl texure for show my cam....
    I 've any Ideas of these ... on google I fingd only error related xorg ..... but these isn't xorg bug... log file is ok....

    Any suggest is well accept...

    Regards
    Giorgio


  • Lifetime Qt Champion

    Hi,

    Can you explain how you set a texture on your QLabel ?

    By the way, why not use QCamera and QCameraViewfinder since you are working with a camera?



  • #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include "glwidg.h"
    #include <QThread>
    #include <QtConcurrent/QtConcurrent>
    #include <QtConcurrent/QtConcurrentRun>
    #include <QFuture>
    #include <QFutureWatcher>
    #include <QtWidgets>
    #include <QtWidgets/QAction>
    #include <QtWidgets/QWidget>
    #include <QtWidgets/QWidgetAction>
    #include <QtWidgetsDepends>
    #include <QtWidgetsVersion>
    #include <QTableWidget>
    #include <QTableWidgetItem>
    #include <QTableWidgetSelectionRange>
    #include <QTableView>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    #include <iostream>
    #include <math.h>
    #include <stdio.h>
    #include <opencv2/opencv.hpp>
    #include <opencv2/imgproc/imgproc.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/core/core.hpp>
    #include <sstream>
    #include <string.h>
    #include <GL/glu.h>
    #include <GL/glut.h>
    #include <GL/freeglut.h>
    #include <QtOpenGL/QGLWidget>
    #include <QtOpenGL/QGLBuffer>
    #include <QtOpenGL/QtOpenGL>
    #include <QTime>
    #include <QTimer>
    #include <QDebug>
    
    
    QImage camera000;
    GLuint texture[1];
    QImage GL_formatt;
    QImage qform;
    QImage qform1;
    int cambio1 = 0;
    
    cv::Mat imma2;
    cv::Mat imma3;
    
    IplImage* frame0;
    
    
    int play = 0;
    
    
    
    
    glwidg::glwidg(QWidget *parent) :
        QGLWidget(parent)
    
    {
    
        this->setAttribute(Qt::WA_DeleteOnClose); //// SI INIZIALIZZ AIL BUFFER E LE DIMENSIONI DI CATTURA
    
        QGLWidget(QGLFormat(QGL::DirectRendering));
        setMaximumSize(480,360);//(352,288);
    
        initializeGL();
    
        paintGL();
    
    
    }
    
    
    
    
    
    
    void glwidg::resizeGL(int w, int h)
    {
    
        makeCurrent();
        glViewport(0, 0, w, h);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluOrtho2D(0, w, 0, h); // set origin to bottom left corner
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
    
    }
    
    
    void glwidg::initializeGL()
    {
        makeCurrent();
        glClearDepth(2000.0);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_DEPTH_TEST);
        glDisable(GL_COLOR_MATERIAL);
        glEnable(GL_BLEND);
        glEnable(GL_POLYGON_SMOOTH);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        qglClearColor(Qt::white);
    
    }
    
    void glwidg::paintGL()
    {
        makeCurrent();
    
    
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        qglColor(Qt::white);
    
    
        glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
        glMatrixMode(GL_MODELVIEW); /*+*/
        glEnable(GL_DEPTH_TEST);
    
        if (cambio1 == 0)
        {
            qform1.load("/home/kc1/Qt/KC-C/RIS/control2_106.png");
            qq1frame = qform1.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
        }
        else
        {
            qq1frame = qform1.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
        }
    
    
    
        qqframe = qq1frame.mirrored(false, true);
    
        if(!qqframe.isNull())
        {
            qqframe = qqframe.scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
           // glDrawPixels(qqframe.width(), qqframe.height(), GL_RGBA, GL_UNSIGNED_BYTE, qqframe.bits());
    
            // or do 2D texture mapping
            glMatrixMode(GL_MODELVIEW); /**/
            glEnable(GL_DEPTH_TEST);
            glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluOrtho2D(0,qqframe.width(),qqframe.height(),0);
            glMatrixMode(GL_MODELVIEW);
            //glDisable(GL_DEPTH_TEST);
            glLoadIdentity();
            glEnable(GL_TEXTURE_2D);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
            glTexImage2D( GL_TEXTURE_2D, 0, 4, qqframe.width(), qqframe.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, qqframe.bits() );
            glBegin(GL_QUADS);
            glTexCoord2f(0,0); glVertex2f(0,qqframe.height());
            glTexCoord2f(0,1); glVertex2f(0,0);
            glTexCoord2f(1,1); glVertex2f(qqframe.width(),0);
            glTexCoord2f(1,0); glVertex2f(qqframe.width(),qqframe.height());
            glEnd();
            glDisable(GL_TEXTURE_2D);
            // .... end
    
           // qDebug() << ("ho disegnato??");
            glDisable(GL_DEPTH_TEST);
    
    
            glFlush();
    
         }
    
        if(qqframe.isNull())
        {
            glClear(GL_COLOR_BUFFER_BIT);
            qglColor(Qt::white);
        }
    
    }
    
    
    
    void glwidg::donextcam()
    {
    
        makeCurrent();
    
    }
    
    
    void glwidg::imma_orig_r1(QImage qi1)
    {
        cambio1 = 1;
        qform1 = qi1;
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        updateGL();
    
    }
    
    void glwidg::stopcam1(bool st1)
    {
        if (st1)
        {
            cambio1 = 0;
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            updateGL();
        }
        else
        {
            cambio1 = 1;
        }
    }
    

    Because Gstream nor recognize mi BA81 camera???

    Sorry but you suggsdest me that beckground of QT camera is Gstream ... And I reply you tha GStream is not supported by my system for BA81 so I must use the old method of include v4l.cpp file in my filegrabcamera.cpp and use camerabuffer for convert matrix in right rgb format ....

    By the way I not understand XBC error:8 and not find any info about it.
    Thanks for any suggst.

    Regards
    Giorgio


  • Lifetime Qt Champion

    How am I supposed to relate this question to that other thread since you don't even mention it in the first place ?

    Also, your code doesn't use any QLabel and you seem to load your images from your hard drive so it gets a bit confusing to find the relation with your camera.

    So the question is: are you seeing this message since you added that custom QGLWidget ?

    There seems to also be OpenCV in the mix, are you using it to get images from the camera ?

    As for that XCB error 8, there's for example this bug that mentions it and that has been fixed since then.



  • the mechanism:

    1-qthread with opencv grab from camera...+ v4l.cpp integrted in it for right converting of image....(opencv meke some logical operation on image matrix)
    2-matrix2Qimage functon
    3-Qimage send to glwidg that use paint event to refresh QImage and convertitin the right dimension (i these way you can use opengl too and you can send multiple image if you wont...)
    4-in gui qlabel show qimqge or multiple tranformation from opengl if you want.....

    I show glwidg because opencv part use noting of qt part.... only matrix2qimage funcon...... glwidg use painter event ....other part of gui is right tested without glwidg....

    Thnks for your help

    Regards Giorgio


  • Lifetime Qt Champion

    Do you mean that you show the image twice ? Once with a QLabel and once with your QGLWidget ?



  • Real Real Sorry.... no QLabel exist..... GLwidg and opencv calculation is my old application vision system... now I rewamp it in my new interface ... to do that I have copy and paste .ui an .h .cpp file .... I see now that not exist QLabel that now is my custom widget GLwidg.....

    I must correct these:

    the mechanism:

    1-qthread with opencv grab from camera...+ v4l.cpp integrted in it for right converting of image....(opencv meke some logical operation on image matrix)
    2-matrix2Qimage functon
    3-Qimage send to glwidg that use paint event to refresh QImage and convertitin the right dimension (i these way you can use opengl too and you can send multiple image if you wont...) and show image in gui [stop here]
    /// not exist ///4-in gui qlabel show qimqge or multiple tranformation from opengl if you want...../

    Any how .....the error is still before the thread that creates the images begin to convey to glwidgt few frames .... I have a button to activate or not the Qthread with opencv capture .... The error occurs just start my application ... reading the link you gave me the error appears to be related to a window that does not open .... I put in /.../ all the code that launches messages or popup windows .... but XBC error remains .....

    Please can someone explain to me what does QXcb ??

    Regards
    Giorgio



  • ok I understand how not works ..... my app is quite large and not can control all in any situation ....

    fortunately today I needed to launch a command from my interface .... I made a mistake and the machinery driven by the interface has returned an error to me properly .... just that the pop-up window notifying the error is not seen .. ... so I could verify that the notification window is broken somewhere ...but to some resources it is not available (it could be a font, an icon, an associated variable ... I do not know .... )

    mystery solved ... almost ... now I have to see what that is hidden to the system.

    regards
    Giorgio


  • Lifetime Qt Champion

    Check whether you have any path that might be relative in your code.



  • Strange these error .... Finally I found these ....

    As I said the problem is a Qdialog ... these dialog is only a Waiting charge dialog with a circular progress bar .... first of insert my openCvWidget the code to start it was:

    m_dia2 = new Dia2(this);
                m_dia2->setAttribute(Qt::WA_DeleteOnClose, true);
                m_dia2->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
                m_dia2->setAttribute(Qt::WA_NoSystemBackground, true);
                m_dia2->setAttribute(Qt::WA_TranslucentBackground, true);
                m_dia2->AutoBmecdia2Value(AutoCount);
                m_dia2->Stepbmecdia2Value(WaitingStep);
                m_dia2->show();
    

    but now with "this" flag I Obtain QXcbConnection:XCB error 8 ......
    for solve the error now the code is:

    m_dia2 = new Dia2();
                m_dia2->setAttribute(Qt::WA_DeleteOnClose, true);
                m_dia2->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
                m_dia2->setAttribute(Qt::WA_NoSystemBackground, true);
                m_dia2->setAttribute(Qt::WA_TranslucentBackground, true);
                m_dia2->AutoBmecdia2Value(AutoCount);
                m_dia2->Stepbmecdia2Value(WaitingStep);
                m_dia2->show();
    

    in these way the dialog can exist when myapp is close and not found other solution to close these dialog when my app close .... Why firt to add a new code I can use:

    m_dia2 = new Dia2(this);
    

    and after only:

    m_dia2 = new Dia2();
    

    ???

    regards
    Giorgio


  • Lifetime Qt Champion

    From what widget are you calling this code ?



  • from void in MainWindow .....

    regards
    Giorgio


  • Lifetime Qt Champion

    void is a type, do you mean in a slot from MainWindow ?



  • I call it in c++ style some time from mainwindow slot sometime from qthread with connect signal slot but nevertimre directly every time calling it inside a mainwindows slot....

    regards
    giorgio


  • Lifetime Qt Champion

    How did you connect the signal from that QThread ?



  • i have a slot in mainwindow that start qhread ... inside that slot I have a list of:

    connect(mythread, SIGNAL(mysignal1(Qimage)), this, SLOT(mainwindosslot(QImage)), Qt::DirectConnection);
    

    for example....

    Ragards
    Giorgio


  • Lifetime Qt Champion

    Why are you forcing a direct connection ?

    This means that the slot will be called in the context of the thread managed by QThread which is not the GUI thread thus you are doing GUI related stuff from another thread which is not allowed.



  • @SGaist ... you are in right .... tanks.

    regards
    miki


Log in to reply
 

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