Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. GlPopAttrib and glPushAttrib on GLES for rendering fbo to a qquickitem

GlPopAttrib and glPushAttrib on GLES for rendering fbo to a qquickitem

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 3.2k 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.
  • M Offline
    M Offline
    Martell Malone
    wrote on last edited by
    #1

    Hi guys,

    I've extended QQuickitem to create an area where I can call open gl calls directly.

    Only problem is on GLES/ANGLE platforms I cant push and pop like so

    This is the preprocess in my QSGSimpleTextureNode extended class

    @void ColorNode::preprocess()
    {
    if(m_fbo == NULL) return; //will happen a few times

    QOpenGLContext::currentContext()->functions()->glUseProgram(0);
    glPopAttrib();
    m_fbo->bind();
    

    //CCDirector::sharedDirector()->mainLoop();
    opengl calls here

    glPushAttrib(GL_ALL_ATTRIB_BITS);
    m_fbo->release();
    

    m_fbo->toImage().save("name.png","png");

    }@

    Any ideas?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If i'm not wrong, your calls are reversed, glPushXXX should be call before glPopXXX, otherwise you will have an "underflow" of what you're trying to push/pop.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Martell Malone
        wrote on last edited by
        #3

        I didn't write this code.
        I think it is done this way because the qml window is already drawing something to screen via gl.

        This code above works though I've tested it.

        The problem is that the funstions glpush and glpop doesn't exsist on GLES systems so how do we do it?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sorry, i misread your post, you'll have to handle these attribute yourself (they are part of the fixed pipe which is not there anymore in gles)

          But for normal OpenGL, having pop before push looks wrong even if it works.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Martell Malone
            wrote on last edited by
            #5

            How do I handle these attributes?

            You are right I thought it was strange also.
            Here is my explanation.

            Lets say we have a text list.
            qt pushes the view of the text list on to the stack.
            It will then draw the surrounding window.
            it will pop it off at the end and draw it to the area we want our qquickitem.
            To ensure the text list is drawn last.

            so what we are doing is popping it off early modify it and push it back for qt to draw it at a later stage.
            At least that's what I can gather from qquickitem

            now my question is how does qt do this for GLES systems because it must do it somehow?

            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