notes from the bigfug

notes from the bigfug

programming light and other strange tales

notes from the bigfug RSS Feed
 
 
 
 

PatchBox r161

Yesterday was a good coding day. Rested and replete from some serious mince pie and hot chestnut ingestion the day before, I sat down and added LUA support.

For years the plan was to have the entire internal system of PB available for scripting. Previously I’ve messed about with various approaches but have settled on a hierarchical tree of named wxVariant objects.

This benefits me in three ways:

  1. it’s instantly ready to be tied into OSC as the naming conventions are exactly the same
  2. using wxVariant saves having lots of classes for each type
  3. using the OSC addressing scheme in LUA reduces the need for a lot of class specific functions and provides a quick way to access new functionality without having to write a lot of supporting glue code

At the moment there are only global functions as I’m just using light user data so the code looks like this:

-- test_000.lua
root = pb.getroot();      -- returns the object that the script was dragged 'n' dropped on
var_alpha = pb.getchild( root, 'alpha' );
pb.setvalue( var_alpha, 0.5 );

Which is obviously pretty long winded and confusing. Have already partially written the code for using LUA objects instead but just need to make sure it’s going to be workable without introducing class dependence.

Bolstered by that success I also turned my hand to adding OpenGL shader support. I’m almost ashamed to admit I’ve not really gotten into shader programming as yet. Have been too busy pushing pixels around with the CPU, and besides I haven’t been using any visual software that supported them. Until now!

My original thinking was that shaders would act a bit like textures: you can drag and drop them onto geometry but reading up and refining my understanding of how they worked I realised there may be some interesting possibilities for not only shifting off workload to the GPU, but also expanding on the flexibility of the application.

At the moment PB supports multitexturing and the default blending modes - this is added in the code, but by moving that part into the shader, and just expanding the properties system to be able to drag and drop textures into the configuration of the shader, I can get rid of that hard coded functionality, reduce the amount of GL instructions I need to call per frame, and get much more flexibility. Sounds like a plan to me!

One Response to “PatchBox r161”

  1. 1
    charles crammond:

    hey man sorry I couln’t make it out for a beer, totally drowned in AE related advertising shite. I’ve got 45% done out of 5% when I spoke to you and that makes me 200% late still. Wankers with their made up deadline.
    Anyway yes get your ass down with shader shite, you know its good, ‘part frmo the fact it don’t seem to buffer stuff too well, it’s all about the instant executuion not what happened before or might happen afterr (check the vvvv.org echo filter for what I’m rambling about)but I s’pose you got your own buffer anyhoo with the fugScratch.
    OSC seems to be a good thing to support, can’t wait for midi to die its a fucking stupid protocol.

Leave a Reply