change f->BitsPerPixel to the number 24 then it should work just tested and it came out alright with that change
raine wrote:> When I create a text using SDL2_ttf this way, the resulting texture renders okay
surface = TTF_RenderUTF8_Blended(font, str, color);
texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_RenderCopy(renderer, texture, 0, &rc);
However, when I try to render this new_texture, I get nothing on the screen
f = surface->format;
new_surface = SDL_CreateRGBSurface(0, surface->w, surface->h, f->BitsPerPixel, f->Rmask, f->Gmask, f->Bmask, f->Amask);
SDL_BlitSurface(surface, 0, new_surface, 0);
new_texture = SDL_CreateTextureFromSurface(renderer, new_surface);
SDL_RenderCopy(renderer, new_texture, 0, &rc);
However, out.bmp file does have the text printed properly.
What is wrong here?