Binding images to ofMesh


I’m having a some problems rendering pngs with alpha channels when bound to a rectangular ofMesh made of two triangle strips.

From the front side the images render fine but from the opposite side of the mesh the alpha channel doesnt translate to other images bound to meshes behind it.

The first image (grey silhouette) is fine and is rendered from the ‘front’ side of the mesh. But the second image shows the problem.


Thanks to @bgstaal for the solution.

I’m using ofxGrabCam (camera) to orientate the scene and I need to call glDisable(GL_DEPTH_TEST) after


you probably want to keep your depth testing, but the problem is, those see-through bits of your png’s are writing to the depth buffer, stopping objects behind from being drawn.

the trick is to use something called ‘alpha testing’, which completely abandons any fragments below a certain alpha (not drawing them to the screen since they’re barely visible anyway, but more importantly, not drawing them to the depth buffer).

try putting this after the camera.begin():


1 Like


Thanks Elliot. As you suggest I am now having problems when turning off depth testing, although I can see through the alpha to the object behind their is no stacking order.

I have tried glAlphaFunc(GL_GREATER,0.1f); and turned depth testing back on but the problem persists? The call to glAlphaFunc(GL_GREATER,0.1f); is right after camera.begin():

could you try adding in



Perfect! That did the trick

Thanks very much for your help

or sort it by hand without GL_DEPTH like so ->
greetings ascorbin