SDLx::Sprite rotation artifacts and size limitation

2012-04-23 Thread 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?

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 disclaimer.h
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

2012-04-23 Thread Andreas Lund
Mon, 23 Apr 2012 20:56:21 +0200, Tobias Leich em...@froggs.de 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 disclaimer.h
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: SDL Mailing list question

2009-09-27 Thread Andreas Lund
Sat, 26 Sep 2009 10:22:19 -0400, Kartik Thakore thakore.kar...@gmail.com
wrote:
 Have you tried POGL?

No. This would basically mean a complete rewrite :-)

Which brings me to another question... Trying to get my old code running, I'm
having an unexpected problem with the event handler stuff.

When using 'strict', the program refuses to run:
Bareword SDL_QUIT not allowed while strict subs in use at
D:/Perl/offworld.pl line 322.
Bareword SDL_KEYUP not allowed while strict subs in use at
D:/Perl/offworld.pl line 324.
Bareword SDL_KEYDOWN not allowed while strict subs in use at
D:/Perl/offworld.pl line 336.

Removing 'strict', I get these:
Argument SDL_QUIT isn't numeric in numeric eq (==) at D:/Perl/offworld.pl
line 322.
Argument SDL_KEYUP isn't numeric in numeric eq (==) at D:/Perl/offworld.pl
line 324.
Argument SDL_KEYDOWN isn't numeric in numeric eq (==) at D:/Perl/offworld.pl
line 336.

I can't find anything in the perldocs indicating these symbols need to be
manually imported, so what am I missing?


--
Andreas Lund (fl...@atc.no)
Tel: +47 90077162
#include disclaimer.h
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: SDL Mailing list question

2009-09-26 Thread Andreas Lund
Sat, 26 Sep 2009 04:35:19 -0400, Kartik Thakore thakore.kar...@gmail.com
wrote:
 
 On 26-Sep-09, at 4:06 AM, Christian Schmid csch...@rapidshare.com  
 wrote:
 
  Hi Kartik,
 
  Thank you for your reply. I am new to OpenGL programming. I used to
  write everything in Perl. No matter if its a network stack or a fully
  blown web-custimizable FTP server. Now I am trying to code blast-away
  3d-applications... in Perl. Some people say this is crazy, but I am  
  sure
  as soon as I have created an amazing framework, it will work as well  
  as
  C-applications do.
 It should!

It does! I wrote a simple 3D engine a few years back and for comparison I
wrote the exact same thing in C++ too. (Twice, both in OpenGL and DirectX) and
what did I learn? Not only did the Perl version produce the exact same
framerate as long as I used display lists properly, the possibilities were
just so much greater with Perl/SDL: Sound and bitmaps were already taken care
of, memory management was obviously not a problem and most important of all:
Whatever logic I wanted to bring in at runtime, could easily be loaded and
executed using eval(). 

I went as far as implementing a console-like GUI interface which let me type
commands, load 3D models, spawn objects, set things in motion etc. In
contrast, I never got as far as implementing a GUI in the C++ versions simply
because the language is so much more work.

So, what killed the Perl version back then? Two things.

1. SDL-Perl was next to impossible to build. NOT ANYMORE!!! :-D
2. No support for shaders or other cool stuff. Hmmm... is it getting there?

Unfortunately, after several years of bit rot I've so far been unable to get
my old code to run properly with the current SDL. Since it's just a hobby
project of mine, competing with wife, kids, house, work etc, things are moving
slow.

What doesn't work? glGetString(). Perhaps it's my lack of experience with XS,
or perhaps the sdl opengl binary is broken, I don't know. This isn't really
critical except for debugging and using extensions. Worse, I remember using
some kind of glu routine to load up a bitmapped font as a texture display
list, I don't remember exactly how it worked, I can only see that it no longer
does, and I haven't the slightest idea why. Not that I've had a lot of time to
look into it... :-|


Anywho... Got some screenshots and an old version here: 
http://floyd.atc.no/Programming/Perl/Offworld/
If anyone is interested in the current source, let me know. 


--
Andreas Lund (fl...@atc.no)
Tel: +47 90077162
#include disclaimer.h
Look at you hacker, panting and sweating as you run through my corridors.
How can you challenge a perfect immortal machine? -- SHODAN, System Shock


Building on Win32 - the real problem

2009-08-30 Thread Andreas Lund

Yet again I have decided to try building SDL on Win32 and yet again I have not
even made it to the actual building. Why? Because only about half the required
libraries can be downloaded for Windows.

