Search code examples
c++qt5visualizationcgal

Why does the function 'CGAL::draw' draw a black triangle instead of a polygon in the latest version of CGAL?


I've upgraded my CGAL installation to the latest version (5.4.1) and I can't use the function CGAL::draw anymore - it draws a black triangle instead of everything I need. It's not a problem in my code - even standard examples from the CGAL distribution behave this way. The script below unpacks the CGAL tar-file, then builds and runs the draw_polygon example from this tar-file.

#!/bin/bash

VERSION=CGAL-5.4.1

tar xJvf ${VERSION}.tar.xz && cd ${VERSION}

mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_examples=ON ..
make

cd examples/Polygon
make draw_polygon
./draw_polygon&

The result is below:

CGAL-draw-result

If to set the VERSION variable in the script above to the value CGAL-5.2.4 - then the drawing will be correct. What's the problem here?

  • OS: Ubuntu 20.04.4 LTS
  • Compiler: g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

UPDATE. I've opened an issue on the CGAL bug tracker.


Solution

  • I'm answering my own question.

    The issue here is that starting from the version 5.3 the CGAL library Qt5-based visualization subsystem doesn't support old graphics hardware - at least on Linux machines (no idea about Windows or Mac worlds).

    It looks like the OpenGL implementation on Linux (called Mesa) checks the graphics hardware in run time and creates graphics context, corresponding to this hardware. So, for the CGAL visualization to work correctly this context must be at least OpenGL 3.2, and corresponding shading language must be at least GLSL 1.50.

    For more information about these versions etc. please see here.