Skip to content

The cube example shouldn't use integers for texture coordinates #390

@ucarion

Description

@ucarion

This isn't a bug, but rather a suggestion for making the cube example more helpful for noobs (like me).

In the cube example, a_tex_coord is an ivec2/[i8; 2], which led me to assume that it is supposed to be an index. Of course, if I knew how texture() works in fragment shaders, I would have known better -- but I didn't, because I'm a noob. I assumed that a_tex_coord was a 2d-index into my texture, rather than a point in the unit square.

Perhaps a_tex_coord should be changed to be of the type vec2 in GLSL and [f32; 2] in Rust? Having it be an integer is useful only in the case of a texture of size no greater than 2x2, which is a rare use-case.

If there's no reason against making this change, I'll gladly open a PR myself. But I have the suspicion that I simply don't have the relevant context, and that there's a good reason the code is as-is.

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