smpeg-0.4.5

The SDL webpage refers to http://www.icculus.org/smpeg/ which states the
following:

  You can check out smpeg from Subversion via these simple instructions:
  svn co svn://svn.icculus.org/smpeg/trunk smpeg

Unfortunately, there are two problems here. First of all, the 'svn' command is
meaningless to anyone not familiar with Subversion. Secondly, even those who
know what Subversion is and actually manage to download and install a client
and check out the files...  the only thing you will get is the source code,
not the Win32 library. If you don't know how to compile it, you're out of
luck. 


SDL_sound

The SDL webpage refers to http://icculus.org/SDL_sound/
Now, just in case anyone actually succeeded in getting past Subversion, they
decided to use Mercurial for this:

 To download SDL_sound via Mercurial:

  hg clone http://hg.icculus.org/icculus/SDL_sound/
  ...or, for the stable (non-development) branch:
  hg clone -r stable-1.0 http://hg.icculus.org/icculus/SDL_sound/ 

And ofcourse, you'll still only get the source code, not the Win32 library.


SDL_gfx

The SDL webpage refers to http://www.ferzkopp.net/joomla/content/view/19/14/
How refreshing to actually see a tarball ready for download. Ofcourse, most
perl devs know how to extract one, but again... this is the source code only,
not the actual library.


SDL_svg

The SDL webpage refers to http://www.linuxmotors.com/SDL_svg
Actually managed to get stuff compiled for the other libs? Well okay, try to
get past this then... this time you only get to download the linux library,
not the source code. Muahahaha!


SDL_vnc

The SDL webpage refers to
http://www.ferzkopp.net/~aschiffler/Software/SDL_vnc/index.html which is a
broken link. Still don't give up do you? OK so you navigate the site, and
again you find a tarball with source code only. 


Until these hurdles are solved, the number of people both willing and able to
TEST SDL-Perl on Windows will remain stable at near zero, and the irregular
attempts to resurrect the project are almost guaranteed to fail.



--
Andreas Lund (fl...@atc.no)
Tel: +47 90077162
#include disclaimer.h
Look at you hacker, panting and sweating as you run through my corridors.
How can you challenge a perfect immortal machine? -- SHODAN, System Shock


How to use glProject without glGet?

2005-10-11 Thread Andreas Lund

Hello again :-)

I have been playing around quite a bit with SDL::OpenGL now, but there is one
problem which has me completely stumped. I'm trying to use glProject, which
(as far as I understand) needs the current modelview and projection matrices,
as well as the current viewport. 

  Usage: SDL::OpenGL::Project(objx, objy, objz, mm, pm, vp)

But when I try to fetch this info with glGet, it appears there is no such
subroutine... is there some fancy trick I have overlooked, or is this a known
problem with sdlperl?

  Undefined subroutine main::glGet


--
Andreas Lund ([EMAIL PROTECTED]) - Net.adm - http://www.atc.no
Tel: +47 90.07.71.62 / +47 63.88.33.57  Fax: +47 21.69.09.10
Ano-Tech Computers AS - Din interaktive leverandør
** He had a baseball bat and I was tied to a chair. 
** Pissing him off was the smart thing to do.  -- Max Payne


Re: Undefined subroutine main::gl*

2005-09-01 Thread Andreas Lund
Thu, 1 Sep 2005 01:06:55 -0700, Geoffrey Broadwell [EMAIL PROTECTED]
wrote:
 If you're going to do SDL::OpenGL on Win32, you probably want to be 
 using Wayne Keenan's builds of SDL_perl 1.x, which are hosted on my 
 site at:
 
   http://www.broadwell.org/graphics/sdl-perl/#downloads
 
 The downloads blurb mentions this, but just to save you time -- 
 remember to uninstall the crazyinsomniac build first.
 
 Good luck, and let me know how it goes.

We have lift-off!

I have now been able to run a few of the tutorial scripts, thus proving that
SDL::OpenGL is finally working here.

Now... as I have never before programmed anything in OpenGL or DirectX, I have
some learning and experimenting to do. Last time I did any 3D coding was when
we used 320x200 and integer math in assembly language :-))


--
Andreas Lund ([EMAIL PROTECTED]) - Net.adm - http://www.atc.no
Tel: +47 90.07.71.62 / +47 63.88.33.57  Fax: +47 21.69.09.10
Ano-Tech Computers AS - Din interaktive leverandør
** He had a baseball bat and I was tied to a chair. 
** Pissing him off was the smart thing to do.  -- Max Payne