Live data from Hacker News

SDL 2.0.0 is out after many years in development

lists.libsdl.org

21–30 of 62 posts

Re: SDL 2.0.0 is out after many years in development

#22

I never understood SDL vs OpenGL. As somebody who does OpenGL why should I use SDL?

SDL is a decent cross-platform layer for handling things like window creation, event handling, joystick and other devices, and things like this.

However, if you're using OpenGL, there are at least two libraries you'll probably want to make heavy use of (because SDL doesn't do anything worth mentioning in those regards):

FreeImage for image loading ( http://freeimage.sourceforge.net/ )

AssImp for model loading ( http://assimp.sourceforge.net/ )

Both are amazingly handy, have good licenses, and have excellent documentation (FreeImage is one of my favorite tech writing examples of all time).

Re: SDL 2.0.0 is out after many years in development

#23
post #15

Earlier quoted context omitted.

SDL_main is no longer mandatory (though it is still there); #define-ing SDL_MAIN_HANDLED and calling SDL_SetMainReady once before SDL_Init is sufficient now. Edit: Ah, if the main loop you refer is SDL_Event loop, as exDM69 said, SDL always supported passive event functions that can be called at your original idle function. SDL 2.0 adds an active event watcher (SDL_AddEventWatch etc.) as an alternative though.

That's great news, I always felt the whole SDL_main thing to be quite evil.

> That's great news, I always felt the whole SDL_main thing to be quite evil.

Evil or not, it solves a practical problem that you would have to work around if SDL did not. And AFAIK, you have always had the option of not using SDL_main if you wish to solve the problem on your own.

On desktop platforms the program entry point is pretty easy to solve (main vs. WinMain) with an SDL_main-style macro or command line args on win32 compilers. But when you start working with iOS and Android, it gets more hairy.

Re: SDL 2.0.0 is out after many years in development

#24
post #15

Earlier quoted context omitted.

SDL_main is no longer mandatory (though it is still there); #define-ing SDL_MAIN_HANDLED and calling SDL_SetMainReady once before SDL_Init is sufficient now. Edit: Ah, if the main loop you refer is SDL_Event loop, as exDM69 said, SDL always supported passive event functions that can be called at your original idle function. SDL 2.0 adds an active event watcher (SDL_AddEventWatch etc.) as an alternative though.

That's great news, I always felt the whole SDL_main thing to be quite evil.

It did make writing bindings for other languages rather interesting

Re: SDL 2.0.0 is out after many years in development

#25
post #19

Earlier quoted context omitted.

#include int main(void) { GLFWwindow* window; if (!glfwInit()) return -1; window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); if (!window) { glfwTerminate(); return -1; } glfwMakeContextCurrent(window); while (!glfwWindowShouldClose(window)) { /* Render here */ glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } VS #include #include /* Our program's entry point */ int main(int argc,…

Yep, because main-loop boilerplate is all one ever does with graphics programming.

Hey, no reason to get snippy--you asked "Isn't SDL the simplest, most portable way to use OpenGL?", and asserted that it's a smaller library. I showed you a still-smaller alternative, and even dug up code to substantiate that point.

There's nothing wrong with using SDL for making a game (well, maybe a couple of things, but that's not relevant here), but it simply isn't the smallest GL scaffolding library out there.

Re: SDL 2.0.0 is out after many years in development

#26
post #4

Lately I started using SFML instead of SDL for C++ Game Development. However, I'll still use SDL on future projects I hope. It's a brilliant library, so compact and portable that the games you write will be able to be compiled to a lot of platforms, even high school graphing calculators[1]. The SDL development still impresses me and 2.0.0 is a major milestone and multiple windows, new OpenGL, touch support, Android a…

The network and scenegraph stuff that SFML comes with is quite nice--the choice of C++, though, makes other language bindings a bit more clunky.

Re: SDL 2.0.0 is out after many years in development

#27

From the About: "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games." http://www.libsdl.org/index.php

Oh, yes. New website!

Re: SDL 2.0.0 is out after many years in development

#28
post #19

Earlier quoted context omitted.

Yep, because main-loop boilerplate is all one ever does with graphics programming.

Hey, no reason to get snippy--you asked "Isn't SDL the simplest, most portable way to use OpenGL?", and asserted that it's a smaller library. I showed you a still-smaller alternative, and even dug up code to substantiate that point. There's nothing wrong with using SDL for making a game (well, maybe a couple of things, but that's not relevant here), but it simply isn't the smallest GL scaffolding library out there.

Heh, you're right, I got a little snarky. Sorry :-P

But I got bit by half-assed "GL" ways of doing things before. SDL has everything, in layers, so you can grow into it. Unlike "portable GL" libraries which are discrete, isolate dead-ends.

Re: SDL 2.0.0 is out after many years in development

#29

Looks like they changed their license from LGPL to zlib as well. I wonder if this will increase adoption, or if it just was so Valve could use it in Steam for Linux.

I doubt it would be a huge issue for Valve; they already use LGPL code. However, it's often a big deal for small developers; simpler licenses mean simpler due diligence on investment and such, and a lot of companies are cautious of LGPL in anything that they'll be distributing.

Re: SDL 2.0.0 is out after many years in development

#30
post #9

Earlier quoted context omitted.

Also pretty much required to get applications sdl to ios/android store.

The Play Store is pretty much license-agnostic. At least there is no policy preventing GPL works that I know of.

While the FSF discourages use of the Android marketplace, they do say there's no specific GPL conflict. Compliance is potentially a bit more of a pain for the developer, of course; strictly speaking they have to make sure the LGPL-covered code is available for download for three years after distribution ends. They also strictly speaking have to provide a mechanism to re-assemble the app; example here: http://sparrowmailapp.com/lgpl.php (though note that a lot of people just don't bother).
Post reply on HN