I’m trying to display a message on the screen with TTF_RenderText_Solid on windows xp.
I’m playing a video file using SDL and that works fine. I’m also drawing some lines on top
of the video and that works but I don’t see any text. I’m using sdl_ttf 2.0.8 and sdl 1.2.11.
I’ve checked all of the return values and everything looks ok, I think.
Can someone tell me what could be wrong or how to find out what isn’t working that causes no display?
Here is what I’m doing:
int flags, w, h;
SDL_Surface *screen;
SDL_Rect dest = { 50, 50, 200, 30 };
flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE;
w = 1200
h = 800
screen = SDL_SetVideoMode(w, h, 0, flags);
SDL_Color textColor = { 255, 0, 0 };
TTF_Font *fnt = TTF_OpenFont( “c:\windows\fonts\arial.ttf”, 20 );
strcpy(str, “Hello”);
message = TTF_RenderText_Solid(fnt, str, textColor);
int status = SDL_BlitSurface( message, NULL, screen, &dest );
// no error, but no text
thanks,
Bob
After SDL_BlitSurface() I added:
SDL_Flip(screen);
I neglected to list this line earlier:
SDL_DisplayYUVOverlay(vp->bmp, &rect);
After adding the SDL_Flip() line I now see the text, but it is blinking (or
tearing). How can I get a smooth text display?
BobOn Mon, Jul 16, 2007 at 02:35:46PM -0400, Bob Self wrote:
I’m trying to display a message on the screen with TTF_RenderText_Solid on windows xp.
I’m playing a video file using SDL and that works fine. I’m also drawing some lines on top
of the video and that works but I don’t see any text. I’m using sdl_ttf 2.0.8 and sdl 1.2.11.
I’ve checked all of the return values and everything looks ok, I think.
Can someone tell me what could be wrong or how to find out what isn’t working that causes no display?
Here is what I’m doing:
int flags, w, h;
SDL_Surface *screen;
SDL_Rect dest = { 50, 50, 200, 30 };
flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE;
w = 1200
h = 800
screen = SDL_SetVideoMode(w, h, 0, flags);
SDL_Color textColor = { 255, 0, 0 };
TTF_Font *fnt = TTF_OpenFont( “c:\windows\fonts\arial.ttf”, 20 );
strcpy(str, “Hello”);
message = TTF_RenderText_Solid(fnt, str, textColor);
int status = SDL_BlitSurface( message, NULL, screen, &dest );
Bob Self wrote:> On Mon, Jul 16, 2007 at 02:35:46PM -0400, Bob Self wrote:
I’m trying to display a message on the screen with TTF_RenderText_Solid on windows xp.
I’m playing a video file using SDL and that works fine. I’m also drawing some lines on top
of the video and that works but I don’t see any text. I’m using sdl_ttf 2.0.8 and sdl 1.2.11.
I’ve checked all of the return values and everything looks ok, I think.
Can someone tell me what could be wrong or how to find out what isn’t working that causes no display?
Here is what I’m doing:
int flags, w, h;
SDL_Surface *screen;
SDL_Rect dest = { 50, 50, 200, 30 };
flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE;
w = 1200
h = 800
screen = SDL_SetVideoMode(w, h, 0, flags);
SDL_Color textColor = { 255, 0, 0 };
TTF_Font *fnt = TTF_OpenFont( “c:\windows\fonts\arial.ttf”, 20 );
strcpy(str, “Hello”);
message = TTF_RenderText_Solid(fnt, str, textColor);
int status = SDL_BlitSurface( message, NULL, screen, &dest );
After SDL_BlitSurface() I added:
SDL_Flip(screen);
I neglected to list this line earlier:
SDL_DisplayYUVOverlay(vp->bmp, &rect);
After adding the SDL_Flip() line I now see the text, but it is blinking (or
tearing). How can I get a smooth text display?
Bob
I’m dealing with largely the same issue. I’ve tried using a secondary
SDL_Surface for the YUVOverlay, and blitting it on to the screen
SDL_Surface. This lets me draw my other surfaces over the video frame
without flicker, but it’s very slow and I end up dropping a lot of
frames in the process.
Does anyone know of a clean way to blit extra SDL_Surfaces to the
surface attached to a YUVOverlay before it updates?
Hello !
Are you using a YUV Overlay to play your video ?
CU
Yes, see my follow up post above.
BobOn Tue, Jul 17, 2007 at 02:24:28PM +0200, Torsten Giebl wrote:
Hello !
Are you using a YUV Overlay to play your video ?
CU
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bob Self wrote:
flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE;
After SDL_BlitSurface() I added:
SDL_Flip(screen);
I neglected to list this line earlier:
SDL_DisplayYUVOverlay(vp->bmp, &rect);
After adding the SDL_Flip() line I now see the text, but it is blinking (or
tearing). How can I get a smooth text display?
Bob
I’ve noticed that with similar flags to yours, I don’t actually get a
hardware surface, according the flags in the SDL_Surface struct. Are you?