Hi there!
I would like to create my textures and other objects in another thread (i.e, a thread that is not the same thread as I’m creating the window in).
For example, I have a state machine containing a menu state and a game state. Whenever I switch from the menu state to the game state I would like to create a thread which creates the textures and other objects for the game and while these objects is being created, I would like to have a loading screen which is rendering a texture or some text saying ‘Loading…’ (not important how the loading screen looks right now). As soon as the game is created (i.e, all the game objects has been successfully created), the loading screen stop rendering and the game state is rendered.
How can I achieve this with SDL2?
I’ve heard that CreateTexture and such shouldn’t be executed in a thread that is not the main thread. Is this true?