qt3d

Add QMultiSampleAntiAliasing to a QForwardRenderer

蹲街弑〆低调 提交于 2020-01-05 07:08:01
问题 I'm trying to enable Multisampling in qt3d. The Qt3DExtras::Qt3DWindow already does the following during initialisation: format.setDepthBufferSize(24); format.setSamples(4); format.setStencilBufferSize(8); setFormat(format); QSurfaceFormat::setDefaultFormat(format); which is a good start. So according to this post, the only OpenGL call necessary to enable Multisampling would be glEnable(GL_MULTISAMPLE); And indeed, the documentation of documentation of QMultiSampleAntiAliasing states: Note:

Qt3D: using Qt3DRender::QLayerFilter

余生颓废 提交于 2020-01-05 01:08:12
问题 I am trying to use layer filtering as shown in this answer. For this I wrote a simple test (see below). if I transfer code from a My3DWindow class to a main.cpp - this code is worked. Where is the error in My3DWindow class? The full test project can be viewed here. main.cpp int main(int argc, char *argv[]) { QGuiApplication application(argc, argv); auto window = new My3DWindow; auto sphere1 = new Qt3DCore::QEntity(window->Scene()); auto sphere2 = new Qt3DCore::QEntity(window->Scene()); auto

How do I draw the outline of an object in Qt3D?

落爺英雄遲暮 提交于 2020-01-03 19:15:29
问题 How can I draw the outline of an object on top of any other object in Qt3D? For instance to highlight a selected object in a 3D editor? 回答1: If you want to draw the outline of an entity at all times, even if the entity is behind other entities, one solution is to do it in two steps: Draw everything as normal. Draw only the outline of the selected object. When drawing the outline, you need to use an outline effect, which can be implemented in two render passes: Render the geometry to a texture

Text2DEntity renders opaque and hides other entities behind it

一个人想着一个人 提交于 2020-01-02 07:19:30
问题 I draw some 2d text entities in a Qt3D QML scene but some of the texts always render opaque , i.e hide the contents behind them. When looking at the scene from behind ( changing the position of the camera to Qt.vector3d(0,0,-40) ) all texts render OK. The following image shows the wrong behaviour, I would expect the text "AAARGH" not to be rendered on a white background, but the green text shining through. Platform is Windows 64-bit, Qt5.13.0, and Visual Studio 2019. See the following small

Qt3d: Artifacts of displaying when applied Qt3DRender::QLayerFilter

ぃ、小莉子 提交于 2019-12-31 03:45:34
问题 I am trying to use layer filtering as shown in this answer. For this I wrote a simple test (see below). This is a continuation of the question. At a certain position of the red sphere, an artifact appears, which looks like display from the another camera in coordinates (0.0, 0.0, 0.0). See screen: In my example, the red sphere can be moved with the WSAD buttons. See (-7, 0, -14) red sphere position. How to remove these artifacts? The full test project can be viewed here. main.cpp int main(int

Show Qt3D stuff inside QWidget in Qt5

不羁的心 提交于 2019-12-30 11:01:35
问题 So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5 soon and that parts of it is already available for testing as a tech preview. I set out with a simple plan, I would have Qt3D working inside a widget in my existing C++/widgets based application. However the only example I could find that shows how to use Qt3D from C++ is called basicshapes-cpp, and it shows some shapes rendered in a separate OpenGL/Qt3D prepared window

Show Qt3D stuff inside QWidget in Qt5

时光总嘲笑我的痴心妄想 提交于 2019-12-30 11:01:09
问题 So I felt all warm and fuzzy inside after reading that Qt3D has re-emerged in a v2.0 and is in fact becoming a part of Qt5 soon and that parts of it is already available for testing as a tech preview. I set out with a simple plan, I would have Qt3D working inside a widget in my existing C++/widgets based application. However the only example I could find that shows how to use Qt3D from C++ is called basicshapes-cpp, and it shows some shapes rendered in a separate OpenGL/Qt3D prepared window

Qt3d. Draw transparent QSphereMesh over triangles

﹥>﹥吖頭↗ 提交于 2019-12-24 03:50:32
问题 I have a function that draws triangles through OpenGL I draw two triangles by pressing a button (function on_drawMapPushButton_clicked()). Then i draw a sphere that placed above these triangles. And now i see, that sphere is drawed correctly over first triangle, but second triangle drawed over the sphere and not vice versa. If i press the button second time, then spehere is drawed correctly over first and second triangles. When i press the button third time, then second triangle drawed over

Signal to slot connection: triggering signal iteratively inside a loop

对着背影说爱祢 提交于 2019-12-24 03:24:50
问题 Setting up ray-caster I add QRayCaster to my root entity and connect its signal to a slot: void MySceneClass::createRootEntity() { // ... // Add ray caster to root entity m_rayCaster = new Qt3DRender::QRayCaster(m_rootEntity); m_rayCaster->setRunMode(Qt3DRender::QAbstractRayCaster::SingleShot); m_rootEntity->addComponent(m_rayCaster); // Set up signal to slot connection QObject::connect(m_rayCaster, &Qt3DRender::QRayCaster::hitsChanged, this, &MySceneClass::handleRayCasterHits); // ... } I

Qt3d + glShadeModel

跟風遠走 提交于 2019-12-24 03:21:56
问题 Recently I began to use qt3d (with it's QGlView and QGLSceneNode). I provide per-vertex normals for generated model and now want to use GL_FLAT shading model for my modeling app. But simple call to glShadeModel(GL_FLAT) doesnt do anything - shading is doing look like in smooth mode I tried to find where qt3d/qopengl calls that function but besides QGLBuilder couldn't find anything. It seems to me that I have to do something with QOpenGLContext to make native opengl functions work (I have same