The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_ttf and SDL_gfx in SDL 2
wahono sri
Guest

Hi all,
I'm new user of SDL, and before start using SDL, I have some question
to ensure the features as I hope.

- Is SDL_ttf and SDL_gfx is compatible with SDL 2?
- Is SDL_ttf and SDL_gfx use hardware rendering because as I read in
http://wiki.libsdl.org/moin.cgi/MigrationGuide, only using textures
will use hardware rendered, and SDL_ttf/SDL_gfx use surfaces to
drawing?

Thanks in advance.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_ttf and SDL_gfx in SDL 2
Andreas Schiffler
Guest

SDL_gfx is not compatible with SDL2. It works fine with SDL-1.2 but does
for the most part not leverage any hardware acceleration.
--Andreas

On 8/17/2012 8:25 PM, wahono sri wrote:
Quote:
Hi all,
I'm new user of SDL, and before start using SDL, I have some question
to ensure the features as I hope.

- Is SDL_ttf and SDL_gfx is compatible with SDL 2?
- Is SDL_ttf and SDL_gfx use hardware rendering because as I read in
http://wiki.libsdl.org/moin.cgi/MigrationGuide, only using textures
will use hardware rendered, and SDL_ttf/SDL_gfx use surfaces to
drawing?

Thanks in advance.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SDL_ttf and SDL_gfx in SDL 2
stevo5800


Joined: 30 Jun 2012
Posts: 49
SDL_ttf is compatible you might need to download it from Mercurial to get the latest. Everything is pretty much the same you just need to convert the SDL_Surface to SDL_Texture with

example:

SDL_Texture *textTexture
char buf[256]
SDL_Color foregroundColor = { 255, 255, 255 };
SDL_Color backgroundColor = { 0, 0, 0 };
SDL_Rect TextLoacation;


snprintf(buf,256,"TESTING");
SDL_Surface *textSurface= TTF_RenderText_Shaded(font, buf,
foregroundColor, backgroundColor);

if(textSurface)
{
textTexture = SDL_CreateTextureFromSurface(renderer, textSurface);
TextLocation.h = textSurface->h;
TextLocation.w = textSurface->w;
TextLocation.x = 100;
TextLocation.y = 100;
}

//free surface
SDL_FreeSurface(textSurface);

SDL_RenderCopy(renderer, textTexture, NULL, TextLocation);

wahono sri wrote:
Hi all,
I'm new user of SDL, and before start using SDL, I have some question
to ensure the features as I hope.

- Is SDL_ttf and SDL_gfx is compatible with SDL 2?
- Is SDL_ttf and SDL_gfx use hardware rendering because as I read in
http://wiki.libsdl.org/moin.cgi/MigrationGuide, only using textures
will use hardware rendered, and SDL_ttf/SDL_gfx use surfaces to
drawing?

Thanks in advance.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_ttf and SDL_gfx in SDL 2
MrOzBarry


Joined: 26 Jun 2010
Posts: 620
You'll have to do a custom compile of SDL_ttf with SDL2 installed - in my case (without SDL 1.2 installed in mingw, which should be roughly the same on linux), it was literally me doing an hg clone of SDL2, ./configure && make && sudo make install, then going into SDL2, ./configure (confirm that it does get SDL2 in there) && make && sudo make install

Note that instead of building SDL_ttf, with SDL2 it will build SDL2_ttf - I am assuming that this is the general naming convention that Sam would like to see with other SDL contrib. libraries (compatible with SDL 1.2 = SDL_*, SDL2 = SDL2_*)


As far as I'm aware, SDL_gfx needs to be updated to deal with SDL2 properly - Andreas mentioned in another thread that he's planning on working on an SDL2-compatible version.


Take care,
-Alex

On Sat, Aug 18, 2012 at 4:06 AM, stevo5800 wrote:
Quote:
SDK_ttf is compatible you might need to download it from Mercurial to get the latest. Everything is pretty much the same you just need to convert the SDL_Surface to SDL_Texture with

example:

char buf[256]
SDL_Color foregroundColor = { 255, 255, 255 };
SDL_Color backgroundColor = { 0, 0, 0 };
SDL_Rect TextLoacation;


snprintf(buf,256,"TESTING");
SDL_Surface *textSurface= TTF_RenderText_Shaded(font, buf,
foregroundColor, backgroundColor);

if(testSurface)
{
temp_texture = SDL_CreateTextureFromSurface(renderer, textSurface);
TextLocation.h = textSurface->h;
TextLocation.w = textSurface->w;
TextLocation.x = 100;
TextLocation.y = 100;
}




wahono sri wrote:

Hi all,
I'm new user of SDL, and before start using SDL, I have some question
to ensure the features as I hope.

- Is SDL_ttf and SDL_gfx is compatible with SDL 2?
- Is SDL_ttf and SDL_gfx use hardware rendering because as I read in
http://wiki.libsdl.org/moin.cgi/MigrationGuide, only using textures
will use hardware rendered, and SDL_ttf/SDL_gfx use surfaces to
drawing?

Thanks in advance.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL_ttf and SDL_gfx in SDL 2
wahono


Joined: 18 Aug 2012
Posts: 37
Hmm, I think SDL 2 is in heavy progress about hardware acceleration, and others SDL tools need to be upgrade to SDL 2 with same way. I'm in doubt about switching from surfaces to textures to speed up acceleration using new renderer in SDL 2.

What about cairo? Is cairo can use sdl as backend. If yes, cairo can be simplified sdl_ttf and sdl_gfx in one library only.


Thanks for all responses
SDL_ttf and SDL_gfx in SDL 2
Jonny D


Joined: 12 Sep 2009
Posts: 932
Cairo is fundamentally different than SDL_gfx and certainly more complicated than the combination of SDL_gfx and SDL_ttf.  It's vector-based rather than raster-based.  It does work with SDL with a little effort.  In my experience, performance is not great, but if you use a OpenGL/SDL2 backend, it is probably a lot better.

Jonny D