Conrod: Can't show multiple textures on glutin/glium backend

Created on 1 Dec 2016  路  3Comments  路  Source: PistonDevelopers/conrod

On the glutin/glium backend, for some reason all widget::Images show the texture of whichever one was drawn first.

Given the Ids struct containing canvas, image1, image2,

  let image_map = image_map!
  {
    (ids.image1, tex1),
    (ids.image2, tex2),
  };
      widget::Canvas::new()
        .set(ids.canvas, ui);

      widget::Image::new()
        .w_h(200.0, 200.0)
        .align_left_of(ids.canvas)
        .align_top_of(ids.canvas)
        .set(ids.image1, ui);

      widget::Image::new()
        .w_h(200.0, 200.0)
        .align_right_of(ids.canvas)
        .align_bottom_of(ids.canvas)
        .set(ids.image2, ui);

Both image1 and image2 will show the texture for image1. Putting image2 before image1 results in both of them showing the texture for image2.

bug

Most helpful comment

And I can confirm with the exact same code as before that it is now working.

All 3 comments

I can confirm that I am getting this error as well.

@TimBednarzyk thanks a lot for reporting this and @tl8roy thanks for pinging this, I've been busy with a few contracts lately and the issue almost slipped my mind!

I just had a look at the glium backend and I think I've spotted the issue. I believe this line should set the State::Image with the widget_id, not the id as it is currently doing. As a result, it looks like every immediately consecutive instance of an image is being drawn with the first image in the sequence 馃槺 I think I must have tripped myself up here on the shadowing of the id binding.

Anyways, it should be an easy fix, I'll get to it now.

And I can confirm with the exact same code as before that it is now working.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanpoon picture alanpoon  路  4Comments

TomboFry picture TomboFry  路  3Comments

drmason13 picture drmason13  路  3Comments

pedrohex picture pedrohex  路  7Comments

mitchmindtree picture mitchmindtree  路  4Comments