Skip to content

[rtexture] Drawing texture with negative width or height draws nothing #4316

@lxmcf

Description

@lxmcf

Issue description

When drawing a sprite with a negative value on only 1 axis; the sprite will not be rendered.

When using a negative value on the x and y axis, will render as expected, code example should have expected behaviour of the image only being flipped on the xaxis.

Environment

Fedora Workstation 40, OpenGL 4.6, Intel ADL Gt2 and rx7900xt GPU tested.

Issue Screenshot

image

Code Example

#include <raylib.h>

int main () {
    InitWindow (640, 360, "Hello World");

    Texture2D texture = LoadTexture ("image.png");

    while (!WindowShouldClose ()) {
        BeginDrawing ();
        ClearBackground (SKYBLUE);

        Rectangle source = {
            .x      = 0,
            .y      = 0,
            .width  = (float)texture.width,
            .height = (float)texture.height,
        };

        Rectangle destination = {
            .x      = 320,
            .y      = 180,
            .width  = -(float)texture.width,
            .height = (float)texture.height,
        };

        DrawTexturePro (texture, source, destination, CLITERAL (Vector2){0, 0}, 0, WHITE);
        EndDrawing ();
    }

    UnloadTexture (texture);

    CloseWindow ();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions