Re: SDLx::Sprite rotation artifacts and size limitation
Mon, 23 Apr 2012 20:56:21 +0200, Tobias Leich wrote: > Hi again, > > Its quit cool, but I'm not that good when it comes to do two things at > the same time ;o) > > I can't see anything strange when rotating the player-sprite. The problem isn't constant but it's very annoying when it does appear. I've posted an example screenshot here: http://floyd.atc.no/Programming/Perl/IfItMoves/SDL-Sprite-artifacts.png Tip: If you have downloaded the code, try setting "$cheatmode = 1" to become immortal. You can now hit TAB a few times to spawn more enemies. -- Andreas Lund (fl...@atc.no) Tel: +47 90077162 #include "Look at you hacker, panting and sweating as you run through my corridors. How can you challenge a perfect immortal machine?" -- SHODAN, System Shock
Re: SDLx::Sprite rotation artifacts and size limitation
Hi again, Its quit cool, but I'm not that good when it comes to do two things at the same time ;o) I can't see anything strange when rotating the player-sprite. Cheers, FROGGS. Am 23.04.2012 20:46, schrieb Tobias Leich: > Hi Andreas, > > Am 23.04.2012 09:53, schrieb Andreas Lund: >> Hi, >> >> Running Strawberry Perl on Win 7 x64 I have installed SDL and Alien::SDL from >> CPAN (selecting option 1) and I'm writing a twin stick shooter game for fun. >> I >> have three questions: >> >> 1) When rotating sprites using the ->rotation() method the sprites often get >> a >> line of "artifact noise" along one of the sides, usually the right and/or >> bottom edge of the original sprite. The effect is not constant and the >> original sprites are all 100% transparent at the edges so I believe the >> artifacts are introduced by the rotation algorithm. Or is it? > Do you have a screenshot? I just can think of problems when > anti-aliasing and transparency come together... >> 2) After experimenting with different sprite sizes, it seems that there's a >> limit somewhere. When attempting to load a sprite that's too large, I get a >> seemingly valid sprite object that just doesn't seem to render anything. Is >> there a known size limit to sprites or could this be a driver issue? Or am I >> overlooking something? > See http://sdl.perl.org/SDL-GFX-Rotozoom.html, I believe width+height > must be less than 16384. >> 3) How exactly does the 'alpha_key' property work? I tried setting it to the >> ubiquitous bright purple (FF00FF) but this just caused half my sprites to >> become completely invisible. When using PNG files with an alpha channel, >> using >> a key color seems pointless to me, which makes the POD example code somewhat >> confusing: >> >> # spawning can include almost all of the above: >> my $sprite = SDLx::Sprite->new( >> image => 'hero.png', # or surface => SDL::Surface >> rect=> SDL::Rect,# or x => $x, y => $y >> clip=> SDL::Rect, >> alpha_key => SDL::Color, # or [$r, $g, $b] >> alpha => 1, >> rotation => 45, # degrees >> ); > Ya, alpha and blitting is not the easiest things as someone might think. > If you have a png file with alpha channel, and applying an alpha color > key to it should reset the alpha channel. At least that is what I would > expect. > You cant mix the alpha channel and alpha key. >> >> If anyone is interested in a sneak peek, here's the code: >> http://floyd.atc.no/Programming/Perl/IfItMoves/2012-04-23.zip > Will have a look then ;o) > > Cheers, FROGGS >> Suggestions are welcome :-) >> >> -- >> Andreas Lund (fl...@atc.no) >> Tel: +47 90077162 >> #include >> "Look at you hacker, panting and sweating as you run through my corridors. >> How can you challenge a perfect immortal machine?" -- SHODAN, System Shock
Re: SDLx::Sprite rotation artifacts and size limitation
Hi Andreas, Am 23.04.2012 09:53, schrieb Andreas Lund: > Hi, > > Running Strawberry Perl on Win 7 x64 I have installed SDL and Alien::SDL from > CPAN (selecting option 1) and I'm writing a twin stick shooter game for fun. I > have three questions: > > 1) When rotating sprites using the ->rotation() method the sprites often get a > line of "artifact noise" along one of the sides, usually the right and/or > bottom edge of the original sprite. The effect is not constant and the > original sprites are all 100% transparent at the edges so I believe the > artifacts are introduced by the rotation algorithm. Or is it? Do you have a screenshot? I just can think of problems when anti-aliasing and transparency come together... > > 2) After experimenting with different sprite sizes, it seems that there's a > limit somewhere. When attempting to load a sprite that's too large, I get a > seemingly valid sprite object that just doesn't seem to render anything. Is > there a known size limit to sprites or could this be a driver issue? Or am I > overlooking something? See http://sdl.perl.org/SDL-GFX-Rotozoom.html, I believe width+height must be less than 16384. > > 3) How exactly does the 'alpha_key' property work? I tried setting it to the > ubiquitous bright purple (FF00FF) but this just caused half my sprites to > become completely invisible. When using PNG files with an alpha channel, using > a key color seems pointless to me, which makes the POD example code somewhat > confusing: > > # spawning can include almost all of the above: > my $sprite = SDLx::Sprite->new( > image => 'hero.png', # or surface => SDL::Surface > rect=> SDL::Rect,# or x => $x, y => $y > clip=> SDL::Rect, > alpha_key => SDL::Color, # or [$r, $g, $b] > alpha => 1, > rotation => 45, # degrees > ); Ya, alpha and blitting is not the easiest things as someone might think. If you have a png file with alpha channel, and applying an alpha color key to it should reset the alpha channel. At least that is what I would expect. You cant mix the alpha channel and alpha key. > > > If anyone is interested in a sneak peek, here's the code: > http://floyd.atc.no/Programming/Perl/IfItMoves/2012-04-23.zip Will have a look then ;o) Cheers, FROGGS > > Suggestions are welcome :-) > > -- > Andreas Lund (fl...@atc.no) > Tel: +47 90077162 > #include > "Look at you hacker, panting and sweating as you run through my corridors. > How can you challenge a perfect immortal machine?" -- SHODAN, System Shock
SDLx::Sprite rotation artifacts and size limitation
Hi, Running Strawberry Perl on Win 7 x64 I have installed SDL and Alien::SDL from CPAN (selecting option 1) and I'm writing a twin stick shooter game for fun. I have three questions: 1) When rotating sprites using the ->rotation() method the sprites often get a line of "artifact noise" along one of the sides, usually the right and/or bottom edge of the original sprite. The effect is not constant and the original sprites are all 100% transparent at the edges so I believe the artifacts are introduced by the rotation algorithm. Or is it? 2) After experimenting with different sprite sizes, it seems that there's a limit somewhere. When attempting to load a sprite that's too large, I get a seemingly valid sprite object that just doesn't seem to render anything. Is there a known size limit to sprites or could this be a driver issue? Or am I overlooking something? 3) How exactly does the 'alpha_key' property work? I tried setting it to the ubiquitous bright purple (FF00FF) but this just caused half my sprites to become completely invisible. When using PNG files with an alpha channel, using a key color seems pointless to me, which makes the POD example code somewhat confusing: # spawning can include almost all of the above: my $sprite = SDLx::Sprite->new( image => 'hero.png', # or surface => SDL::Surface rect=> SDL::Rect,# or x => $x, y => $y clip=> SDL::Rect, alpha_key => SDL::Color, # or [$r, $g, $b] alpha => 1, rotation => 45, # degrees ); If anyone is interested in a sneak peek, here's the code: http://floyd.atc.no/Programming/Perl/IfItMoves/2012-04-23.zip Suggestions are welcome :-) -- Andreas Lund (fl...@atc.no) Tel: +47 90077162 #include "Look at you hacker, panting and sweating as you run through my corridors. How can you challenge a perfect immortal machine?" -- SHODAN, System Shock