Basically I'm trying to end up with a Texture class that can take in text and have it be drawn over simple geometry (such as a letter 'A' over a filled rectangle). However I'm running into issues when thinking about how to combine these two concepts.
First, following lazy foo's tutorials, Geometry rendering is simple and is done with an
SDL_RECT and SDL_RenderFillRect(SDL_Renderer*, &SDL_Rect);
However, when rendering text it uses Surfaces and Textures in order to 'draw' the text. Specifically these lines:
SDL_Surface* textSurface = TTF_RenderText_Solid( gFont, textureText.c_str(), textColor ); mTexture = SDL_CreateTextureFromSurface( SDL_Renderer*, textSurface );
My confusing comes from trying to figure out several things:
a) Is it possible to maybe first Render the Geometry to a texture, and then render the text over that same texture?
b) I believe a call to SDL_SetRenderTarget is going to be necessary, but I'm not sure where and when during my combination stage this would need to be done.
c) Right before posting this question, I saw further down on the tutorials this link which describes rendering geometry to a texture, however I'm still not sure how to combine Text with this.
Any help is appreciated, Thanks