[SDL] RenderCopy + rotations: sdl_gfx or OpenGL?

William Dyce wilbefast at gmail.com
Sun Jul 31 23:37:17 PDT 2011


Well that explains it: I thought SDL_gfx supported hardware acceleration. If
it doesn't then it's probably not the best solution for what I'm doing. It
still gets me that even phones have a GPU these days...

On 1 August 2011 16:30, Mārtiņš Možeiko <martins.mozeiko at gmail.com> wrote:

> You can not use SDL_gfx with new SDL textures/renderer. SDL_gfx
> operates directly on bytes to do rendering (it's a software renderer).
> new SDL textures/renderer is hardware accelerated - it keeps all the
> textures on GPU side. So CPU can not access individual bytes unless it
> reads everything back - and that is slow. Nowdays when GPU is
> everywhere SDL_gfx is much slower that direct manipulation on textures
> on GPU side.
>
> So if you want performance - do the texture rendering yourself using
> GL/GLES.
>
> --
> Martins Mozeiko
>
>
> On Mon, Aug 1, 2011 at 8:46 AM, William Dyce <wilbefast at gmail.com> wrote:
> > Hey guys,
> > I'm going to need image rotation for this Android contract. Apparently
> > "SDL_gfx" is a fairly simple library, but less efficient than OpenGL (or
> > GLES since this is Android). I'm not all that familiar with OpenGL
> though.
> >
> > void Thing::draw(SDL_Renderer* renderer)
> > {
> >     static SDL_Rect draw_dest;
> >     draw_dest.x = position.x - size.x/2;
> >     draw_dest.y = position.y - size.y/2;
> >     draw_dest.w = size.x;
> >     draw_dest.h = size.y;
> >
> >     SDL_RenderCopy(renderer, sprite, NULL, &draw_dest);
> > }
> >
> > Assuming that I get everything to work with RenderCopy, can I use SDL_gfx
> > with my SDL 1.3 code (textures, renderer, etc), or do I need to go back
> to
> > the drawing board (pun not intended) and do everything myself using GLES
> for
> > rotations? And if both options are possibilities, what's the catch: why
> do
> > people say SDL_gfx is slower?
> >
> > Thanks,
> >
> > William
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110801/5f361215/attachment-0008.htm>


More information about the SDL mailing list