SDL_CreateTe...ithProperties(3)
โจ NAME โจ
SDL_CreateTextureWithProperties โ bestie, this one makes you a texture for a rendering context, and you get to pick the properties. it's giving bespoke โจ
๐ SYNOPSIS ๐
#include <SDL3/SDL_render.h>
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props);
๐ DESCRIPTION ๐
okay so instead of passing a million boring args, you hand this girl a bag of properties and she builds your texture exactly how you like it. here's the supported properties, no cap ๐ซถ
SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBERโ anSDL_Colorspacevalue that says what colorspace the texture lives in. defaults? it's giving variety:SDL_COLORSPACE_SRGB_LINEARfor floating point textures,SDL_COLORSPACE_HDR10for 10-bit textures,SDL_COLORSPACE_SRGBfor other RGB textures, andSDL_COLORSPACE_JPEGfor YUV textures. slay ๐SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBERโ one of the enumerated values inSDL_PixelFormat. defaults to the best RGBA format for the renderer ๐SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBERโ one of the enumerated values inSDL_TextureAccess. defaults toSDL_TEXTUREACCESS_STATICSDL_PROP_TEXTURE_CREATE_WIDTH_NUMBERโ the width of the texture in pixels. required, not optional, she's not playing ๐คSDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBERโ the height of the texture in pixels. also required fr frSDL_PROP_TEXTURE_CREATE_PALETTE_POINTERโ anSDL_Paletteto use with palettized texture formats. you can also set this later withSDL_SetTexturePalette()๐จSDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOATโ for HDR10 and floating point textures, this defines the value of 100% diffuse white, with higher values being displayed in the High Dynamic Range headroom. defaults to100for HDR10 textures and1.0for floating point textures ๐SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOATโ for HDR10 and floating point textures, this defines the maximum dynamic range used by the content, in terms of the SDR white point. this would be equivalent tomaxCLL / SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOATfor HDR10 content. if this is defined, any values outside the range supported by the display will be scaled into the available HDR headroom, otherwise they are clipped. important little caveat, don't skip it ๐
๐ฎ With the direct3d11 renderer
SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTERโ theID3D11Texture2Dassociated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTERโ theID3D11Texture2Dassociated with the U plane of a YUV texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTERโ theID3D11Texture2Dassociated with the V plane of a YUV texture, if you want to wrap an existing texture.
๐ฎ With the direct3d12 renderer
SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTERโ theID3D12Resourceassociated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTERโ theID3D12Resourceassociated with the U plane of a YUV texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTERโ theID3D12Resourceassociated with the V plane of a YUV texture, if you want to wrap an existing texture.
๐ With the metal renderer
SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTERโ theCVPixelBufferRefassociated with the texture, if you want to create a texture from an existing pixel buffer.
๐ With the opengl renderer
SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBERโ theGLuinttexture associated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBERโ theGLuinttexture associated with the UV plane of an NV12 texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBERโ theGLuinttexture associated with the U plane of a YUV texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBERโ theGLuinttexture associated with the V plane of a YUV texture, if you want to wrap an existing texture.
๐ธ With the opengles2 renderer
SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBERโ theGLuinttexture associated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBERโ theGLuinttexture associated with the UV plane of an NV12 texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBERโ theGLuinttexture associated with the U plane of a YUV texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBERโ theGLuinttexture associated with the V plane of a YUV texture, if you want to wrap an existing texture.
๐ฆ With the vulkan renderer
SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBERโ theVkImageassociated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBERโ theVkImageLayoutfor theVkImage. defaults toVK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALโจ
๐ With the GPU renderer
SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTERโ theSDL_GPUTextureassociated with the texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_NUMBERโ theSDL_GPUTextureassociated with the UV plane of an NV12 texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_NUMBERโ theSDL_GPUTextureassociated with the U plane of a YUV texture, if you want to wrap an existing texture.SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_NUMBERโ theSDL_GPUTextureassociated with the V plane of a YUV texture, if you want to wrap an existing texture.
๐ซถ FUNCTION PARAMETERS ๐ซถ
rendererโ the rendering context. your main character ๐ซpropsโ the properties to use. the whole vibe check, basically ๐
๐ RETURN VALUE ๐
Returns the created texture, or NULL on failure. if it flops, call SDL_GetError() for more information โ she will tell you what went wrong, ngl ๐ญ
๐ THREAD SAFETY ๐
This function should only be called on the main thread. no side-quests, no other threads, periodt โ
โญ AVAILABILITY โญ
This function is available since SDL 3.2.0. so if you're on an older version... not me finding out the hard way ๐
๐ SEE ALSO ๐
SDL_CreateProperties(3)SDL_CreateTexture(3)SDL_CreateTextureFromSurface(3)SDL_DestroyTexture(3)SDL_GetTextureSize(3)SDL_UpdateTexture(3)
and that's the whole page bestie, every single property, every default, every required field, all of it. go make something iconic ๐
this has been your girl from Simple Directmedia Layer, serving SDL 3.4.18 โ mwah, ily, bye ๐ซถโจ๐
๐ฆ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms