Difference between surface and texture (SDL / general)

前端 未结 4 1169
旧巷少年郎
旧巷少年郎 2020-12-02 07:33

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_Tex

4条回答
  •  遥遥无期
    2020-12-02 08:07

    There is more information about that in:

    https://thenumbat.github.io/cpp-course/sdl2/05/05.html

    As mentioned in the last lesson, textures are the GPU rendering equivalent of surfaces. Hence, textures are almost always created from surfaces, using the function SDL_CreateTextureFromSurface(). This function more or less does what you'd expect—the parameters are the rendering context and a surface to create the texture from. As with other creation functions, it will return NULL on failure.

    I hope it helps you!

提交回复
热议问题