Incorrect ordering of rendered objects


I am using vtkSTLReader to read a mesh, connected to a vtkPolyDataMapper and then a vtkLODActor to display the mesh. However, from certain viewpoints the “ordering” of parts of the mesh is incorrect, see the screenshots below:

I have previously used the exact same code on an NVidia GPU using the NVidia drivers on Linux, and this issue was not present. The strange rendering with the ordering issue happened only on an AMD GPU using the amdgpu driver on Linux. Other non VTK 3D applications I have used seem to work fine using this driver.

I am using a vtkGenericOpenGLRenderWindow with a QVTKOpenGLWidget within a Qt 5 application, in case that is relevant.

Does anyone have any hints as to what might be the problem?

Thank you.

Short update:

Running the program with MESA_DEBUG=1, the following warning is produced:

Mesa: User error: GL_INVALID_OPERATION in glGetFramebufferAttachmentParameteriv(invalid pname GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE)

It seems like this might be related to the depth-ordering of the objects?