Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Graphics Software

Graphics for Beginners (Using SDL) 51

Jari Komppa writes "Looking at how learning programming these days is much harder than when I was starting, I decided to write a tutorial on how to make graphics at pixel level. The aim for the tutorial is to show that programming can actually be fun."
This discussion has been archived. No new comments can be posted.

Graphics for Beginners (Using SDL)

Comments Filter:
  • SDL Rocks!! (Score:5, Interesting)

    by trompete ( 651953 ) on Saturday December 11, 2004 @04:17PM (#11062139) Homepage Journal
    I used it for a game I wrote. It makes Threading, CDRoms, Joysticks, Keyboards, and graphics sooooo easy.

    If you're using SDL for games, you should also look into:
    NET2 - Fast Networking for SDLNet [gameprogrammer.com] for multiplayer game programming. It basically has a separate thread that polls for Network traffic on your sockets and pushes events to your event queue. He even extends SDL events to be thread safe and FASTER.
    SDL rocks.
  • Also... (Score:5, Informative)

    by eviltypeguy ( 521224 ) on Saturday December 11, 2004 @05:50PM (#11062741)
    Another great tutorial is the book called:

    http://www.nostarch.com/frameset.php?startat=plg

    One of the few programming books I've purchased that I didn't feel like I got ripped off in purchasing.

    Written by an Ex-Loki associated person John R. Hall
  • by Phatboy ( 805714 ) on Saturday December 11, 2004 @06:08PM (#11062854) Homepage
    We had to walk 500 miles uphill to get water than another 500 uphill back. We had to grind the flour with our hands, while it snowed. And it was proper snow then - so thick that you could hide cars in it most days, and that was in Summer. Now take programming, we had to write 500 lines of code to add two numbers together. And we liked it.

    And now you tell me programming was easier in my day? You, with your fancy SDL and OpenGL? I'd like to see you code once you've ploughed 300 fields in one day with your bare hands.

  • by tcopeland ( 32225 ) * <tom@NoSPaM.thomasleecopeland.com> on Saturday December 11, 2004 @06:16PM (#11062881) Homepage
    ...on RubyForge [rubyforge.org], including Magic Maze [rubyforge.org] (which was inspired by Gauntlet) and Tadpoles [rubyforge.org].
    • Hey! Thanks for the pointers, my 11 yr old son is curious about programming games and these are an interesting example of an easy way to start.
    • WOW, there are????
      thats, like, SOO great

      I never would've thought anyone would actually use SDL...
      let alone from RUBY.....

      Don't tell me the perlmongers, pythons and/or javastics did it as well?
      WOW, they did????
      thats, like, SOO great

      I never wou.....
      Ad infinitum, ad nauseam

      </SARCASM>

  • OpenGL == Direct3D, SDL fills in the rest [linuxdevcenter.com].

    It's an approximation, and there's some things which each set of software does markedly better than the other [slashdot.org], but SDL+OpenGL is considerably easier to extend (e.g. the NET2 library mentioned above) so I'd expect to see it get better faster (cheaper :-).

    The big advantages are:
    • you're not tied to one platform, one manufacturer or a handful of languages; and
    • You can find out exactly what each function and parameter does; and
    • You can easily modify or extend anything (and no DMCA worries); and
    • You don't have to give away any rights before you start using it.

    These advantages are usually enough to handsomely compensate for any peripheral shortcomings (e.g. no force-feedback API, slightly smaller texturing envelope).

  • Looks awesome! (Score:4, Interesting)

    by breon.halling ( 235909 ) on Sunday December 12, 2004 @02:28AM (#11064873)

    I've taken a quick glance at the tutorial, and it looks pretty good! As a Flash programmer, I've long been meaning to branch off into something more, um, sophisticated, and maybe this is the simple introduction that I've been waiting for!

    Many thanks, Jari Komppa!

  • SDL is overrated (Score:5, Insightful)

    by Junks Jerzey ( 54586 ) on Sunday December 12, 2004 @12:25PM (#11066869)
    SDL has a couple of things going in its favor:

    1. It works.
    2. It's cross-platform.
    3. It's not trying to do too much.

    That said, SDL isn't particularly well-designed otherwise. It's awkward. There's too much underlying info exposed to the user. The "surface" abstraction is muddy, in that you can accidentally run without hardware acceleration too easily, and you do easily do other things that hurt performance simply because you didn't pay attention to barely documented flags.
    • Re:SDL is overrated (Score:3, Informative)

      by ggambett ( 611421 )
      Well, what you say is true, but SDL is supposed to be a low level API. Things tend to get messy if you read the documentation, especially in a low level API.

      Other than that, I doubt anyone uses SDL directly. I wrote a high level framework on top of SDL, at a level of abstraction similar to Flash. It's quite good for doing that, precisely for being so low level and not forcing you to do things in a certain way. For the results, see my sig.
      • Well, what you say is true, but SDL is supposed to be a low level API.

        I wouldn't call it a low-level API, just that it has tight focus on what it's supposed to do. As such, it doesn't need to be messy; that's just poor design.

        For a dead-simple graphics API, check out TinyPTC [gaffer.org], which is unfortunately Windows-only. But the design is absolutely beautiful.
        • Re:SDL is overrated (Score:3, Interesting)

          by voodoo1man ( 594237 )

          For a dead-simple graphics API, check out TinyPTC, which is unfortunately Windows-only. But the design is absolutely beautiful.

          Are you referring to the GPU shader-accelerated version of TinyPTC? The webpage itself states that the current version uses software blitting (and runs on a bunch of platforms) with optional MMX optimizations, which would make TinyPTC as fast as worst-case blitting in SDL. If you want to do hardware accelerated blitting with masking/alpha, I really can't see a better interface tha

          • Are you referring to the GPU shader-accelerated version of TinyPTC?

            No. I can't find any information on real code for such a thing.

            The webpage itself states that the current version uses software blitting (and runs on a bunch of platforms) with optional MMX optimizations, which would make TinyPTC as fast as worst-case blitting in SDL.

            TinyPTC gives you a fixed format frame buffer and a call to convert and copy it to the screen. That's all. So if you want to do software blitting (which is what the ori
            • If you want to abstract the OS out of the code (like SDL) you have to "let things get converted internally behind your back in undocumented ways". Basically you describe abstraction as bad here which makes me wonder what your point was.
          • Before you hype SDL too much for hardware acceleration, you should check out this [gentoo.org] thread.
            • All that thread points out is that you can't get direct access to the video card under X11 without DGA extensions, and then (obviously) only in full-screen mode. SDL isn't going to do magic for you - if whatever it's running on top of doesn't support direct access to the hardware, then SDL won't give you hardware acceleration.
        • I work with sound spectrogram displays ("voice prints") using the Windows 2-D graphics API. The calls that tie me down to Windows are IDirectDraw::WaitForVerticalBlank(), ScrollWindowEx(), and CreateDIBSection(). This API is far from simple, but these are the Windows-specific calls for which it is hard to find equivalents in other systems.

          CreateDIBSection() allows blitting a raster to the screen. I call a raster a memory array of pixels where you can control all of the pixel values. OK, CreateDIBSecti

  • HTML, anyone? (Score:4, Interesting)

    by magefile ( 776388 ) on Sunday December 12, 2004 @06:36PM (#11068835)
    I had a friend who did 2-player "TANKS" in HTML, Javascript and CSS, simply by having tons of 1 pixel divs. Quite impressive ...
    • This is modded funny, but I was serious. It's not that hard to do with a stylesheet, some basic HTML, and a bit of Javascript. And javascript is at least a better first language than BASIC!
    • the 5k compo (Score:3, Informative)

      by Z-MaxX ( 712880 )
      Sounds like a common technique used in the 5k competition, a contest to make the coolest web page in 5 kilobytes.

      Check out some of the winners from the last 5k compo [the5k.org]. Really cool stuff.

    • Reminds me of Excel Pacman [geocities.jp]... another fine example of bashing nails with a screwdriver. Brilliant, nevertheless.
      • another fine example of bashing nails with a screwdriver.

        Heh. Off-topic, but this phrase caught my eye, because just minutes ago I was pounding (well, more like tapping) nails with a pair of needlenose pliers. Why? Because it was a tight spot, a repair job of re-sinking nails that had been pulled loose, in a space where no hammer would fit.

        For initial construction, there's usually a specific right tool designed for the job; but things can break in so many different and interesting ways that often crea

  • sol.. ltns.. mm i have been away from irc too long. i bet nothing has changed on #coders in 5+ years...
  • One problem IMHO, is that SDL tries to be kind-of-good at too many things, but isn't superbly good at anything. Of course it's good at being Open Source, cross-platform, easy-to-learn, yada yada, but fails in so many other areas. A general problem is that, in many cases, it abstracts the various hardware capabilities at a way too high level. For instance when it comes to the audio part: relying on the application programmer to do all mixing, etc, is probably nice seen from the "simplicity" point of view, bu
  • I just wanted to mention that there is also Allegro. It's a multi-platform gaming library:
    http://www.talula.demon.co.uk/allegro/
    also see http://www.allegro.cc/

"I'm a mean green mother from outer space" -- Audrey II, The Little Shop of Horrors

Working...