I’m transferring the contents of a SDL target texture (onto which I’ve drawn using SDL_RenderCopy()
etc.) into an OpenGL texture (so I can render it in a 3D world); this is achieved by using SDL_RenderReadPixels()
to get the contents of the SDL texture as a bitmap and glTexImage2D()
to move it into the 3D context.
This works surprisingly well; I was concerned that it would be very slow (the SDL_RenderReadPixels()
docs warn about this) but on Windows at least it’s acceptable. However since both textures are presumably under the control of the GPU I can’t help wondering if there is a better way. Is there?