[Interest] [QT3D] :QEntity OR QNode

Pierre Chicoine pierrechicoine606 at gmail.com
Thu Apr 28 21:59:23 CEST 2016

Dear Sirs

First: Thank you for Qt3d. The KDAB people are heroes in my book.

I have two problems in C++ Qt3D.

1. I am having a difficult time figuring out how to render QEntities into
separate QViewports. All my 3d objects draw to the first QViewport, the
rest are black. I have read all your articles and comments everywhere on
the Internet that I can find and I am basically confused.

Is there a c++ example that would show multiple viewports with distinct
separate QEntities? I can't seem to duplicate The QML example multiviewport
in my code. What classes would get me there?

2. Also I'm also confused about QNodes and QEntitys and their
relationships. Maybe it's the use of Qt3d version 1 that is messing me up .
I use to have a scene node and all the entities would hang off of one scene
node for each scene. But that doesn't seem to work in version 2. Or do I
use the  addComponent on a QFrameGraph instead of a node? Or do I hang
Entities off of a viewport?

Attached is a pic of my progress which draws all the objects into the same
viewport. The window tiles 2 windows properly but I only draw to one
viewport, the second or third stay black. The code here is what I repeat in
each scene class. It's a bit of a mess thrown together to test Qt3D classes
because I don't understand the relationships between all the Qt3D classes
used to place objects in a viewport.

 Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera( pParentNode);



 cameraEntity->setAspectRatio(1024 / 768);

 cameraEntity->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));

 cameraEntity->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));

 //cameraEntity->lens()->setPerspectiveProjection(60.0f, 16.0f/9.0f,
0.1f, 1000.0f);

 if(pScenesSet) // if it's a scene then we want to set it where they want it

  cameraEntity->setPosition(QVector3D(pScenesSet->CamXPos - 20,
pScenesSet->CamYPos + 80, pScenesSet->CamZPos));

 else // so it's a schematic

  cameraEntity->setPosition(QVector3D(-20, 65, 180));

 theApp->input->setCamera(cameraEntity); // not sure about this relationship??

 // FrameGraph

 pQFrameGraph = new Qt3DRender::QFrameGraph();

 pQTechniqueFilter = new Qt3DRender::QTechniqueFilter();

 pQViewport = new Qt3DRender::QViewport(pQTechniqueFilter);

 Qt3DRender::QClearBuffer *clearBuffer = new

 Qt3DRender::QCameraSelector *cameraSelector = new

 Qt3DRender::QRenderPassFilter * pQRenderPassFilter = new

 Qt3DRender::QRenderTargetSelector * m_gBufferTargetSelector = new

//  Qt3DRender::QLayerFilter * m_sceneFilter = new

 // TechiqueFilter and renderPassFilter are not implement yet

 pQViewport->setRect(QRectF(0, 0, 1, 1));



 // Setting the pQFrameGraph

 // I add a framegraph component to: class CThreeDWindow : public

 // public:

 // CThreeDWindow(Qt3DCore::QNode *parent = 0);


 if(pScenesSet) // if it's a scene then we want to set it where they want it

pScenesSet->BackGreen, pScenesSet->BackBlue));


  pQViewport->setClearColor(QColor(0, 0, 0));



Any help would be appreciated.

Thank you

Pierre Chicoine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160428/a02c4df5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HalWithSchematic5.png
Type: image/png
Size: 143888 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160428/a02c4df5/attachment.png>

More information about the Interest mailing list