Can anyone explain to me in simple words what is the difference between texture and surface? I saw it used in SDL2
as SDL_Surface
and SDL_Texture
. SDL_Texture
is created from SDL_Surface
which in turn is created from image/bitmap. Both are collection of pixels. But I do not see the main difference between them (has to do something with GPU?)
I tried to google it but all explanations I found were too complex to understand them without digging deeper into computer graphics stuff.
SDL_Texture
andSDL_Surface
as well asSDL_Renderer
. In general,SDL_Texture
is what is used for rendering, but when you load texture information usingSDL_Image
orSDL_ttf
, you'll get the data as anSDL_Surface
– SudduthSDL_Surface
is just a collection of pixels whileSDL_Texture
isan efficient, driver-specific representation of pixel data
meaning it can be used by the GPU wiki.libsdl.org/SDL_Texture. Did that answer your question? You really should dig deeper into computer graphics to understand more – Sudduth