Archives for: November 2007, 09

11/09/07

More Clutter

This afternoon I wanted to implement some custom ClutterActor. I made a very basic actor which is basicly a simple rectangle, like ClutterRectangle, but allows you to define a color for every corner, which are blended by OpenGL.

Like this:
ClutterGlColorRect

I also added a simple animation sequence which changes all corner colors over time, so you get some visual effect, and added some motion effects (a simple rotation around 2 axes). The color changing effect is badly written now, should become a ClutterBehaviour, if possible.

Code is here, it could be a good starting point to learn how to write a custom actor using OpenGL (first time I ever wrote OpenGL code myself, it's not that hard, more experimenting later).

Performance and anti-aliasing is rather sluggish now, but I don't think it's related to my code as doing the same rotations on a single-color ClutterRectangle gives the same result.

Oh: yes, this code leaks at exit.

Enjoy :-)

Permalink . Ikke . 11:16:30 pm . 156 Words . Desktop, Coding Corner . . 1697 views . Leave a comment