SDL_CREATERENDERERWITHPROPERTIES(3)

โœจ SDL_CreateRendererWithProperties โœจ

okay bestie, welcome to the SDL3 function zone ๐Ÿ’– this one lives in SDL_CreateRendererWithProperties(3) and it's literally the glow-up version of making a 2D rendering context for a window โ€” except you get to hand it a whole lil bag of properties instead of boring positional args. main character energy fr fr ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

SDL_CreateRendererWithProperties โ€” Create a 2D rendering context for a window, with the specified properties. โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

#include <SDL3/SDL_render.h>

SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props);

๐Ÿ’… DESCRIPTION ๐Ÿ’…

so basically you pass in a props ID and it reads a whole vibe board of properties off it. here's the full list, no skipping, no gatekeeping ๐Ÿซถ

  • SDL_PROP_RENDERER_CREATE_NAME_STRING โ€” the name of the rendering driver to use, if you want a specific one ๐Ÿ‘‘
  • SDL_PROP_RENDERER_CREATE_WINDOW_POINTER โ€” the window where rendering is displayed. required if this isn't a software renderer using a surface ๐ŸชŸ
  • SDL_PROP_RENDERER_CREATE_SURFACE_POINTER โ€” the surface where rendering is displayed, if you want a software renderer without a window ๐ŸŽจ
  • SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER โ€” an SDL_Colorspace value describing the colorspace for output to the display, defaults to SDL_COLORSPACE_SRGB. the direct3d11, direct3d12, and metal renderers support SDL_COLORSPACE_SRGB_LINEAR, which is a linear color space and supports HDR output ๐ŸŒˆ. if you select SDL_COLORSPACE_SRGB_LINEAR, drawing still uses the sRGB colorspace, but values can go beyond 1.0 and float (linear) format textures can be used for HDR content. it's giving โœจextra rangeโœจ
  • SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER โ€” non-zero if you want present synchronized with the refresh rate. this property can take any value that is supported by SDL_SetRenderVSync() for the renderer ๐ŸงŠ

๐ŸŽฎ With the SDL GPU renderer (since SDL 3.4.0) ๐ŸŽฎ

  • SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER โ€” the device to use with the renderer, optional.
  • SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN โ€” the app is able to provide SPIR-V shaders to SDL_GPURenderState, optional.
  • SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN โ€” the app is able to provide DXIL shaders to SDL_GPURenderState, optional.
  • SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN โ€” the app is able to provide MSL shaders to SDL_GPURenderState, optional.

๐ŸŒ‹ With the vulkan renderer ๐ŸŒ‹

  • SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER โ€” the VkInstance to use with the renderer, optional.
  • SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER โ€” the VkSurfaceKHR to use with the renderer, optional.
  • SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER โ€” the VkPhysicalDevice to use with the renderer, optional.
  • SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER โ€” the VkDevice to use with the renderer, optional.
  • SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER โ€” the queue family index used for rendering.
  • SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER โ€” the queue family index used for presentation.

๐Ÿ“ FUNCTION PARAMETERS ๐Ÿ“

  • props โ€” the properties to use.

๐Ÿ’œ RETURN VALUE ๐Ÿ’œ

Returns a valid rendering context, or NULL if there was an error ๐Ÿ˜ญ (we hate to see it). call SDL_GetError() for more information โ€” she'll tell you what went wrong, no cap.


๐Ÿงš THREAD SAFETY ๐Ÿงš

This function should only be called on the main thread. do not try to be sneaky with it on another thread bestie, it's not built for that ๐Ÿ’€


โญ AVAILABILITY โญ

This function is available since SDL 3.2.0. โœจ


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


Simple Directmedia Layer ยท SDL 3.4.18 ยท that's the whole page babes, go forth and create renderers ๐Ÿ’–๐Ÿฆ‹๐ŸŒธ๐ŸŽ€ periodt โœจ

๐Ÿ“ฆ where this page comes from