setting dim dynamically in jit.mgraphics

    Nov 12 2012 | 10:56 am
    Is is not possible to set the dimension of a jit.mgraphics matrix dynamically? It does not respond to the dim message, although getdim does output the dim out of the right inlet.

    • Nov 14 2012 | 3:43 am
      Anybody? Is this a bug? Or some sort of essential limitation of the jit.mgraphics object? Is it possible that you can only set the dimensions of the matrix produced by jit.mgraphics in the arguments to the object? I tried using an attrui object as well, but the dimensions are not editable, except by literally retyping the arguments in the object box. Don't make me go back to using jit.lcd ;) I'm trying to construct an alpha channel out of various drawn shapes using jit.mgraphics, but the size of the matrix I'm working with can vary dynamically depending on logic elsewhere in the patch. There is an adapt flag, but since jit.mgraphics does not take a matrix in I can't trick it by setting the flag and sending it a matrix that I've "dimmed" to the desired size. Planecount cannot be changed either...
    • Nov 14 2012 | 5:49 pm
      there does seem to be an issue with attrui and the dim attribute, however sending a message to change the dim works fine. of course the scene is cleared/reset when you change the dim.
      in general, dynamically changing matrix dims is not the best solution. maybe either keep uniform dims (but upscaling or downscaling your source images), or up/down scale the matrix coming out of jit.mgraphics.
    • Nov 15 2012 | 2:49 am
      Hi Robert, Your right, after doing my tests over it does seem I missed that the dim message was working, just not reporting correctly with "getdim". Below is a simple demo patch that passes the jit.mgraphics matrix to a jit.matrix object and tests dims before and after. Just curious, why do you say that dynamically changing the matrix dims is a bad solution? I'm building a utility that can take an image or movie of any size and build a certain (precise, pixel-matched) alpha channel for it - its important that I preserve the original dimensions, which would change for every image/movie processed. I guess I need to be careful to clear the scene, then resize my jit.mgraphics "canvas" (ie dim it), then do my drawing, so that the change to the dim does not come unexpectedly... Thanks for your help
    • Nov 15 2012 | 7:00 am
      yeah, the dim attribute reporting is definitely broken. thanks for pointing that out. we'll get this fixed up for a future update. fortunately the output matrix is correct.
      it sounds like you have a specific reason for resizing, so that should work fine for your needs.