Applying a texture with alpha content to jit.gl.sketch
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
i don't see where you are using jit.gl.sketch in the patch you pasted?
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
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.
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.
I want to draw the brush texture using gl.sketch.
-chris
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:
https://cycling74.com/forums/texture-strokes-with-sketch
i've modified your patch to include stroke texturing:
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
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:
Cheers,
Maarten