Skip to content

Calling "sf2d_fill_texture_from_RGBA8" more then once corrupts the texture content #8

@Ghabry

Description

@Ghabry

This doesn't work:

// Called once
main_texture = sf2d_create_texture(width, height, TEXFMT_RGBA8, SF2D_PLACE_RAM);

// Called each frame
sf2d_fill_texture_from_RGBA8(main_texture, pixels, width, height);

sf2d_start_frame(GFX_TOP, GFX_LEFT);
// This renders garbage starting from the 2nd frame
    sf2d_draw_texture(main_texture, 40, 0);
sf2d_end_frame();

sf2d_swapbuffers();

This works but is slower due to the memory alloc each frame:

// Called each frame

main_texture = sf2d_create_texture_mem_RGBA8(pixels, width, height, TEXFMT_RGBA8, SF2D_PLACE_RAM);

sf2d_start_frame(GFX_TOP, GFX_LEFT);
    sf2d_draw_texture(main_texture, 40, 0);
sf2d_end_frame();
sf2d_free_texture(main_texture);
sf2d_swapbuffers();

Can this be fixed? A use case is when some graphic manipulation is done via the CPU (and the texture uploaded each frame)

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