Forums > Javascript

getting the alpha channel functioning in javascript

Feb 24 2014 | 5:03 pm


I’m looking to do some procedural drawing in Max/MSP using simple shapes. As it’s a lot easier to make particle systems using line code (for me at least), I’d like to keep the drawing commands within the js object, with some commands to be changeable according to the rest of the patch in real-time.

I really want to use transparencies, but I can’t seem to get the alpha channel working. I have stripped the patch down to the basics here. Can anyone see where I might be missing something?

The patch should be below, with js file added as attachment.




— Pasted Max Patch, click to expand. —
  1. shapetest.js
Feb 25 2014 | 5:34 am

I have a feeling that if I could figure out how to delineate layers within a sketch object, all of my problems would be solved. something like sketch.layer(0), etc, if some sort of similar functional command might exist.

Feb 25 2014 | 11:00 am

i am unable to open your patch. try using copy-compressed.

make sure you have depth disabled (@depth_enable 0) and blending enabled (@blend_enable 1) on your gl.sketch.

Feb 27 2014 | 4:01 am

I think I fixed the patcher code :/
blend is enabled and depth is disabled. I’ve been playing with a few glblendfunc options as well. Nothing seems to be working.

  1. shapetest1.js
Feb 27 2014 | 4:04 am

The patcher code will paste in max 6 if the begin_max5_patcher and end_max5_patcher lines are excluded.

Feb 27 2014 | 10:16 am

please create a zip archive of both the patcher and the js file and attach that.

Feb 28 2014 | 3:43 am

ok, here goes. Thanks for your patience!

Feb 28 2014 | 9:45 am

add the following lines to your js, after creating the sketch object:

Viewing 8 posts - 1 through 8 (of 8 total)

Forums > Javascript