Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How to render opengl Texture bound to GL_TEXTURE_EXTERNAL_OES
Forum Updated to NodeBB v4.3 + New Features

How to render opengl Texture bound to GL_TEXTURE_EXTERNAL_OES

Scheduled Pinned Locked Moved Unsolved Qt 6
1 Posts 1 Posters 357 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.
  • C Offline
    C Offline
    Cheolgyu Shin
    wrote on last edited by Cheolgyu Shin
    #1

    I want to get a texture from eglstream and add a QQuickItem with that texture to the scene graph.

    The graphic API is gles2 and is implemented as follows using QSGSimpleTextureNode and QSGTexture,
    but it is not displayed normally. it displays only black. May I know what the problem is?

    QSGNode *CameraTexture::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *) {
    
        // other codes are omitted.
    
    //  generate texture and bind
        if (!glIsTexture(mTexture)) {
            glGenTextures(1, &mTexture);
            glActiveTexture(GL_TEXTURE0);        
            glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexture);
            glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
            glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    }
    
    // create texturenode
        QSGSimpleTextureNode* n = NULL;
        if (!oldNode) {
            n = new QSGSimpleTextureNode();
            n->setTextureCoordinatesTransform(QSGSimpleTextureNode::MirrorVertically);
        } else {
            n = dynamic_cast<QSGSimpleTextureNode*>(oldNode);
        }
    
    // create QSGTexture and set to node
        GLuint textureId = 0;
        if (mQsgTexture)
            textureId = mQsgTexture->nativeInterface<QNativeInterface::QSGOpenGLTexture>()->nativeTexture();
    
        if (mQsgTexture == NULL || textureId != mTexture) {
            mQsgTexture = QNativeInterface::QSGOpenGLTexture
                    ::fromNativeExternalOES(mTexture, window(), boundingRect().size().toSize());
        }    
    
        n->setTexture(mQsgTexture);
        n->markDirty(QSGNode::DirtyMaterial | QSGNode::DirtyGeometry);
        n->setRect(boundingRect());
        return n;
    }
    
    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