Proper usage of `TextureSub`

(Abovegame) #1

I am unable to get a texture going for quite a while now, but i think i’m on the right path. I discovered by accident TextureSub but i’m not sure if using it correctly. First i just create a new one TextureSub::new(factory)? in my build method. Then i call maintain() method on it in the prepare method for the RenderGroup, later in the same method i insert the texture handle with the insert method.

        self.texture_id = self.diffuse_texture.insert(

At last in draw_inline method i check if the texture has been inserted and then call bind method on it.

self.diffuse_texture.bind(&self.pipeline_layout, 0, texture_id, &mut encoder);

Meanwhile my shader acquires this with layout (set = 0, binding = 0) uniform sampler2D diffuse; and i set fragColor = texture(diffuse, tex_coords);

The result i get:

So if anyone can shed any light how i can fix this please do! Anyhow one guy from the rust community told me that this could happen due to uninitialized texture memory?

There’s also some bug that occasionally i get some fonts ( numbers ) to render for no reason, it happens in a split second though.