Open CASCADE view in QGLWidget.

Is it possible to inherit an Open CASCADE View from a QGLWidget?
Which are the main differences with regard to inherit from a classic QWidget?

Sharjith Naramparambath's picture

OCC does the necessary OpenGL pixel formatting and initialization on the QWidget. On the QGLWidget, Qt already has done the formatting. Once you pass the window handle of the QGLWidget to OCC it will override QGLWidget's pixel settings and write its own. So, essentially, you won't be having any benefit of using the QGLWidget in place of QWidget.

P Dolbey's picture

In fact, on Windows, it should give an error as you can't set up 2 OpenGl rendering contexts on the same window (hDc) - although I had an old Ati card that You
actually allowed this with out an error. And when you change rendering contexts in Qt it completely rebuilds the Window from the hDc up.

However this would be an incredibly useful feature for Qt integration - one possibility is to design a new rendering chain along the lines that Daniel did in HeeksCad.

lgsilva's picture

Thanks for the answers, then I do not know by wich magical reason, the QGLWidget, using the grabFrameBuffer() function, captures the contents of a scene from OpenCascade. By this way I got a screenshot of the window that was my initial problem.

Thanks again.