GeomPrimitive crossing

I’m creating GeomPrimitives in my project, and when some of them crossing each other, i get something like this:

But i want this:

How to do that?

Welcome to the forums!

So, if I understand correctly, if you have two overlapping triangles, you want them to cancel each other out?

This is not really how primitives work in OpenGL, but you may be able to get this effect using stenciling techniques. I have no experience with stencil testing and stuff, but I’m sure there are OpenGL tutorials out there that easily translate to Panda’s StencilAttrib calls. I may be wrong, though, and maybe stenciling has nothing to do with it.

Failing that, you would probably need to write some code that calculates the intersections of your triangles appropriately, which sounds like a lot of work.

Oh, i just realized that when i was drawing primitives with OpenGL, it was Glu Tesselator calculating all intersections and holes.
And now i’m trying to use Panda3d Triangulator, which requires to separately add polygones and holes.
Thank you for helping!