For anyone that sees this in the future: the situation is now completely different.
SDL 2.0.17 has added a SDL_RenderGeometry function which makes it possible to use the SDL_Renderer for all rendering instead of requiring OpenGL directly.
TGUI 0.10-dev now also has an SDL_RENDERER backend which makes use of this functionality. A CanvasSDL class has just been added to this backend to which you could draw SDL_Texture objects:
SDL 2.0.17 has added a SDL_RenderGeometry function which makes it possible to use the SDL_Renderer for all rendering instead of requiring OpenGL directly.
TGUI 0.10-dev now also has an SDL_RENDERER backend which makes use of this functionality. A CanvasSDL class has just been added to this backend to which you could draw SDL_Texture objects:
Code (cpp) Select
SDL_Texture* imgTexture; // The image to render to the canvas
auto canvas = tgui::CanvasSDL::create({400, 300});
SDL_SetRenderTarget(renderer, canvas->getTextureTarget()); // Let drawing happen on the canvas instead of the window
SDL_RenderClear(renderer); // Clear the contents of the canvas
SDL_RenderCopy(renderer, imgTexture, NULL, NULL); // Draw an image to the canvas
SDL_SetRenderTarget(renderer, nullptr); // Let further drawing happen on the window again