Scroll to navigation

SDL_CreateRenderer(3) SDL3 FUNCTIONS SDL_CreateRenderer(3)

NAME

SDL_CreateRenderer - Create a 2D rendering context for a window.

SYNOPSIS

#include "SDL3/SDL.h"
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags);

DESCRIPTION

If you want a specific renderer, you can specify its name here. A list of available renderers can be obtained by calling

SDL_GetRenderDriver
multiple times, with indices from 0 to SDL_GetNumRenderDrivers ()-1. If you don't need a specific renderer, specify NULL and SDL will attempt to choose the best option for you, based on what is available on the user's system.

If you pass SDL_RENDERER_SOFTWARE
in the flags, you will get a software renderer, otherwise you will get a hardware accelerated renderer if available.

By default the rendering size matches the window size in pixels, but you can call

SDL_SetRenderLogicalPresentation () to change the content size and scaling options.

FUNCTION PARAMETERS

the window where rendering is displayed
the name of the rendering driver to initialize, or NULL to initialize the first one supporting the requested flags
0, or one or more SDL_RendererFlags
OR'd together

RETURN VALUE

Returns a valid rendering context or NULL if there was an error; call

SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.0.0.

SEE ALSO

SDL_CreateRendererWithProperties(3), SDL_CreateSoftwareRenderer(3), SDL_DestroyRenderer(3), SDL_GetNumRenderDrivers(3), SDL_GetRenderDriver(3), SDL_GetRendererInfo(3)

SDL 3.1.0 SDL