Hello everyone,
I am trying to stitch together a couple of surfaces created with TTF into a bigger surface which I want to then render.
The TTF Surfaces work correctly and can be rendered with the text. However, when trying to blit them together I have no output at all. Either the Surface is completely black (When setting the Blend mode to SDL_BLENDMODE_NONE) or white when not changing the blendmode after ttf creates the surface.
SDL_Surface *WholeSurface = SDL_CreateRGBSurface(0,RendertargetBig.w,RendertargetBig.h,8,0,0,0,0);
SDL_Rect blitrect = {0,0,15,16};
SDL_Color writecolor = {30,0,0,255}; //create color for text
SDL_Surface *text_surface = TTF_RenderUTF8_Blended(Maincontext.font,"test", writecolor);//create text surface
blitrect.y = 0;
blitrect.x = 0;
blitrect.w = text_surface->w;
blitrect.h = text_surface->h;
//SDL_SetSurfaceBlendMode(text_surface,SDL_BLENDMODE_NONE);
int blit_success = SDL_BlitSurface(text_surface,NULL,WholeSurface, &blitrect);
SDL_Texture *mTexture = SDL_CreateTextureFromSurface(Maincontext.renderer,text_surface);
SDL_RenderSetViewport(Maincontext.renderer,NULL);
SDL_RenderCopy(Maincontext.renderer,mTexture,NULL,&RendertargetBig);
The “text_surface” is a 32 bit ARGB-Surface per ttf documentation. I am thinking it has something to do with me not understanding blitting and the pixel formats correctly but so far this eludes me.