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. Problem createTextureFromNativeObject
Qt 6.11 is out! See what's new in the release blog

Problem createTextureFromNativeObject

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 430 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.
  • E Offline
    E Offline
    Eray
    wrote on last edited by
    #1

    Hi,

    I want to transform an OPENGL texture into QSGTexture.
    I want to do this because I use an external library to do.

    But using "createTextureFromNativeObject" always gives me a "black" texture while using "createTextureFromImage" of the same texture it works do you have any idea ?

    Test project : https://github.com/Ereaey/SFML_QML_RENDERER

    
        m_renderTexture->getTexture().copyToImage().saveToFile("/home/anthony/try.png"); // WORKS !!
        GLuint texture = static_cast<GLuint>(m_renderTexture->getTexture().getNativeHandle());
    
        qDebug() << "NATIVE HANDLE " << texture;
    
    
        GLenum error = glGetError();
        qDebug() << "GL ERROR " << error; // NO ERROR
    
    
        QImage image(m_renderTexture->getTexture().copyToImage().getPixelsPtr(), 800, 600, QImage::Format_RGBA8888);
    
        QSGTexture *wrapper = window()->createTextureFromImage(image);//WORKS !!
    
        QQuickWindow::CreateTextureOptions opts;
    
        wrapper =   window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
                                                       &texture,
                                                       0,
                                                       QSize(800, 600), opts); //BLACK TEXTURE
    m_node->setTexture(wrapper);
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      bredd33
      wrote on last edited by bredd33
      #2

      The simple texture node class must have a texture before being added to the scene graph to be rendered. You may find some tips here https://homework-writer.com/finance and I think it could be helpful

      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