blodow / realtime_urdf_filter

ROS package that can filter geometry defined in URDF models from Kinect depth images. Can also preprocess data for the OpenNI tracker, to remove backgrounds, robots etc.
Other
89 stars 46 forks source link

Crashing when running on intel igpu #26

Closed mehditlili closed 4 years ago

mehditlili commented 4 years ago

On my laptops nvidia card, the nodes runs with no problems. However, when I switch to using the integrated intel gpu, it crashes at
glTexBuffer(GL_TEXTURE_BUFFER, GL_R32F, depth_image_pbo_); in urdf_filter.cpp line 337. I could manage to make it not crash there by following the suggestion here and adding glewExperimental = GL_TRUE; at line 399 just before
GLenum err = glewInit();

However, OpenGL reports errors then when rendering. [/realtime_urdf_filter_mehdi_t440p_17201_7363565890530630740 ERROR 1574353056.900983425]: OpenGL ERROR at beginning of rendering: invalid enumerant

Did anybody manage to get it to work on Ubutnu 18.04 with an intel iGPU?

JimmyDaSilva commented 4 years ago

I am no expert at all here, but maybe I can give pointers to you ideas to solve this.

1) Did you check this requirement ?

GLSL (GL Shader Language) version 1.40 support or greater GLEW (GL Extension Wrangler) version 1.6

2) Maybe you can relate somehow to issues published for using the Kinect2 GPU acceleration on a Intel iGPU: https://github.com/OpenKinect/libfreenect2

Good luck !

mehditlili commented 4 years ago

Hi Jimmy, I currently have GLEW 2.0. Does it have to be version 1.6 or any version above is fine?

Here is the output of glxinfo | grep OpenGL with both intel and nvidia cards on the same laptop


Nvidia

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 730M/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 390.116
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 390.116
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.116
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

Intel

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.2.1
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 19.2.1
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 19.2.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

In this case OpenGL shading language version string: 1.30 seems to be the problem. I have an i7-4600M

Is that version related to hardware or to software? Do you know anyway to update it? I tried insalling the latest mesa drivers but it didn't help.

JimmyDaSilva commented 4 years ago

In this case OpenGL shading language version string: 1.30

I think that this is your problem too

Is that version related to hardware or to software? Do you know anyway to update it? I tried insalling the latest mesa drivers but it didn't help.

No idea. But my guess would be no.

mehditlili commented 4 years ago

So after going through some forums I think I know what the problem is but don't know how to solve it. urdf filer needs GLEW 1.4 or higher. When loading the opengl library in compatibility mode it gets these versions when on intel

OpenGL version string: 3.0 Mesa 19.2.1
OpenGL shading language version string: 1.30

and these when on nvidia

OpenGL version string: 4.6.0 NVIDIA 390.116
OpenGL shading language version string: 4.60 NVIDIA

So the version loaded with intel is too old unfortunately.

I thought the solution is to use OpenGL core profiles as their versions are newer even on the intel cpu. by adding:

    glutInitContextProfile(GLUT_CORE_PROFILE);
    glutInitContextVersion(4, 5);

before glutCreateWindow ("Realtime URDF Filter Debug Window");

It will then load

OpenGL core profile version string: 4.5 (Core Profile) Mesa 19.2.1
OpenGL core profile shading language version string: 4.50

Unfortunately, it seems GLEW doesn't work well with core profiles and all extensions disappear. This can be avoided by setting glewExperimental = GL_TRUE; before GLenum err = glewInit();

However OpenGL still then reports problems while the node is running and no mask is generated.

mehditlili commented 4 years ago

adding this to the launch file <env name="MESA_LOADER_DRIVER_OVERRIDE" value="iris" /> Or setting it manually before starting the launch file will fix the problem.