#How to draw many (thousands) of textures at reasonable FPS?

9 messages · Page 1 of 1 (latest)

crude monolith
#

I am experimenting, and want to draw 1 million moving asteroids on screen as my goal.
Doing:

void _state_gameplayloop_draw(double delta)
{
    TextureAsset *ta = assets_request_texture(ROOTDIR "/assets/star.png");
    if (ta) {
        for (int i = 0; i < 1000000; i++) {
            DrawTexture(ta->texture, 0, 200, WHITE);
        }
    } else {
        log_info("TextureAsset empty!");
    }
}

grinds the fps to a halt (the actual png is only loaded once outside the loop). I know the above method is not at all optimal for this, it is just to test the fps when doing it the 'dumb' way.

I want to learn more about Raylib, and low-level graphics, so that I can write more performant code for use-cases like the above.

tight wren
#

you're drawing the same texture as I can see, so why not draw it to a RenderTexture once, then cache it

#

redraw said RenderTexture only if something has changed

crude monolith
#

I am not that familiar with how rendertextures work. I will definitely read up on it.

violet obsidian
#

1 million is a lot

#

I don't know if it is too many though

#

check bunnymark maybe

crude monolith