SDL Wiki
(This is the legacy documentation for stable SDL2, the current stable version; SDL3 is the current development version.)

SDL_CreateTexture

Create a texture for a rendering context.

Syntax

SDL_Texture * SDL_CreateTexture(SDL_Renderer * renderer,
                                Uint32 format,
                                int access, int w,
                                int h);

Function Parameters

renderer

the rendering context

format

one of the enumerated values in SDL_PixelFormatEnum

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

Returns a pointer to the created texture or NULL if no rendering context was active, the format was unsupported, or the width or height were out of range; call SDL_GetError() for more information.

Remarks

You can set the texture scaling method by setting SDL_HINT_RENDER_SCALE_QUALITY before creating the texture.

Version

This function is available since SDL 2.0.0.

SDL_CreateTextureFromSurface
SDL_DestroyTexture
SDL_QueryTexture
SDL_UpdateTexture

CategoryAPI


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.