[Interest] QT3d Dynamic Mesh

Jeremy jswigart at gmail.com
Fri Oct 16 04:01:15 CEST 2015


The way I'm building my entity is a little unorthodox, but it's the only
way I could set it up so far as I can tell. I have a messaging thread
reading networked data that contain model data with which needs to be
rendered in a 3d view. I parse the contents of the network messages and
build a QMeshData and keep a reference in a map to the shared pointer

https://github.com/jswigart/game-analytics/blob/master/AnalyticsViewer/ModelProcessor.cpp#L109

Then since this messaging thread owns the entity, I move the entity to the
main app thread and emit a signal to add the entity to the scene, handled
by by custom root entity, moving the entity again to the thread of my scene
object, which was created from the QML file.

https://github.com/jswigart/game-analytics/blob/master/AnalyticsViewer/AnalyticsScene.cpp#L14

I get no debugger warning hinting at anything that is wrong, so I'm kinda
stumped. At first before I was transferring my entity to a different thread
I was getting warnings about unable to set parent with objects on different
threads but since I started moving the entity between threads there's been
no further debug messages about what might be wrong. I must be missing
something with constructing my mesh, because if I use cylinder meshes in
its place they show up. I'm not providing an index array, but from what
I've seen in the Qt code and a few examples, that isn't a requirement.

Any ideas what I might be missing?

On Thu, Oct 15, 2015 at 8:37 PM Jeremy <jswigart at gmail.com> wrote:

