Fri, 12/10/2021 - 16:52
Hello,
I have migrate my Qt/OCC integration from V3d_View/QWidget to V3d_View/QOpenGLWidget like done in the OcctQtViewer sample application https://github.com/gkv311/occt-samples-qopenglwidget but now the linewidth of wireframe shape is not working anymore (see difference in attached image, left is V3d_View/QOpenGLWidget and right is V3d_View/QWidget from my application before I migrate).
I am using OCC 7.6.0 for my application. I tested the following snippet:
{
// dummy shape for testing
TopoDS_Shape aBox = BRepPrimAPI_MakeBox (100.0, 50.0, 90.0).Shape();
Handle(AIS_Shape) aShape = new AIS_Shape (aBox);
aShape->Attributes()->SetupOwnFaceBoundaryAspect();
aShape->Attributes()->UnFreeBoundaryAspect()->SetWidth(5);
aShape->Attributes()->SetUnFreeBoundaryAspect(aShape->Attributes()->UnFreeBoundaryAspect());
myContext->Display (aShape, AIS_WireFrame, 0, false);
}
So line width is not working, but I tested point size (using a vertex instead of the box shape) and the point size is working.
Does anyone have any clues on why it is not working and how to fix this, is it a bug?
Best regards,
François.
Fri, 12/10/2021 - 21:12
What "About sample" shows you about OpenGL / prints into console?
Fri, 12/10/2021 - 21:38
I have attached a screenshot of the "About sample".
Here is a similar output from the application with V3d_View/QWidget integration:
2021-12-10 13:36:31.776 prt critical thread=42292: OpenGL informations...
2021-12-10 13:36:31.827 prt critical thread=42292: GLvendor: ATI Technologies Inc.
2021-12-10 13:36:31.828 prt critical thread=42292: GLdevice: Radeon RX Vega
2021-12-10 13:36:31.830 prt critical thread=42292: GLversion: 4.6.14761 Compatibility Profile Context 21.11.1 30.0.13033.1000
2021-12-10 13:36:31.831 prt critical thread=42292: GLSLversion: 4.60
2021-12-10 13:36:31.832 prt critical thread=42292: Max texture size: 16384
2021-12-10 13:36:31.834 prt critical thread=42292: Max FBO dump size: 16384x16384
2021-12-10 13:36:31.835 prt critical thread=42292: Max combined texture units: 160
2021-12-10 13:36:31.836 prt critical thread=42292: Max MSAA samples: 8
2021-12-10 13:36:31.837 prt critical thread=42292: Viewport: 779x513
2021-12-10 13:36:31.839 prt critical thread=42292: GPU memory: 8176 MiB
2021-12-10 13:36:31.840 prt critical thread=42292: ResolutionRatio: 1
Fri, 12/10/2021 - 23:59
Qt has quite weird interface to select Core / Compatible profiles in OpenGL. Just comment the line "QSurfaceFormat::setVersion()" to get Compatible Profile which supports line width.
Sat, 12/11/2021 - 00:03
Thank you Kirill, now it is working properly!
François.
Mon, 11/03/2025 - 09:09
Is it possible to set line width in Core profile? In the following code, the line width is not working in core profile, but it works in compatible profile.
Fri, 01/16/2026 - 07:13
Liu Yang wrote:
No it's impossible right now.
OpenGL Core Profile deprecated thick lines, and OCCT disables this feature when Core Profile is requested.
But apparently, this was done wrong - most OpenGL Core Profile implementations (normal drivers on Windows, Mesa drivers on Linux, etc.) still support thick lines, and OCCT could use them.
For other implementations (macOS and drivers implementing OpenGL on top of Direct3D like WSL2) - this is not possible until OCCT will not implement emulated wide lines. Though you may draw thick mesh edges.