You are not logged in.

tmcmillan

Beginner

  • "tmcmillan" is female
  • "tmcmillan" started this thread

Posts: 1

Location: Johannesburg, RSA

  • Send private message

1

Thursday, December 21st 2006, 1:22pm

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

agallers11

Beginner

Posts: 55

Location: MD, US

Occupation: Programmer

  • Send private message

2

Friday, February 9th 2007, 5:18pm

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

3

Monday, June 29th 2009, 6:57am

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..........