Initializing the Generic Rendering Context to QT Widgets for OpenGL based application
-
Dear All,
I want to initialize the OpenCascade application (which is OpenGL based) in QT widget application. Normally the generic path to solve those type of issues is only swapping (equalizing) the handles of rendering windows (I presume that this should be QMainWindow) with OpenGL rendering context, from that point on they are known to each other and each knows what to with double buffering technique, where the windows/qwidget copy only the resulting pixels in OpenGL RC to rendering windows.
I've Desktop_Qt_5_4_1_MSVC2010_OpenGL_32bit, OCCT 6.8.0 version,
So :
#1 - The rendering windows in my case must be Mainwidnow: QMainWindow or centralWidget :QWidget based ?
#2 - Below is the sample code which initializes the OpenCascade with WNT window, crucial code portion is MyView->SetWindow(hWnd) which only takes and understands Handle_WNT_Window type argument, how am I supposed to typecast the handle obtained from QWidget, Handle_WNT_Window hWnd = (Handle_WNT_Window) QWidget->GetWindowHandle() ?Your guidance will be appreciated,
HWND winID = (HWND) (winId());
Handle_WNT_Window hWnd = new WNT_Window(winID);
mView->SetWindow(hWnd);
if (!hWnd->IsMapped())
{
hWnd->Map();
}mView->SetBackgroundColor(Quantity_NOC_BLACK);
mView->MustBeResized();
mView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_ZBUFFER);