Page 1 of 1

Issues with faces on polygons with custom scene node

Posted: Sun Jul 25, 2021 4:09 pm
by janis
Hello,

I'm trying to make a custom scene node for authoring meshes. I'm not very familiar with how OpenGL or DirectX work so I'm not sure what it's supposed to look like in their respective API either.

I'd like to draw a U shape. To start out testing I was using the line loops to make sure the shapes were closed. I've followed the the tutorial on creating the class and I added my own function for adding vertices. It seemed to be working fine, but then I switched to drawing with EDT_POLYGON and I'm getting weird results (white shape):

Image

When trying to place points for the U shape the poly draws in weird ways. It looks like it skipped a face and one of them is cutting across the opening.

I'm doing something wrong, but the documentation is pretty sparse and I haven't able to find any code examples using EDT_POLYGON. I've tried to read how OpenGL uses it, but they are talking about buffers and bindings and I get a bit lost. Am I approaching this problem wrong or are there maybe other examples available of something similar?

Re: Issues with faces on polygons with custom scene node

Posted: Sun Jul 25, 2021 6:47 pm
by CuteAlien
It's only working with convex polygons. U shape is concave (the contour has a cave).

Irrlicht 1.8 also hasn't updated comments for EPT_POLYGON yet as (Irrlich trunk does). Basically EPT_POLYGON is outdated and it's better to not use anymore. It doesn't work on Direct3D and newer OpenGL are also dropping support. The problem is that it's really slow as you need one draw call for each polygon drawn that way. So it's better to create meshbuffers made out of triangles instead.

Re: Issues with faces on polygons with custom scene node

Posted: Sun Jul 25, 2021 10:48 pm
by janis
Ah alright, I'll use triangles then. cheers.