I am raytracing on the CPU and I need to display my renders to the screen in realtime. I chose SDL 2 as it seems to be made for low level stuff.

I made this basic test which fills the screen from left to right, one column of pixel per frame. It works as expected, but runs very slowly (~10 fps):

```
int resolutionX = 1920, resolutionY = 1080;

if (SDL_Init(SDL_INIT_VIDEO) != 0)
    return EXIT_FAILURE;

SDL_Window *window = SDL_CreateWindow("Hello World!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, resolutionX, resolutionY, SDL_WINDOW_SHOWN);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
PixelBuffer *framebuffer = createPixelBuffer(resolutionX, resolutionY);
SDL_Texture *framebufferTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, framebuffer->width, framebuffer->height);

for (int x = 0; x < resolutionX; x++)
{
    for (int y = 0; y < resolutionY; y++)
        setPixel(framebuffer, x, y, 0x123456FF);

    SDL_UpdateTexture(framebufferTexture, NULL, framebuffer->pixels, framebuffer->pitch);
    SDL_RenderCopy(renderer, framebufferTexture, NULL, NULL);
    SDL_RenderPresent(renderer);
}

SDL_DestroyTexture(framebufferTexture);
destroyPixelBuffer(framebuffer);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();

```

I found `SDL_UpdateTexture` to be the slowdown.

~~I heard of `SDL_LockTexture` but I don't think I should be using it for write-only operations.~~  

**EDIT :** `SDL_LockTexture` is in fact exactly made for write-only operations.

Am I using this function in a wrong way ? Is there any other way to display my renders in real time ?