grimfang4 / sdl-gpu

A library for high-performance, modern 2D graphics with SDL written in C.
MIT License
1.18k stars 123 forks source link

hello, is sdl2 compatible with SDL_GPU? #247

Open joyrax-dev opened 1 year ago

joyrax-dev commented 1 year ago

hello, is sdl2 compatible with SDL_GPU? For example, were I able to convert texture from sdl2 to image SDL_GPU and vice versa? I still do not understand what and how is mutually replaced

MonsieurBleu commented 1 year ago

Hello, you have multiple ways to convert SDL_Surface to GPU_Image or GPU_Targets.

Exemples of this by copy can be found in the wiki : https://grimfang4.github.io/sdl-gpu/group__Conversions.html

You can even load & save SDL surfaces from/into files with all the formats supported by SDL_GPU using : https://grimfang4.github.io/sdl-gpu/group__SurfaceControls.html

From this you can convert your SDL_Surface to an SDL_Texture if you want, or going the opposite way from SDL_Texture to GPU_Image or GPU_Target.