As far as I can tell the 2.0.14 SDL_TTF API render calls only return an SDL_Surface type. The underlying code would need to be modified to return an SDL_Texture.
If you really know what you’re doing you can download the source code and make new versions of these that return an SDL_texture and re-compile.
It sounds like he just wants a wrapper that does the work already.
Check out SDL_FontCache, one of my libraries:
Jonny DOn Thu, Apr 7, 2016 at 10:44 AM, jsalina <jared.salina at gmail.com> wrote:
As far as I can tell the 2.0.14 SDL_TTF API render calls only return an
SDL_Surface type. The underlying code would need to be modified to return
an SDL_Texture.
If you really know what you’re doing you can download the source code and
make new versions of these that return an SDL_texture and re-compile.
I think a bigger question needs to be asked; what are you hoping to achieve
by rendering to anything but SDL_Surface*? If this is for some sort of
optimization on your render calls, you might want to look into caching
surfaces/textures so you’re not building them from scratch each loop.On Thu, Apr 7, 2016 at 10:52 AM, jsalina <jared.salina at gmail.com> wrote:
FYI - I always use this to convert the surface to texture before
rendering. I haven’t found a quicker way short of what I described above.
I haven’t test this, but I created a small library to manage caching text
generated by TTF_RenderUTF8 called TextCache https://gist.github.com/mrozbarry/78282fdc0e855cf5a5b0c88ece352140. It
does do some automation to convert the surface to a texture, and might
achieve what you’re after.On Thu, Apr 7, 2016 at 11:34 AM, Alex Barry <@Alex_Barry> wrote:
I think a bigger question needs to be asked; what are you hoping to
achieve by rendering to anything but SDL_Surface*? If this is for some
sort of optimization on your render calls, you might want to look into
caching surfaces/textures so you’re not building them from scratch each
loop.
On Thu, Apr 7, 2016 at 10:52 AM, jsalina <jared.salina at gmail.com> wrote:
FYI - I always use this to convert the surface to texture before
rendering. I haven’t found a quicker way short of what I described above.