> That sounds like basically how the QMeshData is currently constructed. The
> part that I'm having trouble with is how to manage that data dynamically.
> Since it is a shared pointer, my first attempt was going to be to just
> change the contents of the QMeshData through my own reference to it via the
> QMeshDataPtr, which should be shared with any entities in the scene that
> may reference it.
>
> Unfortunately before I can even confirm whether that is a viable option I
> can't even seem to get my custom mesh to show up.
>
>
> https://www.dropbox.com/s/e6pprh8e23ux3fu/Screenshot%202015-10-15%2020.35.53.png?dl=0
>
> I have it added to the scene properly so far as I can tell, and I'm
> showing the scene hierarchy in a UI next to it, but I don't see anything in
> the 3d view and I'm not sure why.
>
>
>
>
>> ---------- Forwarded message ----------
>> From: Sean Harmer <sean.harmer at kdab.com>
>> To: interest at qt-project.org
>> Cc:
>> Date: Sun, 11 Oct 2015 18:37:22 +0100
>> Subject: Re: [Interest] QT3d Dynamic Mesh
>> Hi,
>>
>> The API for this has changed a little in 5.6. The geometric data is now
>> contained in one or more QBuffer objects and is referenced by one or more
>> QAttributes that describe the data layout in the buffers. The QAttributes
>> are rendered by adding them to a QGeometryRenderer component.
>>
>> You can either update the above objects on the main thread and call
>> update() or as before you can also use a functor to have the backend
>> generate the dynamic data.
>>
>> Cheers,
>>
>> Sean
>>
>> On 10/10/2015 17:09, Jeremy wrote:
>>
>>
>> I want to use Qt3d in a situation that involves dynamic runtime changes
>> of geometric data on the application side.
>>
>> What is the best way to dynamically change a mesh for an entity?
>>
>> I'd rather do all this on the C++ side, but QMesh doesn't seem to provide
>> an API for changing the mesh data.
>>
>> I looked at some other examples of making a custom QAbstractMesh class
>> and QAbstractMeshFunctor. It looks like I could possibly make a custom mesh
>> type to do what I need but I have a question. If I keep a reference to the
>> QMeshDataPtr that I make from the functor, can I simply modify the mesh
>> data whenever I want and the entities that reference it will update
>> automatically?
>>
>> Thanks
>> Jeremy
>>
>>
>> _______________________________________________
>> Interest mailing listInterest at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>>
>> --
>> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
>> KDAB (UK) Ltd, a KDAB Group company
>> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
>> Mobile: +44 (0)7545 140604
>> KDAB - Qt Experts
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Sean Harmer <sean.harmer at kdab.com>
>> To: interest at qt-project.org
>> Cc:
>> Date: Sun, 11 Oct 2015 18:48:40 +0100
>> Subject: Re: [Interest] [Qt3D] Minimizing Qt3D dependencies
>> Hi,
>>
>> Qt3D will always require QtGui for the QWindow, QOpenGL* classes and the
>> QPA abstraction layer.
>>
>> It does not however require QtWidgets so it is not as heavy as you may
>> think.
>>
>> Cheers,
>>
>> Sean
>>
>> On 03/10/2015 20:47, Catalin Moldovan wrote:
>>
>> Hi,
>>
>> I'm interested in trying and using Qt3D 2.0 for game development. I'm
>> currently using Unity3D but I was always attracted by the beauty of Qml and
>> I'm a C++ developer at heart. I have some concerns though regarding the
>> size of an application that is using Qt3D. From what I've seen Qt3D depends
>> on GUI module and that is a pretty big module. I suppose that module is
>> used to initialize OpenGL context but I didn't dug up through source code
>> to verify.
>> Is it possible to minimize dependencies for Qt3D somehow? I mean
>> theoretically it should depend just on Qt Core and Qt Qml.
>> I was thinking of implementing my own little engine using bgfx rendering
>> framework and use minimal Qt Core and Qt Qml dependencies because of that.
>> But on the other hand Qt3D is so well designed and I will just waste time
>> trying to replicate something that is already available. Not to mention
>> that this would be a serious undertaking.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Interest mailing listInterest at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>>
>> --
>> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
>> KDAB (UK) Ltd, a KDAB Group company
>> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
>> Mobile: +44 (0)7545 140604
>> KDAB - Qt Experts
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Sean Harmer <sh at theharmers.co.uk>
>> To: interest at qt-project.org
>> Cc:
>> Date: Sun, 11 Oct 2015 18:50:29 +0100
>> Subject: Re: [Interest] [Qt3D] Performance degradation in bigscene-cpp
>> Yes. It's something we need to look into. I can't recall what caused the
>> slow down so will need to do a git bisect.
>>
>> Cheers,
>>
>> Sean
>>
>> On 03/10/2015 20:56, Catalin Moldovan wrote:
>>
>> Hi,
>>
>> I noticed great performance degradation for the bigscene-cpp example in
>> the Qt3D version that ships with Qt 5.5. The framerate for the example is
>> visibly low. I remember that in the beta release of Qt 5.5 I was testing
>> Qt3D and I was impressed of how smooth that example was and the framerate
>> was great.
>> Has anyone else noticed this performance issue?
>>
>> Cheers,
>> Catalin
>>
>>
>> _______________________________________________
>> Interest mailing listInterest at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Sean Harmer <sean.harmer at kdab.com>
>> To: interest at qt-project.org
>> Cc:
>> Date: Sun, 11 Oct 2015 18:55:12 +0100
>> Subject: Re: [Interest] Q[Open]GLWidget and separate render thread
>> Do you need widgets composited over your GL content? If not just use
>> QWindow + QOpenGLContext and implement a loop by way of posting an event
>> to your render thread following the blocking call to swapBuffers() that
>> kicks off the next frame of drawing. The window can be inserted into
>> your widget hierarchy using QWidget::createWindowContainer().
>>
>> If you do want your controls of some sort overlaid over your GL content
>> then you can use QQuickView and connect to its beforeRendering() signal
>> using a direct connection to do your rendering in QQ2's render thread by
>> borrowing its context.
>>
>> Aternatively you can use QQuickFramebufferObject to draw your GL content
>> into an FBO that then gets composited into the QQ2 scene.
>>
>> Cheers,
>>
>> Sean
>>
>> On 05/10/2015 16:01, Matthew Woehlke wrote:
>> > I have a requirement for a project to provide a very high and consistent
>> > frame rate of GL rendering. We are otherwise using Qt for the
>> > application and would prefer to continue to do so. The only way we have
>> > been able to determine to achieve the necessary render requirements is
>> > to have a separate, dedicated thread that is constantly rendering and
>> > performing a vsync-synchronous buffer swap. For various reasons
>> > (particularly that the buffer swap will be blocking), this can't be done
>> > in the main UI thread.
>> >
>> > Does anyone have any guidelines / tutorials / examples on how to
>> > implement GL rendering in a separate render thread with a Qt 5.x GL
>> widget?
>> >
>> > (Also... we are currently using distro-provided Qt which is 5.2/5.3,
>> > i.e. no QOpenGLWidget. We can upgrade if needed, but it may require
>> > building Qt ourselves, so we'd prefer not to without good reason. Does
>> > anyone know if a separate render thread is possible with QGLWidget,
>> > and/or if there are other issues that have been fixed that would mandate
>> > updating to a newer Qt version?)
>> >
>>
>>
>> --
>> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
>> KDAB (UK) Ltd, a KDAB Group company
>> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
>> Mobile: +44 (0)7545 140604
>> KDAB - Qt Experts
>>
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Samuel Nevala <samuel.nevala at intopalo.com>
>> To: Thiago Macieira <thiago.macieira at intel.com>
>> Cc: interest at qt-project.org
>> Date: Mon, 12 Oct 2015 07:45:10 +0300
>> Subject: Re: [Interest] OTE label
>> Tag for a commercial customer. Finnish only link
>> https://www.digia.com/fi/Mita-teemme/Ratkaisut-ja-tuotteet/ote/
>>
>> On 10 October 2015 at 00:14, Thiago Macieira <thiago.macieira at intel.com>
>> wrote:
>>
>>> On Friday 09 October 2015 20:59:27 Jason H wrote:
>>> > Anyone know what OTE label means in the issue tracker?
>>>
>>> Labels are arbitrary strings that anyone can add.
>>>
>>> I don't know what OTE is. I'll guess "Over The Ether" (compare to OTA -
>>> Over
>>> The Air).
>>> --
>>> Thiago Macieira - thiago.macieira (AT) intel.com
>>>   Software Architect - Intel Open Source Technology Center
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Jeremy <jswigart at gmail.com>
>> To: "interest at qt-project.org" <interest at qt-project.org>
>> Cc:
>> Date: Thu, 08 Oct 2015 22:30:08 +0000
>> Subject: [Interest] QT3d Dynamic Mesh
>> I want to use Qt3d in a situation that involves dynamic runtime changes
>> of geometric data on the application side.
>>
>> What is the best way to dynamically change a mesh for an entity?
>>
>> I'd rather do all this on the C++ side, but QMesh doesn't seem to provide
>> an API for changing the mesh data.
>>
>> I looked at some other examples of making a custom QAbstractMesh class
>> and QAbstractMeshFunctor. It looks like I could possibly make a custom mesh
>> type to do what I need but I have a question. If I keep a reference to the
>> QMeshDataPtr that I make from the functor, can I simply modify the mesh
>> data whenever I want and the entities that reference it will update
>> automatically?
>>
>> Thanks
>> Jeremy
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: "Tor Arne Vestbø" <tor.arne.vestbo at theqtcompany.com>
>> To: Sherif Ghali <sherif.ghali.1 at gmail.com>, Thiago Macieira <
>> thiago.macieira at intel.com>
>> Cc: Qt Interest <interest at qt-project.org>
>> Date: Fri, 9 Oct 2015 12:31:07 +0200
>> Subject: Re: [Interest] OS X and XCode 7.0: 'TargetConditionals.h' file
>> not found
>> You don't need to set QMAKE_MAC_SDK unless you require a specific SDK
>> version. The SDK is resolved a qmake time to the latest SDK installed,
>> and the result is cached in .qmake.stash. If you upgrade your Xcode,
>> you'll likely have a newer SDK, and may miss the original SDK that was
>> resolved and cached, in which case you need to do a clean build. A clean
>> build means wiping your entire build dir, eg rm -Rf builddir. Or if you
>> want to be a bit more precise, rm .qmake.stash .qmake.cache
>>
>> tor arne
>>
>> On 07/10/15 17:37, Sherif Ghali wrote:
>> > Thanks, Thiago. Let me summarize what it was about on my side.
>> >
>> > A couple of issues are at play once one upgrades to XCode 7.0.x. The
>> > following solved them on Yosemite (10.10); YMMV.
>> >
>> > First off, to solve a problem that I no longer recall, I needed to add
>> > one of
>> >      mac::QMAKE_MAC_SDK = macosx10.9
>> >      mac::QMAKE_MAC_SDK = macosx10.10
>> > to some .pro files, as well as
>> >      export
>> >
>> SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
>> > to .bash_profile. Neither should be there.
>> >
>> > After the update to XCode, you'll see that
>> >
>> >
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/
>> > has replaced
>> >
>> >
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
>> >
>> > In the existing Qt (5.4.2) there were pointers to
>> > (/Applications/.../MacOSX10.10.sdk) that Qt inserted during its
>> > installation. I don't know if it's possible to remedy this in place, but
>> > re-installing Qt (still 5.4.2) after the XCode update made Qt point to
>> > .../SDKs/MacOSX10.11.sdk/. Notice that XCode 7 uses MacOSX10.11.sdk even
>> > if one is still on Yosemite.
>> >
>> > Sherif
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: "Björn Piltz" <bjornpiltz at gmail.com>
>> To: "interest at qt-project.org" <interest at qt-project.org>
>> Cc:
>> Date: Mon, 12 Oct 2015 09:17:40 +0200
>> Subject: Re: [Interest] QGLWidget problem with Qt 5.5 and MSVC 2015
>> (Should QT_OPENGL_ES_2 be defined?)
>> I just want to add that this problem isn't confined to QGLWidget, but the
>> compiler detection for 2015 seems to be broke somewhere. The simple program
>> https://github.com/TReed0803/QtOpenGL/tree/9990c8dd9ac5899289b28efaaaf5a1d1a97fab48/0_OpenGLWindow
>> outputs
>>     OpenGL 3.3.0 NVIDIA 353.82 ( CoreProfile )
>> when compiled with MSVC2013 and
>>     OpenGL ES OpenGL ES 3.0 (ANGLE 2.1.99f075dade7c) ( CoreProfile )
>> when compiled with MSVC2015.
>>
>> Cheers,
>> Björn
>>
>> 2015-10-07 15:52 GMT+02:00 Björn Piltz <bjornpiltz at gmail.com>:
>>
>>> I'm trying to compile some legacy QGLWidget code with Qt 5.5 and MSVC
>>> 2015 and I am running into problems. The same code compiles with Qt 5.5 and
>>> MSVC 2013.
>>>
>>> The problem is I get a "C3861: identifier not found" for basic gl
>>> functions like glMatrixMode. The reason seems to be that the 2015 build
>>> defines QT_OPENGL_ES_2 and gets its GL through the <qopengl.h> block:
>>>    #   include <GLES2/gl2.h>
>>>
>>> whereas 2013 gets its through the block
>>>
>>>     #  define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system
>>> glext.h
>>>     #  include <GL/gl.h>
>>>     #  include <QtGui/qopenglext.h>
>>>
>>> I can make it compile by directly adding '#include <GL/gl.h>' to my code
>>> but then the widgets remain black and I suspect QT_OPENGL_ES_2  should not
>>> have been defined, right?
>>>
>>> Cheers,
>>> Björn
>>>
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Agocs Laszlo <laszlo.agocs at theqtcompany.com>
>> To: "interest at qt-project.org" <interest at qt-project.org>, "
>> bjornpiltz at gmail.com" <bjornpiltz at gmail.com>
>> Cc:
>> Date: Mon, 12 Oct 2015 07:30:47 +0000
>> Subject: Re: [Interest] QGLWidget problem with Qt 5.5 and MSVC 2015
>> (Should QT_OPENGL_ES_2 be defined?)
>>
>> There are no official MSVC2015 builds for Qt 5.5 so I assume you are
>> building Qt yourself, in which case the most likely cause is having a
>> misconfigured build targeting ANGLE only. Pass -opengl dynamic or -opengl
>> desktop to configure.
>>
>>
>> Best regards,
>>
>> Laszlo
>>
>>
>> ------------------------------
>> *From:* interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org
>> <interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on
>> behalf of Björn Piltz <bjornpiltz at gmail.com>
>> *Sent:* Monday, October 12, 2015 9:17 AM
>> *To:* interest at qt-project.org
>> *Subject:* Re: [Interest] QGLWidget problem with Qt 5.5 and MSVC 2015
>> (Should QT_OPENGL_ES_2 be defined?)
>>
>> I just want to add that this problem isn't confined to QGLWidget, but the
>> compiler detection for 2015 seems to be broke somewhere. The simple program
>> https://github.com/TReed0803/QtOpenGL/tree/9990c8dd9ac5899289b28efaaaf5a1d1a97fab48/0_OpenGLWindow
>> outputs
>>     OpenGL 3.3.0 NVIDIA 353.82 ( CoreProfile )
>> when compiled with MSVC2013 and
>>     OpenGL ES OpenGL ES 3.0 (ANGLE 2.1.99f075dade7c) ( CoreProfile )
>> when compiled with MSVC2015.
>>
>> Cheers,
>> Björn
>>
>> 2015-10-07 15:52 GMT+02:00 Björn Piltz <bjornpiltz at gmail.com>:
>>
>>> I'm trying to compile some legacy QGLWidget code with Qt 5.5 and MSVC
>>> 2015 and I am running into problems. The same code compiles with Qt 5.5 and
>>> MSVC 2013.
>>>
>>> The problem is I get a "C3861: identifier not found" for basic gl
>>> functions like glMatrixMode. The reason seems to be that the 2015 build
>>> defines QT_OPENGL_ES_2 and gets its GL through the <qopengl.h> block:
>>>    #   include <GLES2/gl2.h>
>>>
>>> whereas 2013 gets its through the block
>>>
>>>     #  define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system
>>> glext.h
>>>     #  include <GL/gl.h>
>>>     #  include <QtGui/qopenglext.h>
>>>
>>> I can make it compile by directly adding '#include <GL/gl.h>' to my code
>>> but then the widgets remain black and I suspect QT_OPENGL_ES_2  should not
>>> have been defined, right?
>>>
>>> Cheers,
>>> Björn
>>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151016/90d70c94/attachment.html>


More information about the Interest mailing list