jit.matrix – moving away from 'setcell' towards a more object oriented approach

Aug 31, 2012 at 9:21pm

jit.matrix – moving away from 'setcell' towards a more object oriented approach

I’ve been getting along quite well with jit.matrix and setcell messages to create patterns and shapes on a low-res 2d matrix. For example, I can make a 1×1 pixel dot move across the screen from left to right, leaving a nice trail behind it:

– Pasted Max Patch, click to expand. –

However, I’m beginning to see the limitations of this method. I would like to start looking at the dot as an object, that I can then apply movements to (e.g. move left 1px, move up 3px, etc). Or specify some other shape (a square, or an ‘L’) and move that around the screen.

Is there anything similar to this in Jitter?

I’ve had a quick look at some jit.gl tutorials but GL seems a bit advanced for what I want to do. I don’t need 3D shapes and textures, just basic colours and 2D shapes in very low-res. I’m generating patterns for LED arrays, not monitors/projectors.

However, if jit.GL is my only choice then I’m ready to get stuck in.

#64186
Aug 31, 2012 at 10:44pm

Maybe this kind of setup can serve as inspiration:

– Pasted Max Patch, click to expand. –
#231496
Aug 31, 2012 at 11:59pm

Thanks Wesley, that’s pretty cool actually. This is moving towards what I want – defining a shape (gridshape), and then move that shape around (position).

My LEDs will be behind opaque perspex so the filter you’ve added to the pixels makes it look a little more like it will do on the hardware itself.

Definitely inspired now!

#231497
Oct 27, 2012 at 4:43pm

Hi Wesley (and all),

I had a look into using jit.gl, and there are a lot of things about it that I quite like. It definitely has the more object-oriented approach I was looking for, whereby each of my ‘object’ on the screen can be generated by a jit.gl.gridshape, and I can move them around independently.

There are, however, a couple of things that perhaps make it not so good for my purposes. As I said in my original post, I’m working with very low-res matrices (8×8 pixels). My ‘objects’ tend to be 1×1 pixels, and move around pixel to pixel. GL, by it’s very nature, does not deal with pixel accurate placement of an object. Instead, it positions objects by co-ordinates in a 3d space, and then works out the pixel placement depending on your resolution (makes perfect sense for creating images that are compatible with any screen res). The problem that makes for me is that if I move my object across the screen, sometimes it takes up 1 pixel, sometimes 2 (as it crosses a pixel border), and sometimes none, effectively hiding the object.

So I’m still looking for a a method that is more suited to my needs. I would still be interested to hear any suggestions. Thanks.

#231498

You must be logged in to reply to this topic.