---
name: "SDL_CreateTexture"
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_CreateTexture"
---

# SDL\_CreateTexture(3)

Create a texture for a rendering context.

## NAME

SDL\_CreateTexture - Create a texture for a rendering context.

## HEADER FILE

Defined in SDL3/SDL\_render.h

## SYNOPSIS

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

**SDL\_Texture \* SDL\_CreateTexture(SDL\_Renderer \*renderer, SDL\_PixelFormat format, SDL\_TextureAccess access, int w, int h);**

## DESCRIPTION

The contents of a texture when first created are not defined.

## FUNCTION PARAMETERS

- *renderer*

  the rendering context.

- *format*

  one of the enumerated values in  **SDL\_PixelFormat** .

- *access*

  one of the enumerated values in  **SDL\_TextureAccess** .

- *w*

  the width of the texture in pixels.

- *h*

  the height of the texture in pixels.

## 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\_CreateTextureFromSurface**(3)](/SDL_CreateTextureFromSurface/3.md), **•**(3), [**SDL\_CreateTextureWithProperties**(3)](/SDL_CreateTextureWithProperties/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)
