Irrlicht / Qt4 integration + QtCreator

A forum to store posts deemed exceptionally wise and useful

Re: Irrlicht / Qt4 integration + QtCreator

Postby serengeor » Fri Oct 21, 2011 10:22 am

YankzzDev wrote:
serengeor wrote:
YankzzDev wrote:hmmm, i have another question...


after i load the model, it's displayed on the screen, but i load another model, it's displayed 2 model with selected one and previous one...

how i can clear the previous one?


Read the F***** API and get some c++ skills :|
Not trying to be rude, but basically it seams that we're programming for you.


the rude one is you... i not asking you to programming for me.....

Because i don't understand so i ask..

i am not expert like you(C++ Expert maybe than C++ god)..

i am newbie in c++ and irrlicht engine too...

my basic languange is vb.net..

if i don't understand, so i ask? it's fault?

It's bad to ask someone for doing something for you without putting any effort into it yourself. If you want to code irrlicht apps/games you will have to learn c++ or use a wrapper for .NET, theres no excuse as "my basic languange is vb.net.." so I need you guys to do this for me!

i am not expert like you(C++ Expert maybe than C++ god)..
I'm far from expert myself and I might have asked these questions myself, but now I see that doing research on your own makes life easier most of the time.

Just try to study and understand how c++ works, than reading api will be easy enough :)
Working on game: Marrbles (Currently stopped).
User avatar
serengeor
 
Posts: 1695
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Irrlicht / Qt4 integration + QtCreator

Postby rookie » Tue Jan 10, 2012 11:43 pm

I am trying to embed kinect with qt & irrlicht. I am able to display irrlicht in 1 window & my kinect stream in other window. When I merge them nothing shows up on top of the kinect stream. I am trying to recreate something like this.
http://www.youtube.com/watch?v=1jbvnk1T4vQ

I am doing all the model rendering A& physics using irrlicht & want hem to display stuff over the body displayed in kinect stream. Right now I am able to display my shirt model in a different window using irrlicht but can't merge them. I used the following to merge them but nothing shows up

Params.WindowId = (void *)winID;

winID is winId() returned from the QMainWindow. My model is derived from Qgraphicsitem. I can' use QWidget since I can't display the widget over the video stream. The widget overwrites the kinect video stream that is the video stream is not displayed if I use QWidget & hence I am using QGraphicsItem. Please help me. Also how to setup the irrlicht camera so that it shows the stream correctly??
rookie
 
Posts: 16
Joined: Thu Dec 29, 2011 9:44 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby aanderse » Wed Jan 11, 2012 12:12 am

i'm not entirely sure about the issue, but i can tell you that using the id of the main window isn't what you want
in qt the main window has a "centralWidget" which is the widget you want to grab the id from
you can set the central widget to any widget you like via setCentralWidget
User avatar
aanderse
 
Posts: 155
Joined: Sun Aug 10, 2008 2:02 pm
Location: Canada

Re: Irrlicht / Qt4 integration + QtCreator

Postby rookie » Wed Jan 11, 2012 8:54 pm

Thanks for your help. I tried using this->centralwidget() but that returns 0. I tried setCntralWidget(widget) to the widget which has all qgraphicsviews but no change. I tried adding IrrlichtDevice to the setcentralwidget but obviously doesn't accept irrlichtdeivce parameters. Since I am doing all my irrlicht stuff inside qgraphicsitem would that cause any problems??
rookie
 
Posts: 16
Joined: Thu Dec 29, 2011 9:44 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby aanderse » Thu Jan 12, 2012 3:19 am

well...

i haven't tested, but you might try something like this:

QWidget *irrlichtWidget = new QWidget ();
irrlichtWidget->setAttribute (Qt::WA_OpaquePaintEvent, true);
irrlichtWidget->setAttribute (Qt::WA_PaintOnScreen, true);

QGraphicsProxyWidget *proxyWidget = yourGraphicsScene->addWidget (irrlichtWidget);

now proxyWidget is your graphics item

i'd be interested to hear if that works or not
User avatar
aanderse
 
Posts: 155
Joined: Sun Aug 10, 2008 2:02 pm
Location: Canada

Re: Irrlicht / Qt4 integration + QtCreator

