I want to use two passes on some custom vertices.
What I could not figure out is this scheme:
// How to have the first processed vertices as input on the second draw call?
I don’t want to have dependency on the scene/camera to create a rendertarget.
Is there a way to work on this low level and have the processed data as input on the new draw call?
If you mean transform feedback, that isn’t implemented in Urho.
Basically the shader just modify fragment uniforms, so what change effectively are pixels and not vertex.
But again what comes to my mind is RenderTarget with Scene/Camera/Material/etc… dependency.
I draw vertices without creating any material for them and I don’t know how to capture drawed pixels.
graphics->Draw(Urho3D::TRIANGLE_LIST, 0, iBuff->GetIndexCount(), 0, vBuff->GetVertexCount());
Ah, now I understand. You want to do the same as what the renderpath post-process chain does automatically. Sampling & writing to same rendertarget is illegal, so you need to have 2 rendertarget textures and do:
- Set rendertarget 1
- Render pass 1
- Set rendertarget 2
- Assign rendertarget 1 to some texture unit (SetTexture)
- Sample the texture unit when rendering pass 2
First of all all my code is executed in an E_ENDRENDERING event.
I have some issues:
SharedPtr renderTexture(new Texture2D(context_));
renderTexture->SetSize(size.x_, size.y_, Graphics::GetRGBFormat(), TEXTURE_RENDERTARGET);
Invalidates the Draw call which doesn’t draw anything.
The issue seems to be with SetSize.