I’m doing a port of an app from Cocoa that uses CoreAnimation a lot – a lot of relatively simple fades and animated scaling and moving – all 2D stuff. I’ve already written a lot of the animation code, but it’s starting to enter a new level of complexity and now I’m wondering if there are any existing libraries out there that might do this kind of stuff for me.
Looks like http://www.clutter-project.org/ is what I need. After a cursory look through some of the tutorials, it looks like it might be hard to hijack the draw loop to get it to place nice with OF. Has anyone played with this?
I’m guessing you have something more complex than what can be done with the ofxTween libraries? Taking a quick look at clutter, it might be really tough to get clutter playing nicely with OF b/c it seems to expect creating the window and graphics context itself. Not to say it can’t be done, but that it might not be the fastest to port over, unless you’re comfortable with doing that. I think Clutter looks like it might be really awesome to have in OF though, so if you’re going to get started on it I’d be happy to help out a little to try and get it going.
Yeah, I’ve been digging through the osx-specific code just to see how it deals with windowing – it looks like there would have to be a GLUT-specific Backend and Stage. I’ve Googled around a bit and strangely, no one seems to be asking about integrating clutter into an existing OpenGL/GLUT app. I guess it’s still a relatively new library.
I agree that it would be really great to have in OF. Clutter already uses OpenGL, provides timelines, animation engine, a layout manager, and lots of other cool stuff.
The down side is that it has some prereqs (Pango for fonts, Cairo for vector graphics, and something called libpixman on OSX) that OF already has, so there would be some redundancy.
Anyway, I’d love to get this working in OF, but unfortunately I don’t think it’s going to work for my current project. Maybe for a future project.
i haven’t used it bu t have looked through their api some times. i think the only possibility to integrate it with OF is doing something like ofClutterAppWindow that substitutes the current glut one and starts the gl context through the same clutter.
also don’t know how hard it will be to compile it for osx but from my experience with gstreamer which clutter also uses it can be hard. a posibility to make it easier is to install the libraries through macports or fink
I made an ofAppClutterWindow that is launching nicely, and I can draw simple shapes. Mode updates soon.
If you are going to use MacPorts to install clutter, make sure that you use +universal and +no_x11
It’s best (IMHO), if you add the +universal to /opt/local/etc/macports/variants.conf so it insalls all of your future stuff in universal (i386/x86_64) form.
Also, you might want to run
sudo port upgrade --force installed
sudo port upgrade enforce-variants
or something like that.
Ah, that’s great. If you’re going to SVN/git it, I can take help out some this weekend, it might be really helpful for another project I’m working on.
You got it.
PS: I literally ONLY have some rotating rectangles and it’s not so pretty. I’ll have more time this weekend also.
I just spent an hour trying to make a universal version of clutterMM, “a language binding for C++ on top of Clutter.” I thought it would be a lot easier to work with, and it would also be easier to for the add-on to just extend the classes of clutterMM rather than doing all of that myself.
On the other hand, then I’d be beholden to this language binding that might be abandoned or not updated, so I am tempted to just stick with the C version. I just don’t want to do a bunch of work that’s already been done, and I hate to be defeated by build scripts.
in my opinion the best will be to use clutter directly, make an ofAppWindow, and have wrappers for basic functionality everything else you just give access to whatever context object clutter may have. the rest of the functionality you just let people use plain clutter.
it’s more or less what we do with ofxOpenCV or some other libraries, don’t try to wrap everything just make it work in OF and provide some basic functionality so the addon will be also some kind of tutorial so people can directly use the library.
that said usually mm versions of glibraries (related with gnome) are usually well mantained but also the c api is also super straight forward since it’s almost object oriented with the difference that you pass the object as the first argument of functions instead of calling methods on the objects.
Yeah – that’s what I ended up doing. As you said, the clutter API is very simple.