cgal
cgal copied to clipboard
The function 'CGAL::draw' shows black triangle instead of polygon
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.
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.):
Can you provide the information printed on the console when running the example in both cases?
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
I cannot reproduce your problem but I am on Windows with VC++. Concering OpenGL I see "Using context 4.3 GL".
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)
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.
I would suggest to close this as it makes no sense to support laptops from 2008 for just a draw function.
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 your contribution is welcome.
@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.