SDL_GetTextureProperties(3)

๐Ÿ’– SDL_GetTextureProperties ๐Ÿ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual set, and it's about the lil function that spills the tea on a texture's properties. it's giving "tell me everything you know" energy and honestly? iconic.


โœจ NAME โœจ

SDL_GetTextureProperties โ€” get the properties associated with a texture. that's it, that's the vibe. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <SDL3/SDL_render.h>

SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so like, SDL itself is handing you these read-only properties, no take-backs, you just read them and move on. periodt.

  • SDL_PROP_TEXTURE_COLORSPACE_NUMBER โ€” an SDL_Colorspace value describing the texture colorspace. ๐ŸŽจ
  • SDL_PROP_TEXTURE_FORMAT_NUMBER โ€” one of the enumerated values in SDL_PixelFormat.
  • SDL_PROP_TEXTURE_ACCESS_NUMBER โ€” one of the enumerated values in SDL_TextureAccess.
  • SDL_PROP_TEXTURE_WIDTH_NUMBER โ€” the width of the texture in pixels.
  • SDL_PROP_TEXTURE_HEIGHT_NUMBER โ€” the height of the texture in pixels.
  • SDL_PROP_TEXTURE_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. this defaults to 100 for HDR10 textures and 1.0 for other textures. โญ
  • SDL_PROP_TEXTURE_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. 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. this defaults to 1.0 for SDR textures, 4.0 for HDR10 textures, and no default for floating point textures. no cap, that last one really has no default. ๐Ÿ’€

๐ŸŽฎ with the direct3d11 renderer:

  • SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER โ€” the ID3D11Texture2D associated with the texture
  • SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER โ€” the ID3D11Texture2D associated with the U plane of a YUV texture
  • SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER โ€” the ID3D11Texture2D associated with the V plane of a YUV texture

๐ŸŽฎ with the direct3d12 renderer:

  • SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER โ€” the ID3D12Resource associated with the texture
  • SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER โ€” the ID3D12Resource associated with the U plane of a YUV texture
  • SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER โ€” the ID3D12Resource associated with the V plane of a YUV texture

๐ŸŒ‹ with the vulkan renderer:

  • SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER โ€” the VkImage associated with the texture

๐ŸŒˆ with the opengl renderer:

  • SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER โ€” the GLuint texture associated with the texture
  • SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER โ€” the GLuint texture associated with the UV plane of an NV12 texture
  • SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER โ€” the GLuint texture associated with the U plane of a YUV texture
  • SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER โ€” the GLuint texture associated with the V plane of a YUV texture
  • SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER โ€” the GLenum for the texture target (GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB, etc)
  • SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT โ€” the texture coordinate width of the texture (0.0 - 1.0)
  • SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT โ€” the texture coordinate height of the texture (0.0 - 1.0)

๐ŸŒธ with the opengles2 renderer:

  • SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER โ€” the GLuint texture associated with the texture
  • SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER โ€” the GLuint texture associated with the UV plane of an NV12 texture
  • SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER โ€” the GLuint texture associated with the U plane of a YUV texture
  • SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER โ€” the GLuint texture associated with the V plane of a YUV texture
  • SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER โ€” the GLenum for the texture target (GL_TEXTURE_2D, GL_TEXTURE_EXTERNAL_OES, etc)

๐Ÿซถ with the gpu renderer:

  • SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER โ€” the SDL_GPUTexture associated with the texture
  • SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER โ€” the SDL_GPUTexture associated with the UV plane of an NV12 texture
  • SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER โ€” the SDL_GPUTexture associated with the U plane of a YUV texture
  • SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER โ€” the SDL_GPUTexture associated with the V plane of a YUV texture

๐ŸŽ€ FUNCTION PARAMETERS ๐ŸŽ€

  • texture โ€” the texture to query. like, the one you're asking about. ๐Ÿซถ

๐Ÿ‘‘ RETURN VALUE ๐Ÿ‘‘

Returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information. so if you get a 0, bestie, go read the error, it's literally right there. ๐Ÿ˜ญ


๐Ÿงš THREAD SAFETY ๐Ÿงš

It is safe to call this function from any thread. yes queen, thread-safe, no notes. ๐Ÿ”ฅ


โญ AVAILABILITY โญ

This function is available since SDL 3.2.0. she's not ancient, she's fresh. ๐Ÿ’œ


and that's the whole page!! this one comes to you from Simple Directmedia Layer, running the SDL 3.4.18 era of the docs, and the page itself is dated SDL_GetTextureProperties(3). mwah, take care of your textures bestie ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from