Hi, all!
I render 4 viewports on same render target texture. I have RenderTargetListener attached and RenderQueue::RenderableListener,
I need to change material for all objects rendered to one of viewports. How can I identify particular viewport?
All examples doing this (i.e. depth) use separate render target and identify by render target, but I need to identify by viewport,
how can I do this?
I guess you are writing to the same texture in different regions of it, and using 4 viewports, one for each 1/4 of the texture.
Then when you use "renderTarget->update()" (or if it is auto updated) you want the "preRenderTargetUpdate" function to understand which viewport is which? But that happens before any viewport is actually rendered to, so that will never work.
But, you could instead use "preViewportUpdate", which is also a part of the RenderTargetListener.
That way you know which viewport it comes from, since evt.source is a viewport.
I guess you are writing to the same texture in different regions of it, and using 4 viewports, one for each 1/4 of the texture.
Then when you use "renderTarget->update()" (or if it is auto updated) you want the "preRenderTargetUpdate" function to understand which viewport is which? But that happens before any viewport is actually rendered to, so that will never work.
But, you could instead use "preViewportUpdate", which is also a part of the RenderTargetListener.
That way you know which viewport it comes from, since evt.source is a viewport.
Aw, thanks a lot for this one! You're right with everything and it solved my problem!