Hi,
I am trying to bind a transparent png to a ofMesh. The png is a simple white hexagon on transparent background.
My aim is binding that to a mesh with 6 vertices and use it as a mask. However I get a strange behaviour. The mesh doesn’t show up when I draw it but if I draw it together with the image, I can see it.
I don’t get it.
Any good hint anyone please?
Thanks
ofPushMatrix();
ofTranslate(500,500);
ofEnableAlphaBlending();
maskImg.getTextureReference().bind();
// maskImg.draw(100, 100); // if I uncomment this I see nothing.
mymesh.draw();
maskImg.getTextureReference().unbind();
ofDisableAlphaBlending();
ofPopMatrix();
How are you generating the mesh? Are the texture coords from 0 - maskImg.getWidth()?
Can you just use the image as a mask?
ofPlanePrimitive can generate its size and tex coords from a texture.
ofPlanePrimitive plane;
plane.resizeToTexture( maskImg.getTextureReference() );
Hi @NickHardeman
the mesh is generated by the vertices of a feature from ofxFaceTracker. it has a squashed hexagon shape. (see on the left). On the right there is the png I am using.
The final aim is using the png together with ofxLayerMask to smooth the edges of the mesh as unfortunately I haven’t found a better way with my actual coding skills.
(I know it’s clumsy and I should maybe use open gl but I have to find a time efficient way to sketch this and I I know zero about opengl.)
The reason why I am not using the img itself as a mask is because it doesn’t follow the full tracking (i.e., rotation and orientation).
I hope this makes sense somehow?
cheers