Problem createTextureFromNativeObject
Unsolved
General and Desktop
-
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);
-
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