Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
OSG and QT
Hi QT Community
I'm trying to integrate an OSG (open scene graph) model into a qt QGraphicsView widget however I have had no luck at accomplishing this.
Has anyone intergrate OSG and QT before and if so do you have any hints.
One of the main problems I face is to get the Qt form to refresh and remain active while the OSG viewer is running.
Any advise would be most appreciated
Thanks
Tristan
RE: OSG and QT
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
how to run the example osgViewerQt
hey I am a begginer to this
I wanted to know how can i run the example osgViewerQt in linux platform
I am working with qt4.4.
please help..........