Postby rookie » Thu Jan 12, 2012 7:18 pm

I have already created a class derived from QGraphicsItem that is Model. I am doing all irrlicht rendering inside Models paint function. So when I create a Models instance & add it to QGraphicsScene it should draw the irrlicht rendering since I have merged the window where kinect stream is being displayed with he irrlicht window. Also I have already added the following lines in my MainWindows constructor
QGLWidget *widget = new QGLWidget(QGLFormat(QGL::SampleBuffers));
widget->makeCurrent();

view->setViewport(widget);
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);

Also the documentation says QGLWidget & QgraphicsProxyWidget shouldn't be merged. I tried using Qwidget irrlichwidget instead of QGLWidget without QgraphicsProxyWidget & it still remains the same. Where should I use proxyWidget because when I don't use it it says

QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent

& it automatically shuts down the program without displaying any kinect video stream. It doesn't give me this error when I am adding many other Qlabel to the scene.

Also I just found out that the irrlicht window is being displayed behind the window which displays the kinect video. Any idea how to solve that.
Thank a lot for all your help.
rookie
 
Posts: 16
Joined: Thu Dec 29, 2011 9:44 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby rookie » Thu Jan 12, 2012 11:47 pm

@aanderse I got the setCentralWidget working but the model still doesn't show up.

Can anyone help me with the following??
viewtopic.php?f=1&t=45611
rookie
 
Posts: 16
Joined: Thu Dec 29, 2011 9:44 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby aanderse » Fri Jan 13, 2012 4:02 am

after looking at your new thread i want to mention that on the first page of this thread there is a QIrrlichtWidget class which should help you out
User avatar
aanderse
 
Posts: 155
Joined: Sun Aug 10, 2008 2:02 pm
Location: Canada

Re: Irrlicht / Qt4 integration + QtCreator

Postby rookie » Fri Jan 13, 2012 7:31 pm

I know but I don't want it to be QWidget...Anyways thanks for your help
rookie
 
Posts: 16
Joined: Thu Dec 29, 2011 9:44 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby ritti » Tue Jul 03, 2012 12:53 pm

Hi, first of all thx for this nice tutorial.
I have a Problem with actions that were done during the game runs.
I started with the Irrlichts tutorial 07.Collision and built on it so now i can select and send units around with the mouse.
The Problem is that all this is in a while loop:
cpp Code: Select all
    while(mainWindow.getIrrlichtWidget()->getIrrlichtDevice()->run())
    if (mainWindow.getIrrlichtWidget()->getIrrlichtDevice()->isWindowActive())
    {... //code to send units around and watch for collisions
 

If i do so i wont never get to
cpp Code: Select all
return app.exec();

So the window never opens
All works fine if i remove the loop but i cant send units around.
How do I have to do it so that the window opens and the QWidget updates on changes?
I hope u know what I mean :)
Thx Ritti
ritti
 
Posts: 54
Joined: Tue Apr 10, 2012 12:09 pm

Re: Irrlicht / Qt4 integration + QtCreator

Postby Virion » Wed Jul 04, 2012 9:01 am

hi ritti. check out the first post again. you will see the implementation of timerEvent():
cpp Code: Select all
void QIrrlichtWidget::timerEvent(QTimerEvent* event)
{
    // Emit the render signal each time the timer goes off
    if (device != 0)
    {
        emit updateIrrlichtQuery(device);
    }
 
    event->accept();
}

basically it will run emit updateIrrlichtQuery(device); on every frame, which, works just like while(mainWindow.getIrrlichtWidget()->getIrrlichtDevice()->run())
therefore, you should put your "send units around" and "watch for collisions" code within the updateIrrlichtQuery() function, since it's called on every frame. Hope this help.
User avatar
Virion
 
Posts: 2102
Joined: Mon Dec 18, 2006 5:04 am
Location: Malaysia

Re: Irrlicht / Qt4 integration + QtCreator

Postby ritti » Sun Jul 15, 2012 8:00 pm

Ah jeah cool thx for your answer it works great now :)
ritti
 
Posts: 54
Joined: Tue Apr 10, 2012 12:09 pm

Previous

Return to FAQs, Tutorials, Howtos, and external tool lists

Who is online

Users browsing this forum: No registered users and 1 guest