I did it with a Texture2D as a render target but without GetGPUObjectName().
In Urho3D code (I started from the RenderToTexture sample) :
renderTexture = new Texture2D(context_);
renderTexture->SetSize(URHO_WIDTH, URHO_HEIGHT, Graphics::GetRGBAFormat(), TEXTURE_RENDERTARGET);
renderTexture->SetFilterMode(FILTER_BILINEAR);
// Create a new material ...
...
mGPUObjectName = renderTexture->GetGPUObjectName();
mRenderTextureData = new unsigned char[renderTexture->GetDataSize(URHO_WIDTH, URHO_HEIGHT)];
// Get the texture's RenderSurface object (exists when the texture has been created in rendertarget mode) ...
RenderSurface* surface = renderTexture->GetRenderSurface();
SharedPtr<Viewport> rttViewport(new Viewport(context_, rttScene_, rttCameraNode_->GetComponent<Camera>()));
surface->SetViewport(0, rttViewport);
renderTexture->GetData(0, mRenderTextureData);
emit signalUrho3DToQML(mGPUObjectName, mRenderTextureData, URHO_WIDTH, URHO_HEIGHT);
And in the QML code :
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureNum);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA , URHO_WIDTH, URHO_HEIGHT, 0, GL_RGBA , GL_UNSIGNED_BYTE, mRenderTextureData);
glBegin(GL_QUADS);
glTexCoord2d(0,0); glVertex3f(-1.f, -1.f, 0.0f);
glTexCoord2d(1,0); glVertex3f(1.f, -1.f, 0.0f);
glTexCoord2d(1,1); glVertex3f(1.f, 1.f, 0.0f);
glTexCoord2d(0,1); glVertex3f(-1.f, 1.f, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
I can use the mGPUObjectName for textureNum but it doesn’t change anything. Maybe I do something wrong . However it works as I want, except that the QML texture has aliasing as you can see on the image below (on the left QML openGL, on the right Urho3D) . Some settings to do in openGL?