Absyl
Hello,
I am trying to render a texture which I update every frame in code.
I am creating the rendertarget like so:
SharedPtr<Texture2D> renderTarget_(new Texture2D(context));
renderTarget_->SetSize(context_->GetSubsystem<Graphics>()->GetWidth(), context_->GetSubsystem<Graphics>()->GetHeight(), Graphics::GetRGBAFormat(), TEXTURE_RENDERTARGET);
renderTarget_->GetRenderSurface()->SetUpdateMode(SURFACE_UPDATEALWAYS);
Whenever I receive updated pixels I set the texture data:
renderTarget_->SetData(0,
0,
0,
context_->GetSubsystem<Graphics>()->GetWidth(),
context_->GetSubsystem<Graphics>()->GetHeight(),
buffer); // buffer is |width| * |height| * 4 bytes in size representing a BGRA image
Running this code with DirectX 9 renderer gives the following error at SetData()
Running the same code on Urho3D built with DirectX 11 works with no problem.
Other texture types work fine (TEXTURE_DYNAMIC for example).
What am I doing wrong here? I’d like to use DX9 if possible.