cgal icon indicating copy to clipboard operation
cgal copied to clipboard

The function 'CGAL::draw' shows black triangle instead of polygon

Open alekseYY opened this issue 2 years ago • 9 comments

Issue Details

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. The window with the black triangle is attached.

#!/bin/bash

VERSION=CGAL-5.4.1

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

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

cd examples/Polygon
make draw_polygon
./draw_polygon&

The result is below.

Screenshot_2022-07-13_13-25-37

My question about this issue is on SO as well - https://stackoverflow.com/questions/72946813/why-does-the-function-cgaldraw-draw-a-black-triangle-instead-of-a-polygon-in

Source Code

<CGAL 5.4.1 examples root>/Polygon/draw_polygon.cpp

Environment

  • Operating system: Ubuntu 20.04.4 LTS
  • Compiler: g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
  • Release or debug mode: both
  • Specific flags used (if any): none
  • CGAL version: 5.4.1
  • Boost version: 1.71.0
  • Other libraries versions if used (Eigen, TBB, etc.):

alekseYY avatar Jul 13 '22 17:07 alekseYY

Can you provide the information printed on the console when running the example in both cases?

sloriot avatar Jul 15 '22 07:07 sloriot

In both cases there is only one line:

    Using context  2 . 1 GL

The OpenGL version string:

    glxinfo | grep "OpenGL version"
    OpenGL version string: 2.1 Mesa 21.2.6

alekseYY avatar Jul 15 '22 14:07 alekseYY

I cannot reproduce your problem but I am on Windows with VC++. Concering OpenGL I see "Using context 4.3 GL".

afabri avatar Aug 03 '22 11:08 afabri

Guillaume, I think you need old graphics hardware to reproduce this problem. I have an old laptop (2008), which gives me this trouble, however everything is good on more recent hardware (3-4 years old)

alekseYY avatar Aug 17 '22 04:08 alekseYY

Guillaume, I think you need old graphics hardware to reproduce this problem. I have an old laptop (2008), which gives me this trouble, however everything is good on more recent hardware (3-4 years old)

Sorry @alekseYY but I don't have any old graphics hardware; and more problematic I don't have any competence in shader code. @MaelRL I am sorry but you need to assing this issue to a specialist of shaders and graphics drivers.

gdamiand avatar Aug 18 '22 17:08 gdamiand

I would suggest to close this as it makes no sense to support laptops from 2008 for just a draw function.

afabri avatar Aug 19 '22 08:08 afabri

I would suggest to close this as it makes no sense to support laptops from 2008 for just a draw function.

I think it'd be more reasonable to modify CGAL Qt-related code a little to tell users that something isn't supported. Seeing garbage on the screen confuses people

alekseYY avatar Aug 19 '22 13:08 alekseYY

@alekseYY your contribution is welcome.

afabri avatar Aug 19 '22 13:08 afabri

@alekseYY your contribution is welcome.

@afabri - I think you can use exceptions to tell users that the CGAL::draw might fail. The one additional line in the beginning of the Basic_viewer_qt constructor (the file Qt/Basic_viewer_qt.h, after line 162) will do just that:

if (not isOpenGL_4_3()) throw std::system_error(std::make_error_code(std::errc::not_supported), "QGLViewer error");

Then calls to the CGAL::draw will need to be inside the (optional) try block.

alekseYY avatar Aug 28 '22 16:08 alekseYY