summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellowindow
Commit message (Collapse)AuthorAgeFilesLines
* Move hellowindow and qopenglwindow to be a manual testsLaszlo Agocs2023-03-235-555/+0
| | | | | | Pick-to: 6.5 Change-Id: I8d1517ee57df9b2dee0486f47562b0754e9dcbad Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Examples: Add missing include guardsFriedemann Kleint2023-02-011-0/+5
| | | | | | | | Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-109394 Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-301-1/+1
| | | | | | | We (almost) only build apps, for which PRIVATE linkage makes more sense. Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use qt_standard_project_setup()Kai Köhne2022-11-171-2/+2
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-171-5/+5
| | | | | | | This is what we promote also in the documentation. Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-163-147/+6
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove unneeded CMake optionsKai Köhne2022-01-241-4/+0
| | | | | | | | | | | | | | | CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes CMAKE_AUTORCC should not be used anymore. Instead, we now use qt_add_resources() or similar Enable CMAKE_AUTOUIC only if .ui files are present. Pick-to: 6.3 Task-number: QTBUG-87643 Change-Id: I835e2994cd5dba9918136999499b9077961b616c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Fix whitespace issues in CMakeLists.txtKai Köhne2021-12-131-1/+3
| | | | | | Pick-to: 6.3 Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Remove remaining conversion markers in CMakeLists.txtKai Köhne2021-12-131-2/+0
| | | | | | Pick-to: 6.3 Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-101-3/+1
| | | | | | | | | Also consolidate several find_package(Qt6 ...) calls in one call. Task-number: QTBUG-98867 Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-171-1/+1
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-271-0/+4
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-191-1/+1
| | | | | | Task-number: QTBUG-87661 Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examplesAlexandru Croitor2020-07-091-1/+5
| | | | | | Change-Id: I1c51b10af4e2b26f54740f257164c56a0e2a03ce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use QList instead of QVector in examplesJarek Kobus2020-06-231-2/+2
| | | | | | Task-number: QTBUG-84469 Change-Id: Id14119168bb1bf11f99bda7ef6ee9cf51bcfab2e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix hellowindow exampleMichal Klocek2020-05-252-59/+30
| | | | | | | | | | | | | | | | | | | | It seems this example never worked as expected. It has a 'multiple' option which should show extra windows with rendering taking place in different thread, however although render is moved to other thread render() function was never called in that thread. Fix following things: * make rendering in other thread * stop requestUpdate if nothing is exposed * add timer so animation works at the same speed despite of number of windows (renderer B renders two windows) * wait for render to finish before triggering requestUdpate * remove mutex where not needed Pick-to: 5.15 Change-Id: I420436bd28d0357534332dd55b088d634d906c14 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Move QOpenGLShaderProgram from QtGui to QtOpenGLJohan Klokkhammer Helsing2020-02-203-2/+4
| | | | | | Task-number: QTBUG-74409 Change-Id: I20dfafc0c9bf8e2b68b03e171d70c2cb4ad2bfaf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Regenerate projects one last time before mergewip/cmakeAlexandru Croitor2020-02-121-5/+2
| | | | | | Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Post Merge FixesLeander Beernaert2020-01-241-1/+2
| | | | | Change-Id: I1e06c01b76b119c3f23b6e6ecbaae8df719b70ce Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: add examples/openglFrederik Gladhorn2019-10-071-0/+34
| | | | | | | Fixes: QTBUG-78164 Change-Id: Iccc8bb1354d2362c950de17a6c00e00f95272967 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Use requestUpdate instead of timer in a few GL examplesTor Arne Vestbø2019-01-222-5/+13
| | | | | Change-Id: I235ad367fe693c86ef5a0844fde0573371b284db Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Change almost all other uses of qrand() to QRandomGeneratorThiago Macieira2017-11-081-3/+4
| | | | | | | | | | | | | | | | | | | The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-061-4/+23
|\ | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/qopenglwidget/main.cpp src/3rdparty/pcre2/src/pcre2_printint.c src/plugins/platforms/cocoa/qnsview.mm src/widgets/widgets/qcombobox.cpp Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
| * OpenGL examples: Introduce QCommandLineParserFriedemann Kleint2017-09-051-4/+23
| | | | | | | | | | | | Task-number: QTBUG-60626 Change-Id: I6d102327c89206fcdce10f3ac04e112270b11ad2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Don’t flicker on startup: render on exposeMorten Johan Sørvig2017-06-272-1/+3
| | | | | | | | | | | | | | | | All QWindow implementations must produce a frame before returning from the expose event. Change-Id: I5640809c47e948101879c1623c12230fa0a63c44 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Be (somewhat more) consistent about the value of piEdward Welbourne2017-06-201-13/+12
|/ | | | | | | | | | | | | | | | | | | | Use M_PI (and friends), where possible, in favor of hand-coded approximations of various (in)accuracies. Where that's not available (e.g. fragment shaders), use the same value that qmath.h uses for M_PI, for consistency. Replaced math.h with qmath.h in places that defined a fall-back in case math.h omits it (it's not in the C++ standard, although M_PI is in POSIX); or removed this entirely where it wasn't used. Reworked some code to reduce the amount of arithmetic needed, in the process; e.g. pulling common factors out of loops. Revised an example's doc to not waste time talking about using a six-sig-fig value for pi (which we no longer do) - it really wasn't relevant, or anything to be proud of; nor did the doc mention its later use. Task-number: QTBUG-58083 Change-Id: I5a31e3a2b6a823b97a43209bed61a37b9aa6c05f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Examples: Replace 'Q_DECL_OVERRIDE' by 'override'hjk2016-06-151-2/+2
| | | | | | | | Examples should demonstrate best practice, and we can use the keyword directly nowadays. Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Unify license header usage.Jani Heikkinen2016-03-293-9/+39
| | | | | | | | | Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Port examples/opengl to new connection syntax.Friedemann Kleint2015-09-022-4/+4
| | | | | Change-Id: I486a4a2326bf57ec5ea08bccdcef79c3e5553db5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Updated BSD licensed file headersJani Heikkinen2015-02-153-9/+9
| | | | | Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-113-15/+15
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Make hellowindow multi display capable on embeddedLaszlo Agocs2014-10-163-8/+30
| | | | | | | | | | | | | | | | | Platforms like eglfs allow a single window per screen. Thus the behavior of --multiple is not suitable since it tries to open multiple windows on the primary screen. Instead, introduce --multiscreen. Add also --timeout to quit the app after 10 seconds. This is essential on platforms that do not have windows with decorations that can be used to close windows. With eglfs' kms/drm hooks, starting with --multiscreen will now show a rotating logo on all connected displays, with some random background color. Change-Id: I53f2651f05620e752c289038a9b3ff4508273173 Reviewed-by: Louai Al-Khanji <louai.al-khanji@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* hellowindow: Set all the state for each frameLaszlo Agocs2014-09-041-12/+15
| | | | | | | | | | | Trying to be smart and minimizing the amount of GL calls per frame to provide a good example was a mistake (in a way): There are components, like the eglfs mouse cursor, that change the context state. To make sure the example work in these cases, set the state upon each frame. Change-Id: Ief1fd7bbb0fb1955a64dac97a071b7a3d9d506d4 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Modernize the OpenGL examplesLaszlo Agocs2014-08-123-33/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change them to use QOpenGLWidget and QOpenGLTexture. Advocate also the usage of VBOs. Hopeless examples, that rely on the fixed pipeline and will not compile or work in ES and dynamic builds, are moved to a "legacy" directory. The documentation pages for these are removed. This long due change avoids the confusion newcomers experience when trying to get started with Qt 5 and OpenGL. hellowindow's behavior is changed to open a single window only by default. The old default behavior, that opened three windows on platforms that supported both MultipleWindows & ThreadedOpenGL, can be requested by passing --multiple. --single is removed since it is the default now. This plays much nicer with drivers that have issues with threading. In addition, say hello to hellogl2. This is the old hellogl example updated to use QOpenGLWidget and OpenGL 2. It also has a mainwindow with multiple (un)dockable widgets containing the OpenGL widgets. This helps testing the behavior when the top-level of the QOpenGLWidget changes and provides a very important example of how to do proper resource management in this case. (must use aboutToBeDestroyed() of the context, since the context goes away and is replaced by a new one on every dock/undock) As a bonus, the logo is now real 3D, no more orthographic nonsense. Launch with --multisample to request 4x MSAA. Launch with --coreprofile to request 3.2 Core. In this particular example the shaders are present in both versions and there is a VAO so the application is functional with core profile contexts. Change-Id: Id780a80cb0708ef164cc172450ed74050f065596 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Examples: Add Q_DECL_OVERRIDE to overridden functionsOlivier Goffart2014-07-151-2/+2
| | | | | | | | | | | | | | | | | | Q_DECL_OVERRIDE (which expands to 'override' for supported compiler) helps to declare the intent (that it is an overridden function) and force compilation error when there is no such virtual function in the base class. The examples should show the best practice of having it, as it may save the programmer quite some time in case of change of API or typo in the function name or arguments. This change was done automatically with clang-modernize -add-override -override-macros And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Fix up examples for dynamic opengl buildsLaszlo Agocs2014-05-121-1/+1
| | | | | | Change-Id: Id311b00fe7783a3175dc1c4a38f627c78c470761 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Do not attempt to open multiple windows in hellowindow on embeddedLaszlo Agocs2014-03-061-2/+3
| | | | | | | | | | Platforms like eglfs will not allow opening more than one OpenGL-based window. To prevent aborting the hellowindow example when invoked without --single, enhance the capability check to include also WindowManagement in addition to ThreadedOpenGL. Change-Id: I147d90b31d9fd94912c36339d36af3f311aaa874 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Extend QOpenGLFunctions with GL1 functionsLaszlo Agocs2014-03-041-11/+11
| | | | | | | | | | | | | | | | | | This introduces the ability to indirectly invoke all common GL1-GLES2 functions via QOpenGLFunctions. The GL1 functions are not yet resolved, since this would not work anyway when linking to an OpenGL implementation directly. However this may change later but that will be a completely internal change without affecting any public APIs. Also migrate some of the opengl examples to use QOpenGLFunctions for everything. Once dynamic GL loading becomes available on some platforms, these examples should continue to function without any changes since they do not anymore invoke any OpenGL functions directly. Task-number: QTBUG-36483 Change-Id: Ie630029651e5a4863a480aac5306edd67ee36813 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Make OpenGL examples work on retina displays.Morten Johan Sørvig2013-11-291-1/+1
| | | | | | | | | glViewport expects device pixels, but the various geometry accessors returns values in device-independent pixels. Change-Id: I8004692de82251e4f1f25bf8f2698895f222ede3 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* hellowindow: Request multisampling only when told soLaszlo Agocs2013-09-101-1/+2
| | | | | | | | | | Similarly to qmlscene, multisampling will only be requested when passing --multisample on the command line. This is useful because (1) multisampling is not really needed by this app and (2) it helps with broken drivers that advertise MSAA configs but break when using them. Change-Id: I50ff0db80843f488899901ab796eee588b62078b Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Improved robustness of threaded rendering in hellowindow example.Samuel Rødal2013-04-252-26/+55
| | | | | | | | | | | | Previously resizes along with the animation was implemented using queued signals and slots, potentially causing a huge lag between the size of the window and the rendered contents. Now the animation is always driven by the rendering thread and is triggered based on the window's isExposed() status. Change-Id: Ifd89a63c2a436671a7b15326ff56be9ec2a5362d Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-183-3/+3
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash in hellowindow example when minimizing.Friedemann Kleint2013-01-151-1/+2
| | | | | | | Task-number: QTBUG-28439 Change-Id: Idcea2712afdbb08b4da2fa230fd8ba6aebd380b7 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Polish code of some opengl exampleshjk2012-12-283-51/+38
| | | | | Change-Id: If24ae1845176fc525cf6a239a5079f4802f8df3f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* centralize and fixup example sources install targetsOswald Buddenhagen2012-11-291-3/+1
| | | | | | | | | | | | | it's confusing for the users if the examples' project files contain code to install their own sources. also, this constitutes an enormous code duplication, and lots of mistakes. consequently, automate it. more or less as a side effect, this also removes the entirely meaningless target installs in subdirs projects. Task-number: QTBUG-28184 Change-Id: I9fc1367a06db9e2c46aeb67d68729a4f67163ef9 Reviewed-by: hjk <qthjk@ovi.com>
* Examples: Install to $$[QT_INSTALL_EXAMPLES]/$submodule/$examplehjk2012-11-261-2/+2
| | | | | | | | This makes the structure of the examples after an 'make install' similar to the one in a 'developer build'. Change-Id: I9120bd741fab332e64e30adc01cefe87e5633454 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Rename all QWindow properties that have "window" in themShawn Rutledge2012-11-072-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | windowTitle, windowModality, windowIcon and so on are named that way to be similar to the ones in QWidget. However QQuickWindow inherits all of the declared properties, and we would like to have shorter property names in QML. If you are working with a Window then it's obvious the title property is the window title. Unfortunately, there must be patches in many other modules which depend on this one. In order to avoid the need to merge them all at the same time, there is also patch https://codereview.qt-project.org/#change,39001 which temporarily adds backwards-compatible accessors, which can be removed after the other modules are able to build without them. We should not rename windowState to state, because in QML, state usually drives the state machine for animation transitions etc. (although QWindow is not an Item, a user might get confused about it). Related patches are https://codereview.qt-project.org/#change,39001 https://codereview.qt-project.org/#change,37764 https://codereview.qt-project.org/#change,37765 https://codereview.qt-project.org/#change,37766 https://codereview.qt-project.org/#change,37762 Change-Id: Ie4424ec15fbdef6b29b137f90a2ae33f173edd21 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix hellowindow example generating excess timersMiikka Heikkinen2012-11-052-5/+8
| | | | | | | | | | | | The example was creating a new timer on every expose event, which quickly leads into massive excess of timeout signals. Fixed by only creating one timer. Task-number: QTBUG-27836 Change-Id: Ia6ed1bd9575e296f4c6c5b12509095e4d5c016dd Reviewed-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>