SDL_ttf rendering

Hi,
I’m developing an application which shows Video in real time and I need to render text into screen.
I’m using SDL_DisplayYUVOverlay to draw YUV420 image on the screen and I’m able to render text into it using SDL_BlitSurface function.
The problem is that TEXT is blinking on the screen due to high refresh FPS (Video is in real time).
I’m seeking something similar to SDL_BlitSurface which could be able to render on SDL_Overlay rather SDL_Surface so I can use DisplayYUVOverlay to show an image where text and image are mixed togheter.

Browsing WEB I have found http://www.libsdl.org/projects/sdlyuvaddon/ that tell me to convert the font surface to YUV and render them into
the overlay data (YUV Image) before handing it to SDL but I’m not able to understand how I can make it

Every answer is appreciated

Thanks

Any suggestion?

2009/9/30 foursoftware :

Any suggestion?

Are you sure it isn’t blinking because of double buffering instead?
As in, you’re rendering text to the same buffer every time, but SDL or
your own code is switching which one is displayed on every frame.

…or it could be a silly mistake like calling SDL_Flip() more than
once per frame.

Jonny DOn Wed, Sep 30, 2009 at 8:48 AM, Kenneth Bull wrote:

2009/9/30 foursoftware :

Any suggestion?

Are you sure it isn’t blinking because of double buffering instead?
As in, you’re rendering text to the same buffer every time, but SDL or
your own code is switching which one is displayed on every frame.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi,
thanks for your kind attention.

I don’t know where SDL call SDL_Flip internally … this is my code

    for(i=0;i<200;i++){

            if(get_image())
                    SDL_DisplayYUVOverlay(bmp, &rect);
            SDL_BlitSurface(text, NULL, screen, NULL);

    SDL_Delay(FRAME_DELAY);
    }

Where get_image() read a YUV image from PIPE and put it into bmp ( bmp mede with SDL_CreateYUVOverlay(wid, hei , SDL_YV12_OVERLAY, screen) )
and text is the font surface.

Thanks

Jonny D wrote:> …or it could be a silly mistake like calling SDL_Flip() more than

once per frame.

Jonny D

On Wed, Sep 30, 2009 at 8:48 AM, Kenneth Bull wrote:

2009/9/30 foursoftware <@foursoftware>:

Any suggestion?

Are you sure it isn’t blinking because of double buffering instead?
As in, you’re rendering text to the same buffer every time, but SDL or
your own code is switching which one is displayed on every frame.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello !

I don’t know where SDL call SDL_Flip internally … this is my code

You have to call SDL_Flip in your code manually,
as SDL can not guess when you are finished with your
actual frame updates.

CU

Yep, a decent place would be right after your call to SDL_BlitSurface:
SDL_Flip(screen);

Jonny DOn Wed, Sep 30, 2009 at 2:39 PM, Torsten Giebl wrote:

Hello !

I don’t know where SDL call SDL_Flip internally … this is my code

You have to call SDL_Flip in your code manually,
as SDL can not guess when you are finished with your
actual frame updates.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ooh, except that I don’t fully understand your loop there.

Jonny DOn Wed, Sep 30, 2009 at 4:24 PM, Jonathan Dearborn <@Jonathan_Dearborn> wrote:

Yep, a decent place would be right after your call to SDL_BlitSurface:
SDL_Flip(screen);

Jonny D

On Wed, Sep 30, 2009 at 2:39 PM, Torsten Giebl wrote:

Hello !

I don’t know where SDL call SDL_Flip internally … this is my code

You have to call SDL_Flip in your code manually,
as SDL can not guess when you are finished with your
actual frame updates.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello,
I’d like to render on the screen YUV image and font simultaneously but in my FOR(;:wink: I use SDL_DIsplayYUVOverlay() and SDL_BlitSurface() all functions that performe render on the screen so I got blinking due to double refresh every FPS delay.
I have to call SDL_DIsplayYUVOverlay to render image and I need to call SDL_BlitSurface to display text. Is there any workaround that allow me to refresh video screen only after I really got YUV and text components ready?

Thanks

Jonny D wrote:> Ooh, except that I don’t fully understand your loop there.

Jonny D

On Wed, Sep 30, 2009 at 4:24 PM, Jonathan Dearborn wrote:

Yep, a decent place would be right after your call to SDL_BlitSurface:
SDL_Flip(screen);

Jonny D

On Wed, Sep 30, 2009 at 2:39 PM, Torsten Giebl wrote:

Hello !

I don’t know where SDL call SDL_Flip internally … this is my code

You have to call SDL_Flip in your code manually,
as SDL can not guess when you are finished with your
actual frame updates.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

foursoftware wrote:

Hello,
I’d like to render on the screen YUV image and font simultaneously but in my FOR(;:wink: I use SDL_DIsplayYUVOverlay() and SDL_BlitSurface() all functions that performe render on the screen so I got blinking due to double refresh every FPS delay.
I have to call SDL_DIsplayYUVOverlay to render image and I need to call SDL_BlitSurface to display text. Is there any workaround that allow me to refresh video screen only after I really got YUV and text components ready?

No, the only way to really do that is to do the YUV and RGB rendering into an offscreen buffer and blit the combined image to the screen.

Hi,
Ok I solved using user space YUV420 buffer passing it to function that overlay text and the result image copied to SDL_Overlay buffers.

Sam Lantinga wrote:>

foursoftware wrote:

Hello,
I’d like to render on the screen YUV image and font simultaneously but in my FOR(;:wink: I use SDL_DIsplayYUVOverlay() and SDL_BlitSurface() all functions that performe render on the screen so I got blinking due to double refresh every FPS delay.
I have to call SDL_DIsplayYUVOverlay to render image and I need to call SDL_BlitSurface to display text. Is there any workaround that allow me to refresh video screen only after I really got YUV and text components ready?

No, the only way to really do that is to do the YUV and RGB rendering into an offscreen buffer and blit the combined image to the screen.