adding texture scaling functionally to SDL2_perl

[email protected] (Mason James) Sat, 10 Aug 2013 06:25:33 +1200
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
hi sdl-devel

i am planning/researching about adding a small amount of SDL2_Perl code =
into my existing SDL_Perl app, for a framerate increase
i have one long-standingly slow bit of code in my app, that i would like =
to replace with SDL2 code

my slow code is a SDL::GFX::Rotozoom::surface() call. but SDL2 has =
'hardware accelerated' stretching/scaling/zooming [1], yay!


i checked the SDL2 version of ./SDL2_rotozoom.c, and it is still using =
the current slow software method (no changes)=20
but the good news is=85 there seems to be a preferred method to achieve =
this fast hardware scaling in SDL2

SDL2's SDL_RenderCopyEx() function [2] will scale a texture using a fast =
HW method, (but...i have not benchmarked my theory yet)


my plan is to attempt to add some missing SDL2 functionality to =
SDL2_Perl.
then swap my slow SDL::GFX::Rotozoom::surface() call, with the faster =
SDL2 equivalent

so basically, i need to implement the 'test/testrendercopyex.c' demo =
[3], in SDL2_Perl,=20
and add access to these missing SDL2 functions in SDL2_Perl...

SDL_LoadBMP(),
SDL_CreateTextureFromSurface(),
SDL_FreeSurface()=20
SDL_RenderGetViewport()
SDL_CreateTexture()
SDL_SetRenderTarget()
SDL_RenderCopy()
SDL_RenderCopyEx(),
SDL_QueryTexture()



fyi: the testrendercopyex.c demo is nice and simple, it...

- loads a .bmp file to a surface
- converts the surface to a HW texture
- then randomly moves, rotates and scales that texture around the =
window, in a loop

i believe this demo is using the new hardware-accelerated scaling on a =
'texture' in SDL2


[1] http://wiki.libsdl.org/moin.fcg/Introduction
[2] http://wiki.libsdl.org/moin.fcg/SDL_RenderCopyEx
[3] http://hg.libsdl.org/SDL/file/90ff13467550/test/testrendercopyex.c

any comments or suggestions, folks?


cheers, Mason=