Issues with faces on polygons with custom scene node

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
janis
Posts: 2
Joined: Sun Jul 25, 2021 3:42 pm

Issues with faces on polygons with custom scene node

Post 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?
CuteAlien
Admin
Posts: 9646
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Issues with faces on polygons with custom scene node

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
janis
Posts: 2
Joined: Sun Jul 25, 2021 3:42 pm

Re: Issues with faces on polygons with custom scene node

Post by janis »

Ah alright, I'll use triangles then. cheers.
Post Reply