Re: adding texture scaling functionally to SDL2_perl

[email protected] (Mason James) Sun, 11 Aug 2013 20:32:43 +1200
Newsgroups perl.sdl.devel
Message-ID <[email protected]>
On 2013-08-10, at 6:37 AM, Kartik Thakore wrote:

> Thanks mason,
>=20
> Can you make these feature requests as issues on =
http://github.com/PerlGameDev/SDL2
>=20

yes, will do :)


>=20
> On Fri, Aug 9, 2013 at 2:25 PM, Mason James <[email protected]> wrote:
>=20
> hi sdl-devel=20
>=20
> i am planning/researching about adding a small amount of SDL2_Perl =
code into my existing SDL_Perl app, for a framerate increase=20
> i have one long-standingly slow bit of code in my app, that i would =
like to replace with SDL2 code=20
>=20
> my slow code is a SDL::GFX::Rotozoom::surface() call. but SDL2 has =
'hardware accelerated' stretching/scaling/zooming [1], yay!=20
>=20
>=20
> 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=20
>=20
> SDL2's SDL_RenderCopyEx() function [2] will scale a texture using a =
fast HW method, (but...i have not benchmarked my theory yet)=20
>=20
>=20
> my plan is to attempt to add some missing SDL2 functionality to =
SDL2_Perl.=20
> then swap my slow SDL::GFX::Rotozoom::surface() call, with the faster =
SDL2 equivalent=20
>=20
> 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...=20
>=20
> SDL_LoadBMP(),=20
> SDL_CreateTextureFromSurface(),=20
> SDL_FreeSurface()=20
> SDL_RenderGetViewport()=20
> SDL_CreateTexture()=20
> SDL_SetRenderTarget()=20
> SDL_RenderCopy()=20
> SDL_RenderCopyEx(),=20
> SDL_QueryTexture()=20
>=20
>=20
>=20
> fyi: the testrendercopyex.c demo is nice and simple, it...=20
>=20
> - loads a .bmp file to a surface=20
> - converts the surface to a HW texture=20
> - then randomly moves, rotates and scales that texture around the =
window, in a loop=20
>=20
> i believe this demo is using the new hardware-accelerated scaling on a =
'texture' in SDL2=20
>=20
>=20
> [1] http://wiki.libsdl.org/moin.fcg/Introduction=20
> [2] http://wiki.libsdl.org/moin.fcg/SDL_RenderCopyEx=20
> [3] http://hg.libsdl.org/SDL/file/90ff13467550/test/testrendercopyex.c=20=

>=20
> any comments or suggestions, folks?=20
>=20
>=20
> cheers, Mason
>=20
>=20


cheers, Mason
--=20
KohaAloha, NZ