This is new wiki software and old wiki content. It's a work in progress!
Here's the explanation.
Be gentle, report bugs, leave feedback on pages, or just edit them yourself! Thanks!

SDL Wiki


Update the given texture rectangle with new pixel data.


int SDL_UpdateTexture(SDL_Texture * texture,
                      const SDL_Rect * rect,
                      const void *pixels, int pitch);

Function Parameters


the texture to update


an SDL_Rect structure representing the area to update, or NULL to update the entire texture


the raw pixel data in the format of the texture


the number of bytes in a row of pixel data, including padding between lines

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.


The pixel data must be in the pixel format of the texture. Use SDL_QueryTexture() to query the pixel format of the texture.

This is a fairly slow function, intended for use with static textures that do not change often.

If the texture is intended to be updated often, it is preferred to create the texture as streaming and use the locking functions referenced below. While this function will work with streaming textures, for optimization reasons you may not get the pixels back if you lock the texture afterward.


CategoryAPI, CategoryRender

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