Linux depth buffering issue

Problems building or running the engine, queries about how to use features etc.
Post Reply
eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Linux depth buffering issue

Post by eventhorizon »

Ogre Version: :?: 1.12.13
Operating System: :?: Debian Linux 11 and testing, also Windows 10
Render System: :?: OpenGL and OpenGL3Plus

Like I said in a previous post, I'm trying to revive an old simulator project of mine called Skyscraper, it runs on Ogre. I ported it from Ogre 1.9 to Ogre 1.12, but not 1.13 due to issues I'm having with that. The main issue I've been having is GL rendering on Linux appears to be broken, it looks like a bad or reversed depth buffer/zbuffer. I've tested Ogre versions 1.9 to 1.12 and they all have the same issue, but older builds of the simulator appear to work fine for some reason (those used Ogre 1.9). I've also tried manually changing depth buffer settings in a number of places, and they didn't seem to make a difference. I'm also running Ogre in double-precision mode, but that doesn't seem to be related to this. Both GL and GL3Plus are like this. I've also tried on a laptop which has Intel graphics, same issue, the main system I'm testing has an Nvidia Quadro. SInce I set up a debug environment with Eclipse on my system for this, I wondered what others on the forum would have to say about this issue, or maybe where to look in the Ogre code.

Here's are two screenshots of the default building's start position being rendered on two platforms. I also attached the simulator's log file, which includes the Ogre log messages.

This is the scene being rendered correctly on Windows using OpenGL:
Image

This is the scene being rendered incorrectly on Linux using OpenGL. The white streaks are the Caelum sky system being rendered in front of some wall objects.
Image

Let me know if I should open a bug report on the GitHub project page, I thought of posting on here first.

Project source code is here if you're interested: https://github.com/eventhorizon5/skyscraper

-eventhorizon

Attachments
skyscraper.log
This is the skyscraper log file, which includes the Ogre output, like ogre.log.
(72.1 KiB) Downloaded 5 times
rpgplayerrobin
Orc
Posts: 416
Joined: Wed Mar 18, 2009 3:03 am
x 218

Re: Linux depth buffering issue

Post by rpgplayerrobin »

Unless Paroj knows exactly what is going on here, I think you will have to provide more information.

Can you reproduce this bug with as little resources/code as possible?
Say for example just one or two different materials and a few 3D models, and no Caelum sky or anything like that.
And also make sure to not use any compositor.

If it still happens then, it will be much easier for other people to help you regarding this, because then we can see exactly how the materials/shaders look (if you post them) and how you actually render them.

eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Linux depth buffering issue

Post by eventhorizon »

I tried modifying an Ogre demo, and while it appeared broken in the same way when a compositor was used, it appeared fine without one. My app is broken even without a compositor.

Since loaded models in mine are drawn over each other, I might see if I can create a demo based on some of my code with models, hopefully it can reproduce the issue. The wall objects are created with a custom procedural geometry system I created, and it's fairly large so that isn't good for a demo. I'll probably try to audit my startup code too and see if I'm doing something that might be causing this.

eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Linux depth buffering issue

Post by eventhorizon »

I at least found the culprit, right now I tried building the sim with an older wxWidgets (one that used GTK2 and not 3), and it's working again, so it's something that wxWidgets is doing. I'll try newer versions of that and see if it's been fixed. Thanks for your help.

eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Linux depth buffering issue

Post by eventhorizon »

For an update with this, I tried having my code create a basic GTK3 window, get the handle to it and have Ogre render to it, and that's broken too, so somehow in my situation Ogre can't use GTK3. I also had Ogre create a window itself, and that renders fine.

eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Linux depth buffering issue

Post by eventhorizon »

I've attached a copy of the BasicTutorial1.cpp that reproduces the bug in a GTK3 window. I've tested it on 2 machines. It'll create a native Ogre window and a GTK3 window to the left, click the native window and hold down a key to advanced the camera to the right to get a better view of the problem. Let me know if this demo works for you.

This demo draws a large ogre in front, with others behind, in the GTK window, the rear Ogre draws over the front one, at least on my systems.

Attachments
depth_bug.tar
(60 KiB) Downloaded 6 times
rpgplayerrobin
Orc
Posts: 416
Joined: Wed Mar 18, 2009 3:03 am
x 218

Re: Linux depth buffering issue

Post by rpgplayerrobin »

It will be very hard to fix this for me as I only know things about Ogre and not GTK.
I would if I were you try to debug this issue on how the actual windows are created differently (which will be very hard to do of course).
Since we know it works with an external SDL2 window together with Ogre, there should not be a problem to get it to work on GTK unless there is some special code that is different there.

You should probably also post about this at the GTK forums (if that exists) and try to get help from there, as they are they are the only ones that knows how their window handle these kind of stuff.

paroj
OGRE Team Member
OGRE Team Member
Posts: 1790
Joined: Sun Mar 30, 2014 2:51 pm
x 936
Contact:

Re: Linux depth buffering issue

Post by paroj »

eventhorizon wrote: Thu Sep 22, 2022 7:59 am

I've attached a copy of the BasicTutorial1.cpp that reproduces the bug in a GTK3 window. I've tested it on 2 machines. It'll create a native Ogre window and a GTK3 window to the left, click the native window and hold down a key to advanced the camera to the right to get a better view of the problem. Let me know if this demo works for you.

This demo draws a large ogre in front, with others behind, in the GTK window, the rear Ogre draws over the front one, at least on my systems.

this works for me. I had to add the gtk main loop and compile Ogre with OGRE_GLSUPPORT_USE_EGL=OFF to see anything though.

eventhorizon
Gnoblar
Posts: 19
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Linux depth buffering issue

Post by eventhorizon »

paroj wrote: Fri Sep 23, 2022 9:52 pm

this works for me. I had to add the gtk main loop and compile Ogre with OGRE_GLSUPPORT_USE_EGL=OFF to see anything though.

Thanks for testing that. After some more testing, I found that my simulator works fine with Ogre 1.13, so it seems like 1.12 and earlier aren't working properly. Were you testing with 1.13? I was using 1.12 since I still need to port my camera interface to 1.13 (right now I hacked up the code somewhat to force it to run properly).

paroj
OGRE Team Member
OGRE Team Member
Posts: 1790
Joined: Sun Mar 30, 2014 2:51 pm
x 936
Contact:

Re: Linux depth buffering issue

Post by paroj »

yes, this was using Ogre 13. Note, that there is the OGRE_NODELESS_POSITIONING build setting.

Post Reply