RenderCopy + rotations: sdl_gfx or OpenGL?

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

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 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

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 <@William_Dyce> 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