Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Personally, I prefer GLFW over SDL:

https://www.glfw.org/

GLFW just goes from zero to OpenGL context ASAP, plus input events. With SDL I found that their drawing primitives are too limiting for my needs, and if you want to do any custom drawing at all, you need to abandon their drawing primitives entirely and just write GL codel. At that point, GLFW makes more sense.

SDL does have a few other nice things like audio support and text rendering, which you'd have to figure out separately with GLFW, but to each their own.



Yes but SDL supports mobile and consoles and with either one, you can get an OpenGL or vulkan context pretty easily. Audio is honestly the other big plus (do you really want to navigate windows audio driver handshakes or pulseaudio...).


my first idea was to use glfw indeed, but i took SDL cause it's easier to set up and it gives me audio, image loading/parsing and input.

The project will not stick to SDL anyways, the idea is to use it as a high level API, not to build a game with SDL. I would like to use this engine for PSP also, and i'll have to take SDL out and put osLib in. problems for future me...


I gave up on SDL2 for graphics after looking at the code that would be necessary to apply the simplest OpenGL shader.

The alternative path for C++ is SFML, which has sensible abstractions for most of what you need.


SDL2 has much better support for Android though.


are there any concrete, tangible advantages of glfw over freeglut? I see the glut api as the paragon of usefulness and simple elegance, and I'm really curious how glfw can be any better than that.


I haven't used glfw, but from the docs it leaves you in control of the main loop, whereas glut takes that over and only offers you callbacks. When I used glut (many many years ago) that was sometimes annoying.

glfw doesn't seem to have a function to draw teapots though, which should really rule it out as a serious contender.


legacy glut does not allow loop control, but freeglut does


There are plenty. Freeglut not being in active development for a while, AFAIK, will not support high-dpi devices (where the window resolution and surface resolution do not match), or newer drivers for different input devices. Freeglut locks you in to OpenGL instead of other rendering APIs. Getting multi-monitor setups up and running is harder. Joystick support is paltry to nonexistent.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: