3D Rendering question

This is from code that used to work perfectly on Mac and Windows.
I have to update it after years of neglect, and the 3D renders differently. I’ve never been great with the guts of OpenGL, so before I paw around blindly in the dark, I’d send this to the forum to see if any of you have an idea to short-track my search.

The issue is the rectangle in the background (I’ve simplified the rest of the model for sake of illustration).

It is a polygon made of 4 points set to show the lines not fill.
Note the diagonal line from top left to bottom right?

On Mac, it behaves as it always had. What’s worth of additional note is that the line weight on all objects seems heavier on Mac than Windows. That was never the case before.

I’m positive that there is just some flag or setting that I now have to use and didn’t back in 2018 when this was first written.

I did update the deprecated 3D control to the new one as well. I had hoped that would solve it by itself but it hasn’t.

Any suggestions will be greatly appreciated.

Is the problem the diagonal line? If so, my guess is that it sees the rectangle as a surface and not a four segment line, possibly being a ever so slightly twisted, and therefore divides it into two triangles. Not all OpenGL applications support lines, so that can cause the problem. Have you tried drawing it as four lines, or making the rectangle not quite a closed shape?

it is a polygon not just four lines, but for sure it isn’t twisted. I can double check all the code again, but if it were it would also be twisted on Mac.

And I do have to make it a polygon so it has sides. I render this with the backside not showing and then invert it. The net effect is that there is a 3d object surrounded by walls with a grid, where the side between the viewer and the object is hidden (so you aren’t looking through it).

I googled this and it seems others have seen the same issue too, but haven’t found a resolution.

The fact that the line weight also isn’t showing the same maybe is an indicator of the issue, but I haven’t uncovered it yet.

Of course the problem for me is that this all worked perfectly well before and without any code change it now isn’t working. But it was working 4 years ago and I don’t know what underlaying libraries may have updated.

Could be that the library just decomposes everything into triangles by default.

it seems that way, but it didn’t do that before.
And I’m still struggling with why the line weight isn’t being respected.

I’m happy to pay for someone’s time to help me uncover this.
I’m certain someone with the right OpenGL knowledge can fix it asap. It was working brilliantly before so it’s likely just a flag or default property that has changed in the api over the last few years.

PM me if you are interested.

@Eugene_Dakin ?

Hello Chris,

I am not sure if this is the cure, and I have noticed that an OpenGL bug has been fixed for Windows. The bug went something like this: Face culling is drawing the front or back of a shape, like a triangle. If the triangle was drawn counter-clockwise then the front of the image was facing you, and drawing clockwise the back of the image was facing you. I can’t remember the order at the moment.


When I created an OpenGL example in the latest version, this had changed.

Maybe try drawing the triangle clockwise instead of counter-clockwise on Windows.

Let me know if this works for your program :slight_smile:

I got that part down. I use that to create a lot of triangles with blended colors from each corner.
Always counter clockwise.
This is something different.
But thank you for the answer!