aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph
Commit message (Collapse)AuthorAgeFilesLines
* Examples: Update custom QSGMaterialShader correctlySze Howe Koh2023-01-041-0/+1
| | | | | | | Change-Id: I469c4f813f006ca47f9660a0c9ccfa30bbe89dc6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit f92a2a679886b09ff03e9d70d1bf1269f421347a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use QSGRendererInterface::OpenGL in documentation and examplesKai Köhne2022-02-158-8/+8
| | | | | | | | | | | | QSGRendererInterface::OpenGLRhi is only an (undocumented) alias to ...::OpenGL, so let's use that instead. Amends 0b2311a62b25c Change-Id: I4acdd39dc1d9b75bed5c474667a43b4ad86e7f47 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit e2138561df3562c19000af24d43659090c19167a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Scenegraph examples: Use suffix-less RHI constantsFriedemann Kleint2021-11-243-3/+3
| | | | | | | | | Complements 23dbe3d6e0d3338812ad9f614028a6fdc5a54090. Change-Id: Ic1bda49a888b0580ac483d650b879a9ae843129b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 0b2311a62b25cbc34fd41bf0c9aef7e8327eb923) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Migrate to fixed add_shaders prefix handlingLaszlo Agocs2021-08-272-2/+2
| | | | | | Change-Id: I6c5b0680d32bc3650983c64cc4583f790774da88 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use add_shaders with CMake in some examplesLaszlo Agocs2021-08-253-49/+25
| | | | | | | | | | | | | | | | | | | | | Take the most obvious candidates, to which users typically turn when getting started with ShaderEffect or QSGMaterial: shadereffects scenegraph/custommaterial scenegraph/twotextureproviders As with the parent patch that ports and updates embeddedinwidgets and quickwidget/qquickviewcomparison to use the proper CMake machinery, we still need to keep the .qsb files for the sake of qmake. compile.bat and similar scripts are however removed now. With CMake the .qsb files are not needed and are autogenerated at build time. Once qmake support disappears from the examples, the .qsb files can be removed as well. Change-Id: I879354eef2e2179dcd268c9ae9f1402e1eaef379 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 266b93c9f8e7054ec572e47a8c48752381851231) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Update quick examples to new QML CMake APICraig Scott2021-08-2515-387/+128
| | | | | | | | | | | | | This is a pre-requisite to being able to make qt6_qml_type_registration() an internal rather than public command. Not all examples have been updated, only those that were using the qt6_qml_type_registration() command. Task-number: QTBUG-95093 Change-Id: I3f1814a29af608461daa90477eca0aa2304eb9d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a86fd709dd4d315cfe4fea77ea0bc730131fe840) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-1712-12/+12
| | | | | | | | Task-number: QTBUG-95636 Change-Id: I9f76b787533dad1c469fbb8c69df6c27b20a9aa3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b4ab58d791167329259f5403e52ce6c85b5f0074) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Switch examples to build as isolated sub-buildsCraig Scott2021-05-271-12/+12
| | | | | | | Task-number: QTBUG-90820 Change-Id: Id9157526898ba72cb64ee8256639b37357f7bacf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix custommaterial example with OpenGLLaszlo Agocs2021-02-193-1/+1
| | | | | | | | | | | | | The member names in the "uniform block" (which is in practice mapped to a struct uniform with GLSL) must match between the vertex and fragment shaders, even if the member is not used in one of the shaders. This is because OpenGL/GLSL's interface matching rules, which would cause the shader program fail to link due to a mismatch in the structs in the two shaders. Pick-to: 6.1 6.0 Change-Id: I9a928b4b20fdff14530c16a93a52967ce6c328a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix building the d3d11underqml example with MinGWFriedemann Kleint2020-11-261-9/+9
| | | | | | | | | | | Fix format mismatch qtdeclarative/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp:369:16: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'HRESULT' {aka 'long int'} [-Werror=format=] qFatal("Failed to create buffer: 0x%x", hr); by casting to uint (as is done in an existing qWarning()). Pick-to: 6.0 Change-Id: I9bed3066936af8a1831b695a76d40989a834fde9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-052-4/+2
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-2614-0/+56
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I46769fb543acb2cbeba122470b5e44ad478fbe4e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-2014-14/+14
| | | | | | Task-number: QTBUG-87661 Change-Id: Ie5bba408000211b24694aa0143bdf79c4a298f42 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* Adapt to platform API renameTor Arne Vestbø2020-10-092-3/+3
| | | | | Change-Id: I1f2171e18ec3df71f7eaec1be0e0e0d1442a3860 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* examples: include QQuickWindow in squircle headersUlf Hermann2020-09-134-0/+4
| | | | | | | This is required because QQuickWindow is passed as a signal parameter. Change-Id: Ied10beded7253558d080af4806d1b95880bf2d98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make twotextureproviders example functional againLaszlo Agocs2020-09-074-0/+42
| | | | | Change-Id: I6a317fc8628b902e535a31daf4a3886fc87d08bc Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Regenerate graph example shadersLaszlo Agocs2020-09-074-0/+0
| | | | | Change-Id: Id4fe4d0e177180fadd10f34b9ebad17c71e40314 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add CMake project file for custommaterial exampleLaszlo Agocs2020-09-074-6/+126
| | | | | | | | | The name conflicts with a Quick3D example so try to use the same approach as it was done for customgeometry. Task-number: QTBUG-86205 Change-Id: Ie01cd6c0118d512b2f45d4c6e782ec6639e052c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove old GLSL code from fboitem exampleLaszlo Agocs2020-09-077-34/+18
| | | | | | | There is no OpenGL path anymore in Qt 6, no point using file selectors. Change-Id: I4b7afbbb193dfe1a6e912a909babab0aeb8dcdda Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Remove use of deprecated High-DPI application attributesTor Arne Vestbø2020-09-021-1/+0
| | | | | Change-Id: Ibfb50fdcbb51ba93d6e5d11f9e8ce0e7b3bfde79 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Capitalize "GUI" correctlySze Howe Koh2020-08-301-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I2230e2dcb7bc2497b5dbe71a22c21d84176b5e57 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* CMake: Rename example conflicting with qtquick3dAlexandru Croitor2020-08-252-7/+63
| | | | | | Fixes: QTBUG-86205 Change-Id: I38992501abb86a4328527283ad8924ec886ea8c8 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Switch to MTLTexture protocol in QSGTexture native accessLaszlo Agocs2020-08-041-1/+1
| | | | | | | Now only available from ObjC code. Change-Id: I88df6c8839fc660ffd2b8e88a789ca73a9d4accd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add type safe native texture accessorsLaszlo Agocs2020-08-032-8/+6
| | | | | | | | Following the pattern from QtGui. Task-number: QTBUG-85239 Change-Id: I07b4456028d0f45223ad10e55ce65f423bab6a9b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-251-3/+3
| | | | | | Task-number: QTBUG-84469 Change-Id: I4c3353c00a566023503fbc178ba8454391dc334c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* New custom material examplePaul Olav Tvete2020-06-2413-3/+749
| | | | | | Fixes: QTBUG-78577 Change-Id: I280ffeda4bba1a9c170feb1ffa4b6c95eb0e6d28 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Rename setSceneGraphBackend to setGraphicsApiLaszlo Agocs2020-06-227-7/+7
| | | | | | | | | | | | | | | | ...and fix up the docs. The string-based setSceneGraphBackend() stays of course (the docs have been enhanced, however). The GraphicsApi enum-based overload is now renamed to setGraphicsApi(). Using the same name for both functions is a historical artifact, reflecting the evolution (5.0 - 5.8 - 5.14). In 6.0 we can give it a more appropriate name, since it does not have much to do with "backends" from the user's perspective. Change-Id: Id75dbf81f50a148797e5b5de9be4000153737473 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix GL_ constant usage in examplesLaszlo Agocs2020-06-174-6/+6
| | | | | Change-Id: Iecfa47845edb78928b388d150a3229f8c7a93d5d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Anisotropic antialiasing for distance field textEskil Abrahamsen Blomfeldt2020-06-153-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For perspective transforms, we need to find the sample range in the glyph cache per pixel. We can do this by getting the gradient of the distance field at the specific pixel. This will ensure proper antialiasing with any projection, but has the limitation that when glyph contours become thinner than a pixel, they may disappear or become too emphasized, because the hardware-gradient - based on neighbouring fragments - is not reliable at that scale. So we should only default to this when we detect that the text is child of a 3D scene. To make this smooth, we need to know the mode of the renderer when creating the shader. So QSGMaterial::createShader() now takes a render mode that we can use to customize behavior based on whether it is rendering into a 2D or 3D scene. [ChangeLog][QtQuick] The QSGMaterial::createShader() virtual function has been extended to take a render mode argument, which can be used for any customizations needed in the case where the shader will be used in combination with 3D perspective transformations. Fixes: QTBUG-84695 Change-Id: I5a18a4edbdfa07e8f9d506c42bb20e8eb580927d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* fboitem example: Request OpenGL explicitlyLaszlo Agocs2020-06-121-0/+2
| | | | | | | It wouldn't render otherwise. Change-Id: I185459f2eccdffac4f7d7968e48aab4141e0908c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* openglunderqml example: remove unnecessary resetOpenGLState callLaszlo Agocs2020-06-112-4/+2
| | | | | | | | | | | | | | | Also request the OpenGL RHI backend explicitly, like all the other similar examples (d3d11underqml, and so on) do. Calling resetOpenGLState() in this example is pointless because it happens before returning from the custom rendering function, and the endExternalCommands() call achieves the same internally, i.e. the rhi will know that cached state cannot be used anymore. There are other valid uses cases for resetOpenGLState() but this example does not have those. Change-Id: Ifa7861b80c29c174d02cfe37fe8ef8eed7344195 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove rendernode and opengltextureinthread examplesJonas Karlsson2020-06-1030-2526/+0
| | | | | | Task-Id: QTBUG-84623 Change-Id: I786a7a8ee256d8c395dd0e828213c5d137ba20dc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Enable Metal-based scenegraph examplesLaszlo Agocs2020-06-101-3/+3
| | | | | Change-Id: Ib2734fb10feaac106bb6483a8a361c7b35af3348 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Make QSGMaterialRhiShader become QSGMaterialShaderLaszlo Agocs2020-06-023-9/+3
| | | | | | | | | | | | | | | | After a symbiotic relationship in Qt 5.14 and 5.15, it is time for QSGMaterialRhiShader to devour its older sibling and take its place. This makes the direct OpenGL rendering path disfunctional. All QSGMaterial Qt 6 TODOs are solved, the API is clean and straightforward again: a QSGMaterial creates a QSGMaterialShader, no special flags and options needed. (it's just that QSGMaterialShader now has a slightly different API) Task-number: QTBUG-79268 Task-number: QTBUG-82997 Change-Id: I545ca8d796c5535e81957c706e7832133be15b7d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* CMake: Don't install .qmltypes for Qt tests, examples and toolsAlexandru Croitor2020-05-2913-13/+0
| | | | | | | | | | | that don't have an explicit QT_QML_MODULE_INSTALL_DIR path specified. We don't want to pollute the Qt qml import path with these files. Task-number: QTBUG-84403 Change-Id: I768267e0e79daa8090d882c301648cce14e1a809 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate qtdeclarative/examplesAlexandru Croitor2020-05-2911-11/+55
| | | | | | | | | Includes - new example installation paths - one case of QT_QMLTYPES_FILENAME addition Change-Id: I24423da9b04b6ecc8445017fa35f148dd43b1829 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Avoid truncating in QSGMaterial::compare() implementationsLaszlo Agocs2020-05-272-10/+7
| | | | | | | | | | | | The Qt 5.0 pattern of subtracting pointers and returning them is not suitable (on 64-bit archs) since the return type is an int. There is also QSGTexture::comparisonKey() now which is a qint64. Just return -1 and 1 as appropriate. Change-Id: Iaf3377b484a8c4b19b0960f1e8def05e4fa68ce7 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Adjust QSGTexture comparisonKey typeLaszlo Agocs2020-05-272-3/+3
| | | | | | | | | | | | | | | | | | | | | The original choice was int, simply following textureId(). This was later deemed insufficient: instead of a GLuint, the value is now often a 64-bit value (on 64 bit systems), based on a pointer, since the identity of a texture in the RHI world is the QRhiTexture* itself. In a custom texture implementation it is likely that the value here is the value of a native object handle, either a pointer or some 32 or 64 bit integer. Inspired by the recent QSGTexture::NativeTexture struct change (void* -> quint64), switch to a qint64 which is big enough to hold all these without truncation. We choose a signed value here, in order to allow for the following pattern that is widespread in material compare() implementations: if (qint64 diff = m_texture->comparisonKey() - other->texture()->comparisonKey()) return diff; Fixes: QTBUG-83769 Change-Id: I8bdae8cd835282358ded53b3703142b8f26e4400 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Adapt to changes in NativeTexture in qtbaseEskil Abrahamsen Blomfeldt2020-05-253-4/+4
| | | | | | | | | | To make the API less error prone, we have changed the void pointer to the texture handle to a 64-bit in instead, since all handles are maximum 64-bit. Task-number: QTBUG-78638 Change-Id: I9d995d6a883b3377f57d7c5b19d4bc4e15aa347b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add missing CMake project for vulkantextureimportLaszlo Agocs2020-05-252-1/+63
| | | | | | | | ...and enable vulkanunderqml and vulkantextureimport in the CMakeLists one level up. Change-Id: I91d659e028b0e7f53b5860bbfbdbb98c18e333c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix up the scenegraph/textureinthread exampleLaszlo Agocs2020-05-1813-48/+28
| | | | | | | | | | | | | Force OpenGL, remove the ShaderEffect (it serves no purpose in this example) and remove deprecated API usage. Finally, rename the example to opengltextureinthread. Note that the example's performance is sub-par, but the same is true with direct OpenGL. Change-Id: I7eaa2349ffdb3d27bd9e8815d674e918bc709c03 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove leftover legacy shader files in scenegraph exampleLaszlo Agocs2020-04-2913-102/+54
| | | | | | Task-number: QTBUG-82997 Change-Id: Icc328394154d7b352c9f47184c2f906d5afa4d44 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-236-9/+9
| | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-091-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * Add missing include to d3d11underqml exampleLaszlo Agocs2020-04-071-0/+1
| | | | | | | | | | | | Change-Id: Ib1891a509dccdbe071ce71058aaa58887ddfeb8e Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | twotextureproviders example: rip out legacy OpenGL material implLaszlo Agocs2020-04-072-64/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Leave only the RHI version in. Also add a temporary forcing of the RHI rendering path for now. This will go away when purging the direct OpenGL path in Qt Quick because RHI will be the default anyhow. Now both graph and twotextureproviders follow the same structure and approach, and together serve as a fairly good examples of creating custom materials in the RHI world. Change-Id: I4aafd440f70d13b8033fd4fdf0ecce71798c68d2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Update graph example CMakeLaszlo Agocs2020-04-072-9/+5
| | | | | | | | | | | | | | | | Also update OTHER_FILES in the .pro although that's not strictly required for building. Change-Id: Ib48e64b298c1a7b1600ecd1f13580398679b72a2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Remove QSGSimpleMaterialLaszlo Agocs2020-04-0728-1013/+312
| | | | | | | | | | | | | | | | | | | | And port the graph example to QSGMaterial and the RHI. We will not anymore add a direct OpenGL path (that would mean using QSGMaterialShader) for the example because the upcoming purge renders that useless anyway. Task-number: QTBUG-82988 Change-Id: I137575ed5df45b6bfc34a11d73dc5100945081c5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Remove sgengine from scenegraph examples CMake project fileLaszlo Agocs2020-04-071-1/+0
| | | | | | | | | | Change-Id: Ifb2f986ec9d4fd0bfdd35f2e59d7d1d916ac2098 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Remove QSGEngine and move QSGAbstractRenderer back to privateLaszlo Agocs2020-04-078-544/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSGEngine goes away. Same for the associated example, which is the only place this is used anywhere in Qt. As a consequence, the renderer base class can be moved back to private: there is no use for it to be public anymore, since that made sense only in combination with QSGEngine. With the RHI-based rendering path driving a renderer directly is more complicated than before so it is not reasonable to allow the QSGEngine-style access anymore. Instead, one has QQuickRenderControl, which allows redirecting and manually driving the rendering of a QQuickWindow, thus providing an alternative to the legacy QSGEngine approach. Task-number: QTBUG-78596 Change-Id: If57c6b657b2053da1c4e545e517026382a71d998 Reviewed-by: Andy Nichols <andy.nichols@qt.io>