---
name: "SDL_CreateTextureWithProperties"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CreateTextureWithProperties"
---

# SDL\_CreateTextureWithProperties(3)

Create a texture for a rendering context with the specified properties.

## NAME

SDL\_CreateTextureWithProperties - Create a texture for a rendering context with the specified properties.

## HEADER FILE

Defined in SDL3/SDL\_render.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Texture \* SDL\_CreateTextureWithProperties(SDL\_Renderer \*renderer, SDL\_PropertiesID props);**

## DESCRIPTION

These are the supported properties:

•  **SDL\_PROP\_TEXTURE\_CREATE\_COLORSPACE\_NUMBER** :\
   an  **SDL\_Colorspace**\
  value describing the texture\
   colorspace, defaults to

**SDL\_COLORSPACE\_SRGB\_LINEAR**\
  for floating\
   point textures,  **SDL\_COLORSPACE\_HDR10**\
  for 10-bit\
   textures,  **SDL\_COLORSPACE\_SRGB**\
  for other RGB\
   textures and  **SDL\_COLORSPACE\_JPEG**\
  for YUV textures.

•  **SDL\_PROP\_TEXTURE\_CREATE\_FORMAT\_NUMBER** :\
   one of the enumerated values in  **SDL\_PixelFormat** ,\
   defaults to the best RGBA format for the renderer

•  **SDL\_PROP\_TEXTURE\_CREATE\_ACCESS\_NUMBER** :\
   one of the enumerated values in  **SDL\_TextureAccess** ,\
   defaults to  **SDL\_TEXTUREACCESS\_STATIC**

•  **SDL\_PROP\_TEXTURE\_CREATE\_WIDTH\_NUMBER** :\
   the width of the texture in pixels, required

•  **SDL\_PROP\_TEXTURE\_CREATE\_HEIGHT\_NUMBER** :\
   the height of the texture in pixels, required

•  **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. This defaults to 100 for HDR10 textures and 1.0 for\
   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 to maxCLL /

**SDL\_PROP\_TEXTURE\_CREATE\_SDR\_WHITE\_POINT\_FLOAT**

  for 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.

With the direct3d11 renderer:

•  **SDL\_PROP\_TEXTURE\_CREATE\_D3D11\_TEXTURE\_POINTER** :\
   the ID3D11Texture2D associated with the texture, if you want to wrap an\
   existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_D3D11\_TEXTURE\_U\_POINTER** :\
   the ID3D11Texture2D associated with the U plane of a YUV texture, if you\
   want to wrap an existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_D3D11\_TEXTURE\_V\_POINTER** :\
   the ID3D11Texture2D associated 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** :\
   the ID3D12Resource associated with the texture, if you want to wrap an\
   existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_D3D12\_TEXTURE\_U\_POINTER** :\
   the ID3D12Resource associated with the U plane of a YUV texture, if you\
   want to wrap an existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_D3D12\_TEXTURE\_V\_POINTER** :\
   the ID3D12Resource associated 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** :\
   the CVPixelBufferRef associated 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** :\
   the GLuint texture associated with the texture, if you want to wrap an\
   existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_OPENGL\_TEXTURE\_UV\_NUMBER** :\
   the GLuint texture 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** :\
   the GLuint texture 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** :\
   the GLuint texture 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** :\
   the GLuint texture associated with the texture, if you want to wrap an\
   existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_OPENGLES2\_TEXTURE\_NUMBER** :\
   the GLuint texture associated with the texture, if you want to wrap an\
   existing texture.

•  **SDL\_PROP\_TEXTURE\_CREATE\_OPENGLES2\_TEXTURE\_UV\_NUMBER** :\
   the GLuint texture 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** :\
   the GLuint texture 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** :\
   the GLuint texture 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** :\
   the VkImage with layout VK\_IMAGE\_LAYOUT\_SHADER\_READ\_ONLY\_OPTIMAL\
   associated with the texture, if you want to wrap an existing texture.

## FUNCTION PARAMETERS

- *renderer*

  the rendering context.

- *props*

  the properties to use.

## RETURN VALUE

( **SDL\_Texture**\
  \*) Returns the created texture or NULL on failure; call  **SDL\_GetError** () for more information.

## THREAD SAFETY

This function should only be called on the main thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_CreateProperties**(3)](/SDL_CreateProperties/3.md), **•**(3), [**SDL\_CreateTexture**(3)](/SDL_CreateTexture/3.md), **•**(3), [**SDL\_CreateTextureFromSurface**(3)](/SDL_CreateTextureFromSurface/3.md), **•**(3), [**SDL\_DestroyTexture**(3)](/SDL_DestroyTexture/3.md), **•**(3), [**SDL\_GetTextureSize**(3)](/SDL_GetTextureSize/3.md), **•**(3), [**SDL\_UpdateTexture**(3)](/SDL_UpdateTexture/3.md)
