[SDL] <DKIM> Strange artefacts on SDL text backgrounds

Sagara Wijetunga sagarawmw at yahoo.com
Sat Sep 6 03:01:01 PDT 2014


How do use SDL2_ttf is as follows:

1. Method A
surface = TTF_RenderUTF8_Blended(font, "Text", colour);
texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_RenderCopy(..texture..);

No issue.

2. Method B
surfaceOrig = TTF_RenderUTF8_Blended(fontTitle, "Text", colour);
textureOrig = SDL_CreateTextureFromSurface(renderer, surfaceOrig);

textureScaled = SDL_CreateTexture(renderer, pixFormatOrig, SDL_TEXTUREACCESS_TARGET, w, h);
SDL_SetRenderTarget(renderer, textureScaled);
SDL_RenderCopy(renderer, textureOrig, NULL, NULL)
SDL_SetRenderTarget(renderer, NULL);
SDL_RenderCopy(..textureScaled..);

Only in this path I have issues.

Note 1, test program for Method B does not show any issue.

Note 2, texture returned from SDL_CreateTexture() is not validated in any way other than for a valid pointer. If necessary to validate, what should I do? 

Thanks.

Sagara
 
On Saturday, September 6, 2014 11:57 AM, Sanette <sanette-linux at laposte.net> wrote:
 


how do you render your ttf ?
usually SDL_tt will generate a surface, and then you either render
      the surface onscreen, or to a target texture which is then
      rendered onscreen.
In the latter case, did you check that your target texture was
      initialized (filled) with zeros ?


1. Method A
surface = TTF_RenderUTF8_Blended(font, "Text", colour);
texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_RenderCopy(..texture..);

No issue.

2. Method B
surfaceOrig = TTF_RenderUTF8_Blended(fontTitle, "Text", colour);
textureOrig = SDL_CreateTextureFromSurface(renderer, surfaceOrig);

textureScaled = SDL_CreateTexture(renderer, pixFormatOrig, SDL_TEXTUREACCESS_TARGET, w, h);
SDL_SetRenderTarget(renderer, textureScaled);
SDL_RenderCopy(renderer, textureOrig, NULL, NULL)
SDL_SetRenderTarget(renderer, NULL);
SDL_RenderCopy(..textureScaled..);

Only in this path I have issues.

>
>
>
>_______________________________________________
SDL mailing list SDL at lists.libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140906/b5c2fb03/attachment-0002.htm>


More information about the SDL mailing list