Forums > Jitter

Applying a texture with alpha content to jit.gl.sketch

April 9, 2012 | 9:28 pm

Hi guys,

So in a broad sense I’m trying to apply a texture with alpha properties to a jit.gl.sketch object so it creates a nice brush effect.
If you take a look at the patch below, Nesa created a texture by using brushtips.mov, and some clever alpha stuff.

I understand how this works with jit.gl.gridshape [plane], as the erase_color is set to 0 (nothing gets erased), and the series of planes with brush images create a nice brush effect.

However, I tried to then send this texture to a jit.gl.sketch, to see if I could get the brush effect on the stroke, I tried this by setting the jit.gl.sketch [@capture] to capture the brush texture from the patch below, however it only seems to receive the color of the texture, but not the alpha content/effect.

Now my conclusion is that jit.gl.sketch just simply doesn’t allow alpha values for a captured texture, however I’m hoping you guys can prove me wrong!

cheers,

-chris

– Pasted Max Patch, click to expand. –

April 9, 2012 | 9:32 pm

i don’t see where you are using jit.gl.sketch in the patch you pasted?


April 9, 2012 | 9:39 pm

That isn’t my patch Robert, that’s one Nesa posted showing how to jit.gl.gridshape and alpha’d images to create the effect.
I was wondering if there’s a way of applying this texture (alpha’d images), to a jit.gl.sketch object (what I’m currently using in my project).

-chris


April 10, 2012 | 4:18 pm

it should work fine with a gl.sketch. you might have to blend_enable explicitly in the command list, i’m not really sure.
post you’re attempt to get it working and we can offer some help.


April 10, 2012 | 5:37 pm

I can’t find the old patch I did before, but basically here’s a quick patch of what I’m trying to do.

-chris

– Pasted Max Patch, click to expand. –
Attachments:
  1. brushtips.mov

April 11, 2012 | 10:04 am

do you want to capture the output of your gl.sketch to texture, and use that texture as the brush image?

or do you want to draw the brush texture using gl.sketch (which requires binding the texture in your sketch command-list before drawing any geometry) ?

it’s not clear from your example patch or your description which result you are going for.


April 11, 2012 | 12:24 pm

I want to draw the brush texture using gl.sketch.

-chris


April 11, 2012 | 9:51 pm

if you want to texture your strokes, then you don’t want to set the @capture attribute of gl.sketch to your stroke texture, but instead bind that stroke-texture in the cmd-list.
you also need to set the texture strokeparam.
lastly, the texture needs to be non-rectangular to work with strokes

some more info in this post:

http://www.cycling74.com/forums/topic.php?id=27974

i’ve modified your patch to include stroke texturing:

– Pasted Max Patch, click to expand. –

April 11, 2012 | 10:22 pm

Wow. Thanks Rob, thanks for going the extra mile and modifying the patch!

There’s been so many posts around this, but I struggled to piece it together mentally, so again thanks for helping me out this much!

-chris


May 21, 2014 | 3:35 am

Nice patch! What I don’t understand is why "strokeparam texture" needs to turn on/off while drawing for this to work?

I tried it with the automatic drawing mode and a mouse drawing mode I implemented:

– Pasted Max Patch, click to expand. –

Cheers,
Maarten


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