You could just give OSG the handlers & device contexts to your window and let it control whats displayed on the QT window. This is gonna be operating system dependant though, but heres code to get the stuff you'll need to set your drawing context from QT window for Windows:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <windows.h>
#include <gl/gl.h>
#include <math.h>
#include "viswindow.h"
VisWindow::VisWindow(QWidget *parent)
: QWidget(parent)
{
setGeometry(10,20,795,890);
setVisible(true);
// Get windnow handler
hWnd = (HWND)winId();
//get the device context (DC)
hDC = GetDC( hWnd );
// set the pixel format for the DC
PIXELFORMATDESCRIPTOR pfd;
int format;
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
format = ChoosePixelFormat( hDC, &pfd );
SetPixelFormat( hDC, format, &pfd );
// enable the render context (RC)
hRC = wglCreateContext( hDC );
wglMakeCurrent( hDC, hRC );
}
|
I don't know off the top of my head how to set these contexts, but its probably something you can google... Good luck