I would like to render a 3D scene to a SDL_Texture
I've tried SDL_GL_BindTexture, but the scene is still rendered to the window, and the texture remains empty.
The code is:
SDL_GL_BindTexture(gTexture, NULL, NULL);
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_UnbindTexture(gTexture);
SDL_Rect renderQuad = { 100, 100, 200, 200 };
SDL_SetRenderTarget( gRenderer, NULL );
SDL_RenderCopy( gRenderer, gTexture, NULL, &renderQuad );
SDL_RenderPresent( gRenderer );
This is the result:

