```{index} single: SDL_CreateRenderer (SDL2) ``` ```{index} single: SDL2::SDL_CreateRenderer ``` # SDL_CreateRenderer Creates a renderer for a window and returns its handle, or undef. ```perl my $ren = SDL_CreateRenderer($win, -1, SDL_RENDERER_ACCELERATED); ``` `-1` asks SDL to choose the driver, which is what you almost always want. `$flags` is the OR of `SDL_RENDERER_*`: `ACCELERATED` for the GPU, `PRESENTVSYNC` to sync presentation with the display's refresh, `SOFTWARE` to force CPU rendering, `TARGETTEXTURE` to allow rendering into a texture. Free it with `SDL_DestroyRenderer`.