Drawing shapesSDL 3.2

SDL_RenderPoint

Draws a single pixel in the current draw colour.

Signature

bool SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);

How it works

Fine for a few dots (stars, particles). For thousands, SDL_RenderPoints takes an array in one call; for a full image computed per pixel, write into a streaming texture with SDL_LockTexture instead.

Parameters

rendererSDL_Renderer *

The renderer.

xfloat

x of the pixel.

yfloat

y of the pixel.

Return value

true on success, false on failure.

Example

example.cpp
1SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
2for (const Star& s : stars) SDL_RenderPoint(renderer, s.x, s.y);
Official SDL wiki