8000 Canvas::draw_textured_mesh not using the given texture entirely · Issue #1295 · ggez/ggez · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Canvas::draw_textured_mesh not using the given texture entirely #1295
Open
@Bowarc

Description

@Bowarc

Describe the bug
The conversation on discord

Using the draw_textured_mesh method on graphics::Canvas seem to only use the top left pixel of the texture to color the mesh.

To Reproduce
Dori has made a quick example on their github

Expected behavior
For the mesh to be use the whole texture as, well, texture.

Screenshots or pasted code
My first thought was that the .src method of the DrawParam was missused, but using different values such as the size of the texture as w/h did not help.

canvas.draw_textured_mesh(
    self.mesh.clone(),
    self.texture.clone(),
    DrawParam::new()
        .scale(vec2(200.0, 200.0))
        .src(Rect {
            x: 0.0,
            y: 0.0,
            w: 32.0,
            h: 32.0,
        }),
);

This still displays a red pixel

I then tried making the mesh the same size as the texture

// new
let mesh = Mesh::new_rectangle(
    gfx,
    DrawMode::fill(),
    Rect {
        x: 0.,
        y: 0.,
        w: 32.,
        h: 32.,
    },
    Color::WHITE,
)
.unwrap();

// draw
canvas.draw_textured_mesh(
    self.mesh.clone(),
    self.texture.clone(),
    DrawParam::new()
        .src(Rect {
            x: 0.0,
            y: 0.0,
            w: 32.0,
            h: 32.0,
        }),
);

Same issue

Hardware and Software:

  • ggez version: 0.9.3 main (crates.io)
  • OS: Windows 10 / Kali Linux
  • Graphics card: Nvidia GeForce RTX 2070 / Intel Tiger Lake-LP GT2
  • Graphics card drivers: proprietary v566.14 / Mesa Intel(R) UHD Graphics (TGL GT2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0