Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Use ofGraphics shape as image mask

$
0
0

you can also get a mesh for a circle (or any other shape) really eas using ofPath:

ofPath path;
path.arc(x,y,r,r,0,360);
ofMesh mesh = path.getTessellation();

also in 0.9.0 you can set an alpha mask texture to another texture like:

ofTexture tex, mask;
tex.allocate(w,h,GL_RGBA);
mask.allocate(w,h,GL_LUMINANCE); // or GL_RED in opengl 3+
tex.setAlphaMask(mask);

when drawing tex it'll me be masked by mask using the values in the mask as alpha values. so you can use an ofFbo allocated with GL_LUMINANCE (or GL_RED), draw into it and set it's texture as mask of another texture


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>