Render/flickering problems when changing states

(Abovegame) #1

Here’s a video to better understand what’s the problem:

I have an entity:


And a custom render pass that draws the terrain mesh. So when i change states i add a Hidden component to this entity, at the same time i added for prepare function to return the correct result like so (just a snippet):

let changed = (old_vertex_count != self.vertex_count) || self.hidden;
self.change.prepare_result(index, changed)

In my draw_inline at the begining i have:

if self.vertex_count == 0 || self.hidden {

And i guess this all works well, until i switch back to the starting phase. The only way to stop it flickering is to resize the window (in which the swapchain gets recreated).

Any ideas why this is happening? Or I guess another question is how to correctly implement the hidding or not rendering the terrain while in the other state ( i don’t want to have to recreate it).

(Nathan) #2

I don’t have any guesses. Is your code open source?

(Abovegame) #3

Unfortunately no, since I’m not sure if I want it to be commercial or not yet.