Results 1 to 2 of 2

Thread: OpenGL ES2.0 QGLWidget at GraphicsScene

  1. #1

    Question OpenGL ES2.0 QGLWidget at GraphicsScene

    hi,

    I worked with Qt/embedded4.6 on OMAP3 platform with SGX OES2 enabled.
    it is ok to run hello_es2 . but When trying to draw a camera video at scene backgroun
    just following boxdemo provided, it always fail. the program runed just show background color. the logged report:
    -----------------------------------------------------
    Unrecognised OpenGL version
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"
    QEglContext::swapBuffers(): "Bad native window (0x300B)"

    my drawbackground function is as below
    float width = float(painter->device()->width());
    float height = float(painter->device()->height());

    painter->beginNativePainting();


    glViewport(0,0,width,height);
    glClearColor(0, 0.2, 0.1f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);




    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, m_uiTexture);
    if(!waitLogo)
    {

    int buffer_width=320;
    int buffer_height=240;
    if(! m_camera->m_fotoReady)
    {
    GstBuffer* buf=(m_camera->refresh_buffer()); //manually call appsink to fetch for data in the buffer
    // //unsigned char* data=(unsigned char *) GST_BUFFER_DATA (CameraN900::buffer);

    //if(m_camera->m_streamReady)
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, buffer_width,buffer_height, 0, GL_RGB, GL_UNSIGNED_BYTE, m_camera->m_buffer);
    m_camera->release_buffer(buf);
    } else
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, buffer_width,buffer_height, 0, GL_RGB, GL_UNSIGNED_BYTE, m_camera->m_buffer);




    } else
    {
    QImage image=QImage(":icons/qt.png");//,QImage::Format_RGB888);
    char * imgData=(char*)image.bits();
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, 128,128, 0, GL_RGB, GL_UNSIGNED_BYTE, imgData);

    }

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

    glFrontFace(GL_CW);
    glCullFace(GL_FRONT);
    glEnable(GL_CULL_FACE);
    // glEnable(GL_DEPTH_TEST);

    QMatrix4x4 modelview;




    if (waitLogo) {
    modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
    modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
    modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
    modelview.scale(m_fScale);

    modelview.translate(0.0f, -0.2f, 0.0f);
    program1.bind();
    program1.setUniformValue(matrixUniform1, modelview);
    paintWaitLogo();
    program1.release();
    } else {
    modelview.scale(m_fScale);
    program2.bind();
    program2.setUniformValue(matrixUniform2, modelview); //program1.setUniformValue(matrixUniform2, modelview);
    paintTextured();
    program2.release();
    }

    glDisable(GL_DEPTH_TEST);
    glDisable(GL_CULL_FACE);





    painter->endNativePainting();

    QString framesPerSecond;
    framesPerSecond.setNum(frames /(time.elapsed() / 1000.0), 'f', 2);

    painter->setPen(Qt::white);

    painter->drawText(20, 40, framesPerSecond + " fps");

    other part of code just as the demo did ,any help for that?

  2. #2

    Default Re: OpenGL ES2.0 QGLWidget at GraphicsScene

    anyone give me some suggestion?

Similar Threads

  1. Problem on Print GraphicsScene with OpenGL
    By redmong in forum Qt Programming
    Replies: 0
    Last Post: 2nd June 2010, 15:37
  2. Replies: 1
    Last Post: 7th May 2010, 17:20
  3. transfer graphicsscene on form1 to graphicsscene on form2
    By rogerholmes in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2009, 20:37
  4. Line in GraphicsScene
    By konvex in forum Qt Programming
    Replies: 6
    Last Post: 16th November 2008, 12:53
  5. GraphicsScene Question
    By QbelcorT in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2008, 08:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.