I’m working on a little side project where I need to do some simple, cross-platform game-like graphics. Really simple: I want to be able to draw some colored lines, and splat out rotated images. But I’d also like this to be reasonably efficient, and reasonable easy to use.
And, ideally, I’d love for something that was portable to Windows.
I’ve done just a bit of poking around, and it wasn’t quite clear to me what the right choice was.
I looked at tsdl and tgls, but it wasn’t clear to me with either of them how to rotate a texture. Maybe I’m just missing something? Also, I found tgls a little hard to navigate, since I haven’t used opengl for 20 years. I feel like rotation has to be in there, but searching for “rotate” in the docs comes up empty, and I couldn’t find any good examples. The portability story here seemed hopeful.
I looked at OCaml’s venerable Graphics library. Super easy to use, not sure about the portability story. No efficient way of rotating images, though.
wall. Seems to have all the capabilities, not sure about the portability story.
web. Portable, though I’d need to have a more complex setup for users, where the native OCaml program would run a web-server that would communicate to the OCaml UI, since I need this to be a native app. Feels extra complicated.
Anyway, does anyone have any suggestions on what path to take? Am I missing any options?
I have never really used the SDL 2D support but it could have you covered. This should allow you to rotate a texture.
The OpenGL of today bares little ressemblance to the one you knew, this is the hello world nowadays. Rotation is there under the form of matrices that you access in shaders but you also need to deal with defining, compiling and feeding those with data which brings quite a bit of boiler plate (see the example).
Also on macOS, OpenGL “the API”, seems to be on the way out. I suspect the 2D SDL API may be a better bet since it will likely keep you with a compatibility, hardware accelerated layer.
If you can lift the native constraint, the web would still be my first shot, nothing beats it’s ease of installation.
I’ve long wished that Reprocessing would be ported to OPAM. Currently that’s not the case, and I’m not sure it’s even installable from esy, but it’s exactly the kind of thing @Yaron_Minsky is looking for.
It’s also possible to use the Skia bindings through Revery to take advantage of the rest of Revery’s features: Revery exposes Skia as part of its Canvas API. This is really nice because you can avoid all the window setup stuff you’d have to do with SDL or raw OpenGL.