In my previous example I said you could draw images on the screen of an SDL2 window.
Here's how you create a texture (or surface) which has width 320 and height 200. Think of it as a rectangle where you can draw on :
use SDL2::Raw;
my $tile = SDL_CreateTexture($renderer, RGBA8888,
STREAMING, 320, 200);
To put pixels on the $tile texture, you can update the texture with an array of pixels (pixelpoints on the surface)
Each pixel is 32 bits wide in SDL2, there is red, green blue and an alpha (transparent) channel (RGBA8888, where 8+8+8+8=32 bits).
my $data = 0; ### pixelbuffer is empty
sub render {
SDL_UpdateTexture($tile, NULL, $data, 320*32); ### update 32 bits of 3
+20 pixels
}