Re: [Interest] QOpenGLFramebufferObject, render to FBO using texture from another Image item?
Getting the Image element's textureProvider at the time of QQuickFrameBufferObject::synchronize should give you a QSGTextureProvider for that image, assuming that the Image.status == Ready. This is the same mechanism that ShaderEffect uses internally as well. You are not supposed to use the item on the render thread. That is unsafe and will lead to crashes. The texture provider is the right thing. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no] Sendt: 12. desember 2013 15:34 To: interest@qt-project.org Emne: [Interest] QOpenGLFramebufferObject, render to FBO using texture from another Image item? I recently discovered the new way of doing render-to-FBO in Qt 5.2.0. It's a major improvement compared with what had to be done previously, I think! :-) However I have run into something tricky as I want to do something more advanced: I need to render some textured geometry into an FBO. The use-case is something similar to correcting for lens artifacts in a photograph, and the geometry is too advanced for using the Shadereffect items (can't use a regular mesh grid). The texture is loaded from a .jpg file on disk. The image is rather large, so I want to use similar mechanisms as used by the Quick2 Image item (cache, asynchronous loading, etc). It's not a good idea to use the internals from qquickimage, so I thought of doing something similar to what the Shadereffectsource item does, by using the texture created by an Image item. This way, I can re-use all the advanced things the Image item does internally for loading an image. I have now got a class inheriting QQuickFramebufferObject. It has a sourceItem property, which holds a QQuickItem*. In my QML code, i set this to be a Image item. Image { id: rawImage source: picture.jpg visible: false asynchronous: true onStatusChanged: { (status === Image.Ready) { fboRender.updateTexture(); // this calls update(); on the item in c++ } } } MyFboRenderer { id: fboRender sourceItem: rawImage } In c++, I now need to safely pass the texture eventually found in the sourceItem to my QQuickFramebufferObject::Renderer. This has to be thread-safe in every way. As the Image and FBO render items in QML are to be used in model view delegates, they are created and deleted runtime. Any hints on how to accomplish this would be very welcome! Things I've found so far are: - calling sourceItem()-textureProvider()-texture() from the renderer's synchronize function returns 0 even if synchronize was triggered as result of an update called when the image has completed loading. - calling the same from the render-function gives a texture valid texture, and this sortof works, but there is no obvious safe way of accessing sourceItem at this point. I've tried to store a pointer to either the source item or the QQuickFramebufferObject, but both of these might be deleted/invalid when render() is called and crashes do happen. Cheers Ola ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Loader seems to be blocking animation
You also need to update your code to start the toplevel animation :) Fra: VStevenP [vstevenpa...@yahoo.com] Sendt: 12. desember 2013 15:22 To: Sletta Gunnar; interest Emne: Re: SV: [Interest] Loader seems to be blocking animation When I try to use this new sytnax, I see the following run-time error, and the animation doesn't happen. Any idea what I can do to avoid this error and get the animation to work? assets:/qml/WidgetsGallery/Widgets/PageTabsPane.qml:119 ((null)): assets:/qml/WidgetsGallery/Widgets/PageTabsPane.qml:119:9: QML YAnimator: setRunning() cannot be used on non-root animation nodes. - VStevenP - Original Message - From: Sletta Gunnar gunnar.sle...@digia.com To: VStevenP vstevenpa...@yahoo.com; interest@qt-project.org interest@qt-project.org Cc: Sent: Wednesday, December 11, 2013 3:38 AM Subject: SV: [Interest] Loader seems to be blocking animation Though you set the animation to running, it needs to sync up with the renderthread for it to actually start. As you trigger the loader right away, the animation doesn't actually get to start. If you change it into something like this it will work: ParallelAnimation { id: animation SequentialAnimation { PauseAnimation { duration: 20; } ScriptAction { script: loadMyPage(); } } YAnimator { id: highlighterRectAnimator target: highlighterRect duration: 250 } } cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av VStevenP [vstevenpa...@yahoo.com] Sendt: 10. desember 2013 21:24 To: Sletta Gunnar; interest@qt-project.org Emne: Re: [Interest] Loader seems to be blocking animation I switched over to using the new YAnimator type for my icon highlighter rectangle. The animation works, but it's still blocked by the QML Loader, on both Android and Mac Desktop. I got rid of all the old-style states and transitions syntax, and simply switched over to the following syntax: ... property int currentTab: 0 Rectangle { id: pageTabs anchors.fill: parent color: darkgrey Rectangle { id: highlighterRect width: pageTabsPane.width height: pageTabsPane.width // a square color: black YAnimator { id: highlighterRectAnimator target: highlighterRect duration: 40 } Component.onCompleted { y = homeIcon.y } } PageTabIcon { id: homeIcon source:img/homeIcon.svg onPageTabIconClicked: { highlighterRectAnimator.from = highlighterRect.y highlighterRectAnimator.to = homeIcon.y highlighterRectAnimator.running = true currentTab = Common.PageView.Home } } PageTabIcon { id: mixIcon y: pageTabsPane.width source: img/mixIcon.svg onPageTabIconClicked: { highlighterRectAnimator.from = highlighterRect.y highlighterRectAnimator.to = mixIcon.y highlighterRectAnimator.running = true currentTab=Common.PageView.Mix } } ... } Is this the wrong syntax? It's the one syntax I figured out that seemed to cause the Yanimation to work for animating the highlighted background from icon to icon. - VStevenP - Original Message - From: Sletta Gunnar gunnar.sle...@digia.com To: VStevenP vstevenpa...@yahoo.com; interest@qt-project.org interest@qt-project.org Cc: Sent: Tuesday, December 10, 2013 8:43 AM Subject: SV: [Interest] Loader seems to be blocking animation You want to have a look at the new Animator types introduced in Qt 5.2. These run on the render thread and won't be blocked when the loader is running. http://doc-snapshot.qt-project.org/qt5-stable/qtquick-statesanimations-topic.html#animators cheers, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Loader seems to be blocking animation
Though you set the animation to running, it needs to sync up with the renderthread for it to actually start. As you trigger the loader right away, the animation doesn't actually get to start. If you change it into something like this it will work: ParallelAnimation { id: animation SequentialAnimation { PauseAnimation { duration: 20; } ScriptAction { script: loadMyPage(); } } YAnimator { id: highlighterRectAnimator target: highlighterRect duration: 250 } } cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av VStevenP [vstevenpa...@yahoo.com] Sendt: 10. desember 2013 21:24 To: Sletta Gunnar; interest@qt-project.org Emne: Re: [Interest] Loader seems to be blocking animation I switched over to using the new YAnimator type for my icon highlighter rectangle. The animation works, but it's still blocked by the QML Loader, on both Android and Mac Desktop. I got rid of all the old-style states and transitions syntax, and simply switched over to the following syntax: ... property int currentTab: 0 Rectangle { id: pageTabs anchors.fill: parent color: darkgrey Rectangle { id: highlighterRect width: pageTabsPane.width height: pageTabsPane.width // a square color: black YAnimator { id: highlighterRectAnimator target: highlighterRect duration: 40 } Component.onCompleted { y = homeIcon.y } } PageTabIcon { id: homeIcon source:img/homeIcon.svg onPageTabIconClicked: { highlighterRectAnimator.from = highlighterRect.y highlighterRectAnimator.to = homeIcon.y highlighterRectAnimator.running = true currentTab = Common.PageView.Home } } PageTabIcon { id: mixIcon y: pageTabsPane.width source: img/mixIcon.svg onPageTabIconClicked: { highlighterRectAnimator.from = highlighterRect.y highlighterRectAnimator.to = mixIcon.y highlighterRectAnimator.running = true currentTab=Common.PageView.Mix } } ... } Is this the wrong syntax? It's the one syntax I figured out that seemed to cause the Yanimation to work for animating the highlighted background from icon to icon. - VStevenP - Original Message - From: Sletta Gunnar gunnar.sle...@digia.com To: VStevenP vstevenpa...@yahoo.com; interest@qt-project.org interest@qt-project.org Cc: Sent: Tuesday, December 10, 2013 8:43 AM Subject: SV: [Interest] Loader seems to be blocking animation You want to have a look at the new Animator types introduced in Qt 5.2. These run on the render thread and won't be blocked when the loader is running. http://doc-snapshot.qt-project.org/qt5-stable/qtquick-statesanimations-topic.html#animators cheers, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Loader seems to be blocking animation
You want to have a look at the new Animator types introduced in Qt 5.2. These run on the render thread and won't be blocked when the loader is running. http://doc-snapshot.qt-project.org/qt5-stable/qtquick-statesanimations-topic.html#animators cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av VStevenP [vstevenpa...@yahoo.com] Sendt: 10. desember 2013 14:20 To: interest@qt-project.org Emne: [Interest] Loader seems to be blocking animation Is it possible to avoid the Loader blocking an animation in the following case?: 1. I have a sidebar that contains a few icons, and I am animating the location of a colored Rectangle to highlight the most recently touched sidebar icon. 2. As a result of a new sidebar icon selection, I am unloading/loading some other QML based on the resulting change to the value of currentTab. So, I've basically got a very simple situation where the sidebar icon selection controls the QML that is loaded/shown in a shared client area of the display. Sample code: DesktopIcon { id: thisIcon y: 200 source: thisIcon.png onDesktopIconClicked: { pageTabs.state = 'arrange'// This triggers the animation of the highlighter rectangle of the icon. currentTab = Common.PageView.Arrange // This causes unload old QML then load new QML for client pane area, // due to a binding to currentTab elsewhere in the code. } } This code causes a noticeable delay before the animation occurs, at least on Android. It seems the Loader blocks the animation. Is this delay at all avoidable? My current workaround is to not use the Loader, and just load all the QML at startup, then use the visibility property to control what is shown in the client pane area. It requires that more QML stay loaded at a given time, though. (This workaround might not be all bad, because it would allow for nicer transition animation possibilities in the client pane area.) - VStevenP ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt5.2 OpenGL error
I suspect that those warnings are indicators of an underlying problem. They should not be fatal on their own. How does other OpenGL apps work on they system? Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av Ramakanthreddy Kesireddy [ramakanthreddy.kesire...@techmahindra.com] Sendt: 4. desember 2013 14:25 To: interest@qt-project.org Emne: [Interest] Qt5.2 OpenGL error Hi, I ported Qt5.2 on the IMX6 Sabre AI board with gnome xcb distribution. It uses platform plugin xcb. When running QtQuick Application on IMX6 free scale board, it gives the below error: QSGContext::initialize: depth buffer support missing, expect rendering errors QSGcontext::initialize:stencil buffer support missing, expect rendering errors Segmentation fault. If I try to point to mesa GL libraries, the application works but the rendering is too slow. Please suggest what could be the issue in this regard. Thanks and Regards, Ramakanth DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] OpenGL drivers
Hi, As many of you might already have noticed, OpenGL drivers are not always working as well as would like. This has always been a problem, but since Qt Creator 3.0 is using Qt Quick 2.0 and Qt Quick 2.0 is also being used in more and more places, the problem is becoming more mainstream. We are aware of several issues and patched Qt to tackle them, but we expect we will need more. To figure out what needs to be done, we need a broader picture. Long term, the solution for Qt might be that we bundle a software GL implementation (llvmpipe for instance) and switch to that if a driver is too problematic for us. Hopefully, we can get by with applying workarounds in Qt though. So, I'm asking that if you encounter issues with flickering, crashes, bad rendering and similar, help us track which things are problematic by filing a bugreport on bugreports.qt-project.org and use the label driverissue in the task. Please include OS, windowing system, graphics hardware and driver version. And since most of the workarounds have been applied to Qt 5.2, do test against the 5.2 RC1 or later. Some other things that might help while identifying the problem is: - Does upgrading driver or installing latest vendor supplied driver help? - QSG_RENDER_LOOP=basic - switch Qt Quick to use the GUI thread for rendering - QSG_INFO=1 - make Qt Quick output SG and GL information. - LIBGL_ALWAYS_SOFTWARE=1 - for Linux/Mesa based only, forces use of software Mesa rendering - How does other GL applications in the system fare and what about Qt's OpenGL examples? - vsynced or not? thanks, Gunnar Please don't reply to this mail to report issues :) ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Implications of fractional x, y, width, height of QML Items?
In Qt Quick 2.0, there is no difference in performance, but there are some visual aspects you will have to consider. Once you start placing things on subpixel positions that also means you get antialiased edges on images and rects, texture sampling in images is no longer pixel-to-pixel, etc. This might not always be what you want. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av VStevenP [vstevenpa...@yahoo.com] Sendt: 27. november 2013 19:12 To: interest@qt-project.org Emne: [Interest] Implications of fractional x, y, width,height of QML Items? I understand that QML Item's x, y, width, and height properties are reals. Are there any performance considerations when specifying fractional values for these, on desktop or other platforms such as BB-xM? I am doing a flexible layout based on ratios, so unless I use Math.round, I know I'll end up setting some fractional values for these properties. I'd like to understand the implications, and I don't see much discussion about this on the web. - VStevenP ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtQuick - ColorAnimation issue with colors that have alpha
I am unsure if it is intended or not, but the problem seems to be that you don't have a well defined base state to return to when you exit the pressed state. The result is that the transition will go from the pressed state to undefined and only after it completes does it apply the original color. The fix is either to mark the transition as reversible: true in which case it reverts it self based on the original state or perhaps more cleanly, define a base state with property changes that the transition can pick up. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av Preet [prismatic.proj...@gmail.com] Sendt: 23. november 2013 01:59 To: interest@qt-project.org Emne: [Interest] QtQuick - ColorAnimation issue with colors that have alpha Hi, I use ColorAnimation to animate a color transition on a rectangle between two states (say ColorA to ColorB). The default color of the rectangle is A, and it changes to B when a child MouseArea is pressed. In the case where ColorA is completely transparent (#00abcdef) and ColorB is completely opaque, the animation from ColorA-ColorB seems to work fine. The alpha along with RGB components is faded from A to B. However, when going back from B to A, it seems like the transition goes something like ColorB-ColorA(no alpha)-Black-ColorA This doesn't happen if ColorB has any alpha in it. There's a quick work around by making ColorB nearly opaque (ie. #FEabcdef) Here's a simple example: http://pastebin.kde.org/pixaqd47y I'm on Qt 5.2, somewhere around beta from git. Is this a bug? Preet ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Tearing in Quick2 flickable-based items with clipping enabled
with BB-xM could give some guidance for lessing CPU usage numbers of simple QtQuick2 widgets. - VStevenP On Thu, 11/14/13, Ola Røer Thorsen o...@silentwings.no wrote: Subject: Re: [Interest] Tearing in Quick2 flickable-based items with clipping enabled To: Sletta Gunnar gunnar.sle...@digia.com Cc: interest@qt-project.org interest@qt-project.org Date: Thursday, November 14, 2013, 5:24 AM Hi again, digging further into this reveals some issues with the PowerVR SGX530 (Omap3) when using the flip mode. So it's not Qt. Sorry for the noise. Seems like it only happens at 60Hz. Will there be an option in 5.2 to set the swap interval, or did it end up in 5.3? I'd probably go for a steady 30Hz instead of a 30-60 mix with the occasional tearing. Cheers,Ola 2013/11/13 Ola Røer Thorsen o...@silentwings.no Hi Gunnar, I'll see if I can create a small example that reproduces it. Cheers,Ola 2013/11/13 Sletta Gunnar gunnar.sle...@digia.com If this consistently reproducible across desktop and device, then I would appreciate a bugreport with an example that reproduces it. It is not a known issue to me at least. (bugreports.qt-project.org) Clipping is implemented using scissor or stencil depending on the complexity of the mask, no intermediate texture is involved. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no] Sendt: 13. november 2013 15:29 To: interest@qt-project.org Emne: [Interest] Tearing in Quick2 flickable-based items with clipping enabled Hi all, I'm seeing tearing-effects when scrolling in ListView and other items based on Flickable when clipping is enabled. This is running on both a Linux desktop as well as an embedded Linux device (eglfs). The Qt version is 5.1.1. The systems are running with vsync enabled and double-buffering. There is no tearing in any other items except the ones with clipping enabled. Tearing is especially noticeable on the embedded device. The GPU is a PowerVR SGX chip which is tile-based, so the tearing lines are actually vertical. Also the framerate is mostly somewhere between 30-60. Tearing appears maybe 20% of the time spent scrolling. I'm wondering if the core issue is this: I assume clipping is implemented as rendering the item into a temporary texture, and the clipped area is of this is finally rendered to the screen buffer. This temporary texture is not double-buffered. This means it would be possible that the render pipeline starts writing into a texture (next frame) that is being drawing into the screen buffer (current frame). Any thoughts? The tearing is really bad sometimes, and I don't really have the option of disabling clipping either. Cheers, Ola -Inline Attachment Follows- ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Tearing in Quick2 flickable-based items with clipping enabled
If this consistently reproducible across desktop and device, then I would appreciate a bugreport with an example that reproduces it. It is not a known issue to me at least. (bugreports.qt-project.org) Clipping is implemented using scissor or stencil depending on the complexity of the mask, no intermediate texture is involved. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no] Sendt: 13. november 2013 15:29 To: interest@qt-project.org Emne: [Interest] Tearing in Quick2 flickable-based items with clipping enabled Hi all, I'm seeing tearing-effects when scrolling in ListView and other items based on Flickable when clipping is enabled. This is running on both a Linux desktop as well as an embedded Linux device (eglfs). The Qt version is 5.1.1. The systems are running with vsync enabled and double-buffering. There is no tearing in any other items except the ones with clipping enabled. Tearing is especially noticeable on the embedded device. The GPU is a PowerVR SGX chip which is tile-based, so the tearing lines are actually vertical. Also the framerate is mostly somewhere between 30-60. Tearing appears maybe 20% of the time spent scrolling. I'm wondering if the core issue is this: I assume clipping is implemented as rendering the item into a temporary texture, and the clipped area is of this is finally rendered to the screen buffer. This temporary texture is not double-buffered. This means it would be possible that the render pipeline starts writing into a texture (next frame) that is being drawing into the screen buffer (current frame). Any thoughts? The tearing is really bad sometimes, and I don't really have the option of disabling clipping either. Cheers, Ola ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Quick2 ShaderEffect: source or provider missing when binding textures
The error message has been quite helpful with tracking down errors in the past, but I guess we can at least remove it from release builds and limit it a bit :) Added https://bugreports.qt-project.org/browse/QTBUG-34676 to track this. But why are you showing ShaderEffects which lack their image data? That is just wasting GPU resources ShaderEffect { property variant source; visible: typeof source != 'undefined' source.status == Ready ... } Should keep it hidden and also remove the warning... cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av Ola Røer Thorsen [o...@silentwings.no] Sendt: 7. november 2013 16:43 To: interest@qt-project.org Emne: [Interest] Quick2 ShaderEffect: source or provider missing when binding textures Hi all, if I use a ShaderEffect on an image that is loaded asynchronously, I get the error/debug message on the console: ShaderEffect: source or provider missing when binding textures for every frame rendered until the image is completely loaded and the texture is complete. This means our system logs on the target system (embedded linux device) gets flooded whenever we load new images (a photo viewer). Would it be possible to at least limit the number of times this is written (once instead of every frame)? Or could the message be removed completely? It's not useful at all when ShaderEffect is used this way. Best regards, Ola ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform
I find it very strange that qmlscene without an input file would produce the same apitrace as a qmlscene with a file. The apitrace is a reflection what we try to draw after all and that is highly dependent on what the input is. What does the trace look like? It is a long-shot, but you could try https://codereview.qt-project.org/#change,69666 cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] på vegne av Narayanarao Rao [nar...@gmail.com] Sendt: 6. november 2013 00:05 To: Interest@qt-project.org Emne: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform I am able to build qtbase and qtdeclarative from git with a few changes for our MIPS 74kf -mdspr2 platform. I use eglfs plugin. If I don't pass any qml file to qmlscene, eglfs does gltexsubimage2d of a qimage (file selection dialog). That works fine. I can see the file selection dialog, though with very small text. eglfs with Qt 5.0 works fine - I can see output on screen for all qmls. We use Qt 4.8 simplegl for our production releases and that works fine too. However, with Qt 5.2 new scenegraph changes, if I pass a qml file to qmlscene, I just see the screen cleared to white and nothing gets drawn after that. When I enable render_timing etc. environment veriables, I see everything printed normally - I see that it takes some time for render, sync, animations etc. It also takes expected CPU when doing QML animations. I tried both qmls with an image as well as rect. I suspect our GPU does not like the new shader code. I ported apitrace to our platform and compared traces for case where I see output on screen (qmlscene without qml file input) and where I don't see output on screen (qmlscene with any qml file). Both look similar except for differences in vertex and fragment shaders. Anything I should try? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform
A buffer offset of 0 is correct since it is relative to VBO's memory which is bound just above the lines you pasted down below. Fra: Narayanarao Rao [nar...@gmail.com] Sendt: 6. november 2013 11:02 To: Sletta Gunnar Cc: Interest@qt-project.org Emne: Re: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform Thanks for the reply. I only said they look similar, not the same. Of course, I do not understand OpenGL very well. I am now trying to read and understand what each line of the apitrace means and write a standalone opengl c app that only makes those calls. I am relatively new to opengl, so bear with me.. One difference I found in the traces is the following sequence of calls: 194 glEnableVertexAttribArray(index = 0) 195 glEnableVertexAttribArray(index = 1) 196 glEnableVertexAttribArray(index = 2) 197 glUseProgram(program = 1) 198 glBindTexture(target = GL_TEXTURE_2D, texture = 1) 199 glUniformMatrix4fv(location = 0, count = 1, transpose = GL_FALSE, value = {0.0015625, 0, 0, 0, 0, -0.00278, 0, 0, 0, 0, 1, 0, -1, 1, 0, 1}) 200 glVertexAttribPointer(index = 0, size = 2, type = GL_FLOAT, normalized = GL_FALSE, stride = 16, pointer = NULL) 202 glFlush() 201 glDrawElements(mode = GL_TRIANGLE_STRIP, count = 6, type = GL_UNSIGNED_SHORT, indices = 0x50) 203 glEnable(cap = GL_BLEND) 204 glDepthMask(flag = GL_FALSE) 205 glBlendFunc(sfactor = GL_ONE, dfactor = GL_ONE_MINUS_SRC_ALPHA) 206 glDisableVertexAttribArray(index = 0) 207 glDisableVertexAttribArray(index = 1) 208 glDisableVertexAttribArray(index = 2) The above trace is for the non-working case. glVertexAttribPointer is NULL. Is this expected? I am still trying to workout where in Qt this call is being made from. The corresponding trace for the working case (qmlscene without qml) 309 glEnableVertexAttribArray(index = 1) 310 glEnableVertexAttribArray(index = 0) 311 glBindTexture(target = GL_TEXTURE_2D, texture = 1) 312 glUniform1i(location = 1, v0 = 1) 313 glVertexAttribPointer(index = 0, size = 2, type = GL_FLOAT, normalized = GL_FALSE, stride = 8, pointer = blob(32)) 314 glDrawArrays(mode = GL_TRIANGLE_FAN, first = 0, count = 4) 315 glBindTexture(target = GL_TEXTURE_2D, texture = 0) 316 glDisableVertexAttribArray(index = 1) 317 glDisableVertexAttribArray(index = 0) ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform
The scene graph renderer uses the same buffer object for both indices and vertices. This is within spec, but I worried that some drivers might like it less than others. This setup is the first one where it doesn't work. The patch doubles the amount of uploads we do, but the total memory is unchanged. It will be a small overall additional cost, and if it is needed, it is needed. cheers, Gunnar Fra: Narayanarao Rao [nar...@gmail.com] Sendt: 6. november 2013 13:10 To: Sletta Gunnar Cc: Interest@qt-project.org Emne: Re: [Interest] Qt 5.2 scenegraph does not draw anything for our MIPS cpu/VIVANTE GPU platform I tried the patch you suggested and it works. What does this mean? Are there any performance implications to this? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Performance of Qt 5.2 much slower than Qt 5.1?
Is the time spent rendering gone up or is it something else? Generally, I see improved rendering performance across the board. If you run the code with QSG_RENDER_TIMING=1 you get some indication of the breakdown of where time is being spent. Performance of javascript has gone down some since Qt 5.1 as a result of the replacement of the V8 java script engine with our own V4. Work on improving performance here is still ongoing. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av VStevenP [vstevenpa...@yahoo.com] Sendt: 6. november 2013 15:33 To: interest@qt-project.org; David V-Play Emne: Re: [Interest] Performance of Qt 5.2 much slower than Qt 5.1? A colleague and I also see one performance issue with Qt 5.2 Beta as compared to Qt 5.1. We observe a 20% jump in CPU usage with the FPS Item from the Cinematic Experience Demo. This is the component which dynamically displays the number of frames per second and has a spinning graphic. You can see it in action here: https://www.youtube.com/watch?v=wulbR2R1GpMfeature=player_embedded#at=40 We observe this large increase in CPU usage due to the FPS Item on a BeagleBoard-xM/Angstrom. If anyone has an idea why FPS Item would run far less efficiently in Qt 5.2 Beta on BB-xM, please let me know. - VStevenP ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Turning on MSAA on a Qml-created Window
Hi Josh, This should be possible, but there are a few things to keep in mind. In Qt 5.1 the QQuickWindows all share the same OpenGL context, so you need to request multisampling on the first window you show, before you show it. As a result, all QQuickWindows will get multisampling. If you open the first ApplicationWindow from QML, use a C++ function to assign it the surface format of your choice before showing the window. The scene graph will pick up the format you specified using QQuickWindow::setFormat() and use that. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av Josh Faust [jfa...@suitabletech.com] Sendt: 1. november 2013 23:33 To: interest@qt-project.org Emne: [Interest] Turning on MSAA on a Qml-created Window Is this possible? I can't use a custom QQuickWindow subclass, as I'm using ApplicationWindow. Is there any way to set the default QSurfaceFormat that will be used by QWindow? Josh ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] use custom fragment shader for Quick2 Image item
You can use a ShaderEffect element. It does not use an FBO for plain Image types. Image { id: myImage visible: false } ShaderEffect { property variant source: myImage anchors.fill: myImage fragmentShader: varying highp vec2 qt_TexCoord0; uniform lowp vec4 sampler2D source; void main() { gl_FragColor = texture2D(source, qt_TexCoord0).rrra; } } In Qt 5.0 and 5.1 this will use the texture directly without any extra copies. In 5.2 the image's texture might be in an atlas and will currently be copied out of the atlas into its own texture which is then used directly. I want to add some performance hints to the ShaderEffect to avoid the copy-out-of-the-atlas (which is needed for compatibility right now), but I'm not sure those will make 5.2. The other alternative is to implement a custom material using the QSG API directly. Then you get the best possible performance. cheers, Gunnar Fra: interest-bounces+gunnar.sletta=digia@qt-project.org [interest-bounces+gunnar.sletta=digia@qt-project.org] p#229; vegne av Ola Røer Thorsen [o...@silentwings.no] Sendt: 22. oktober 2013 15:20 To: interest@qt-project.org Emne: [Interest] use custom fragment shader for Quick2 Image item Hi all, I want to use a custom fragment shader when rendering a Image item. Is it possible to set the shader to use directly somehow? That is, I want to use a custom shader instead of the passthrough fragment shader used in the Image element. I have tried using the QtGraphicalEffects (GammaAdjust), but the performance is not good enough on my target platform (Omap 3530). ShaderEffect elements work, but they also seem to render via another render-texture, again with a performance loss. Best regards, Ola ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt 5.1.1 render with both - OpenGL and QPainter - in one window?
This is very possible :) The classes you are looking for are: QWindow - to create the window QOpenGLContext - to get the OpenGL context QOpenGLPaintDevice - to make the opengl context renderable with QPainter QPainter - to draw the text. cheers, Gunnar On Sep 24, 2013, at 4:15 PM, Thomas Meyer pub...@meyer-thomas.com wrote: Hi, is it possible to use OpenGL and QPainter in one window (Qt 5.1.1)? And if it is possible, how and is it recommended? Example: I want to render the word Triangle into the 'OpenGL Window Example' (please see Qt Creator - Welcome - Examples). My first guess is, that it is not possible. I can only render with OpenGL or with QPainter, like the example shows. Thanks, Thomas ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QML Presentation System, detailed docs roadmap?
Hi Charley, Thanks you for your interest in this project :) The original idea I had for the presentation system was to make it convenient to mix a slide deck with live QML. It makes the assumption that the user understands QML. I agree with you that there are tons of improvements that could be made, but I tend to only devote time to that project when I need to write presentations of my own, so right now things are standing a bit still. The docs are all located in the examples/tutorial file. It covers every feature the system has and is meant as a starting point and a guide. As for extending the current system, I would also like to see that. Things that come to mind is an easier way of overriding fonts and layouts. A better way of defining custom transitions. And finally a suite of templates so that some choice is available out of the box. The project is hosted on Qt Project's codereview, so if you have patches to either the docs or structural changes to the API to make it a better system, please send them for review to qml-presentation-system.git under: https://codereview.qt-project.org/#admin,projects cheers, Gunnar On Sep 6, 2013, at 11:33 PM, Charley Bay charleyb...@gmail.com wrote: Gunnar's post on his QML Presentation System in 2011 was absolutely inspiring, IMHO: http://blog.qt.digia.com/blog/2011/05/30/a-qml-presentation-system/ At the time, (and still now), I viewed this as a *brilliant* application of QML that would ultimately be a better approach for creating presentations than any of the existing commercial presentation-software out there. Very clever idea, with great potential. Correct me on any of these points: =WHERE HOSTED *- It's on both Gitorious and GitHub ... I guess both of these are being maintained? Gitorious: (last commit May-2013): http://qt.gitorious.org/qt-labs/qml-presentation-system/source/171c7228d39e5fcb7d034f3f6bbb82ad61a33eb8: GitHub: (last commit May-2013): https://github.com/qtproject/qt-labs-qml-presentation-system =OTHER SIMILAR PROJECTS It looks like it inspired Quickshow, which I think might now be abandoned? http://www.ohloh.net/p/quickshow Not sure if it also inspired other efforts? =EXAMPLES AND DOCS IMHO, the Git repository is adequate: The README and examples are good. (Minor nit is that the examples run fine on Win7/Qt5.1, the printslides project builds/works fine, but I failed so far to get the Src.pro project working -- not sure how I'm supposed to use that yet). I think the best training/existing-docs is actually Gunnar's original video in his blog entry (and reading the QML source itself). I have some questions on how some of these QML files are intended-to-be-used (e.g., what files to copy-and-change for new presentations, what to use as-is through library-import for reusable-slide-definitions, how to physically organize files and extend standard slides for library-imports, etc.) Most of these questions, I'm sure, relate to my current mis-understanding as to how to standardize/productize QML file collections as generic-reusable-libraries (I'm delving into that now). =ROADMAP -- ? Is there one, or interest in one? I think there is *HUGE* potential here. For example: (A)- Establish good (more detailed) documentation: (1) A theory-of-op for how it works. (2) Productization of existing QML-presentation-types (bundled/ready-to-deploy) so the user can merely import-modules for standard-presentation-types; (e.g., standard-module-namespaces, etc.) (3) Document minimal steps to create a new presentation, including provided Hello World example (using import-module from (2)) (4) How to override/customize the standard QML-presentation types to modify default behavior, with example implementation (5) How to extend/add-to the standard QML-presentation types (such as to add new slide-types or slide-transitions), with example implementation (B) Centralize presentation Theming so colors/fonts/etc. can be changed in a single spot for use across the presentation; enabling standardized themes that can be applied to a presentation. (C) Add new capability, such as using an OS or plugin-interface that auto-detects and establishes display resolutions, default fonts, etc., and style-izes the presentation at load/run-time to the local projector-or-computer. (D) Create a QML-bundler that establishes a self-executing presentation, or that deploys the QML-files collection needed to present (E) (Possibly) Create a QML-code-generator that generates the QML files for a presentation by reading in some resource information that describes the slides. (This is less-necessary if the user can mark-up minimal QML files directly; and more-necessary if the user is expected to copy-and-paste files to change the contents for a new presentation.) (F) Create a QML-Presentation-Authoring interface (e.g., IDE or GUI
Re: [Interest] QML Presentation System, detailed docs roadmap?
On Sep 7, 2013, at 12:23 AM, Alan Alpert 4163654...@gmail.com wrote: *actually I still use its precedessor, https://gitorious.org/qt-qml-demo-playground/qt-qml-demo-playground/source/708de53727032441efd63f4ac24d13079fe82c52:qml-presentation , because while it's less user-friendly and less pretty, it loads each slide dynamically which helps when you have a full size embedded QML application on every page. Would it help if we added a LoadedSlide { } type? cheers, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QQuickWindow::update to render custom OpenGL in QtQuick2
On Jun 17, 2013, at 2:38 AM, Preet prismatic.proj...@gmail.com wrote: Hi I want to render things with OpenGL directly in a QQuickItem (like http://doc-snapshot.qt-project.org/qt5-dev/qtquick/scenegraph-openglunderqml.html shows) but I get the impression that doing so means every other item in the scene is updated at the rate that I choose to call QQuickWindow::update() from my custom QQuickItem. I want to avoid the overhead of painting everything again and again if the items in the scene haven't changed, especially if I'm updating my object at 30 or even 60fps. With a QQuickItem that uses a QSGNode I can set DirtyStateBits and then call QQuickItem::update() to force an update to *just that* item. I can't do this with the tutorial I linked above though, because it's not using a node. * Does QQuickWindow::update() truly force a repaint to everything in the window even if it hasn't changed? If so... Yes it does. Calling QQuickWindow::update() will re-schedule all drawing in the scene graph tree on the rendering thread. However, it does not sync with the GUI thread, so it is rather fast unless. You can of course put your top-level item into a layer, by setting layer.enabled: true on the topmost QQuickItem. That will put the entire scene graph into a texture so the rendering so when you do QQuickWindow::update() there is only a single quad being drawn (unless the UI changes, of course). * Is there a way to use partial updates instead? No, the default renderer does not do partial updates and I do not have plans to implement one that does. cheers, Gunnar I'm aware I can render to an FBO, but that takes away the 'easy' full screen MSAA I get with the direct method. Preet ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Apply shader effect from QtGraphicalEffects to QSGGeometryNode?
This graph concept might be a good usecase for a more complex example down the line though.. I'll keep it in mind and maybe it will be included in Qt in the future :) Oh... that sucks. I think so too, so I spent some time yesterday evening to put it together: https://codereview.qt-project.org/#change,58589 It does the background, grid, line and dropshadow as 4 separate geometry nodes and shows several new sides of the scene graph API. The line stroking is a bit crude as it doesn't account for the line angle so steep slopes will come out thinner, but it should be a good starting point. cheers, Gunnar Well, i guess i'm just gonna have to play with this and see how it turns out. If (assuming i can figure it out) i get it working i will certainly share my code in here or on this list. - for the dropshadow, do exactly the same as for the line, except you can use the custom vertex shader to expand it a little bit more and change the opacity to make it a more blurry. Here i really do wonder if it isn't easier to just make a simple line component and use QtGraphicalEffects for the shadowing... I guess experimenting with both will tell which option works best. - for the gradient under the line, create a trianglestrip and colorize it according based on the y position in the fragment shader. Yeah, figured it would be something like that. Will do. 2. Another way i see is taking the OpenGL direct approach following the OpenGLunderQML example [1]. I can probably work of that example, but i really try to stay away from doing direct opengl interaction.. Raw OpenGL has its benefits, which is why the example and the feature is there, but I've been thinking that the primary usecase for OpenGLUnderQML is when you have a game/cad app running and QML is just the HUD controls. Using raw opengl for UI elements has the downside that you don't get any inherited clipping, transformation, nor opacity so things might be quite a bit more complicated to manage inside your UI. Exactly my opinion as well. I try to stay away from raw opengl calls. 3. A third possible way that i can think of is by throwing everything out and starting over in a very abstract manner. Making a bunch of small components (in C++) like: (note: this is still for the charting stuff [0]) - 1 component to draw the background with a little more power then a Rectangle. However, if i choose this route i might as well use the QtGraphicalEffects for the added power (gradients) since that provides it. - 1 component for drawing a grid on top of the gradient. - 1 component for drawing a line where i probably only provide the data indicating where the line should be. Again i can use QtGraphicalEffects on top of this to add additional shadow. However, i find the default OpenGL line drawing stuff (even with multisampling) of a very very very poor rendering quality. I'm really thinking of using the vase renderer for drawing a way sharper line [2] Another note, this might also be very interesting for you to draw way sharper scene graph fonts which at the moment still look quite blurry at it's best under desktop environments. The distancefield fonts are unhinted and this is why they look more blurry than native fonts (at least on windows and potentially linux). You can enable native rendering by sacrificing font scalability: http://blog.qt.digia.com/blog/2012/08/08/native-looking-text-in-qml-2/ - I'm stuck at how to animate the line as more data flows in.. I hope you can advice me here in picking an option to go for. It's all quite a bit of work and all likely has the same end result. Right now i'm leaning towards option 3 where i was trying to go for option 1 till this very moment. [0] http://i.stack.imgur.com/Zk2RG.png -- i try to make it look as crisp as this one [1] https://qt.gitorious.org/qt/qtdeclarative/trees/stable/examples/quick/scenegraph/openglunderqml [2] http://www.codeproject.com/Articles/226569/Drawing-polylines-by-tessellation On Mon, Jun 10, 2013 at 10:07 AM, Sletta Gunnar gunnar.sle...@digia.com wrote: On Jun 8, 2013, at 11:33 PM, Mark mark...@gmail.com wrote: Hi, Back when the graphical effects where first showcased in a blog i was already kinda scared that there would be no C++ interface to use them from the C++ side. Now i find myself in the position where i want to use the DropShadow element from that very same module in custom QML Scene Graph module and give a line a shadow. I kinda - very much - dislike copying the relavant parts of the DropShadow code and re-create that in C++.. Is there a way that i can use DropShadow from the C++ side? There is no way to do this using pure C++ API. You could construct it from c++ using QQmlComponent and set the source property by passing it the item that creates the geometry node. cheers, Gunnar Regards, Mark ___ Interest mailing list
Re: [Interest] Set shader on QSGFlatColorMaterial?
On Jun 9, 2013, at 12:59 AM, Mark mark...@gmail.com wrote: Hi, Yet another scene graph related question :) I have to say, the documentation in the scene graph department could really use some more docs and advanced examples! The code leaves a lot of guess work and there isn't much to find since this tech is quite new. I know, I'm adding stuff as time permits :) Anyhow, I want to apply a shader to my flat material. QSGFlatColorMaterial has a createShader() method that return a QSGMaterialShader, but then what? You set the material on the geometry node and the rest happens internally. Also, how can i set multiple shaders on one material? You don't. You can use two different geometry nodes which share the same QSGGeometry but have different materials (see the code in the example I posted in the other thread). Or you can have one QSGGeometryNode which reimplements QSGNode::preprocess() to switch the material at runtime just before it is drawn. since the flat material i'm talking about now needs two. One for antialiasing (playing with that [1]) and one for drawing a shadow. This is algorithm is applying a post-filtering effect on the entire scene after it is rendered. This is not something you do with just nodes in scenegraph. If you want to apply this for the whole window you should use QQuickWindow::beforeRendering to redirect the QQuickWindow to an FBO using QQuickWindow::setRenderTarget(). Then you can use QQuickWindow::afterRendering() to apply the FXAA filtering to that FBO as you draw it to the screen. If you want to do this inside QML, you can also do that using a ShaderEffectsouce and ShaderEffect on the graph element. Then the ShaderEffectSource will do the rendering to the FBO and the ShaderEffect will apply the post processing. But I do suspect that text and single-pixel horizontal/vertical lines will look rather ugly afterwards :) cheers, Gunnar Cheers, Mark [1] http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Apply shader effect from QtGraphicalEffects to QSGGeometryNode?
On Jun 12, 2013, at 9:58 PM, Mark mark...@gmail.com wrote: Hi Gunnar, I just tried your example out (from the new review link [1]) and you've truly done a amazing job! + you saved my days of fiddling around :) Big pros! It runs well on Qt with OpenGL on Windows. I haven't tried other instances. Again, an awesome job! Will this be added as an example to 5.1.0 or 5.1.1? It's not like it's blocking anything ;) Targeted at 5.1.1 now, it is by no means a showstopper :) Cheers, Mark [1] https://codereview.qt-project.org/#change,58714 On Wed, Jun 12, 2013 at 8:54 AM, Mark mark...@gmail.com wrote: On Wed, Jun 12, 2013 at 8:29 AM, Sletta Gunnar gunnar.sle...@digia.com wrote: This graph concept might be a good usecase for a more complex example down the line though.. I'll keep it in mind and maybe it will be included in Qt in the future :) Oh... that sucks. I think so too, so I spent some time yesterday evening to put it together: https://codereview.qt-project.org/#change,58589 It does the background, grid, line and dropshadow as 4 separate geometry nodes and shows several new sides of the scene graph API. The line stroking is a bit crude as it doesn't account for the line angle so steep slopes will come out thinner, but it should be a good starting point. Oh wow! You're trying to do everything i tried in just a couple of hours where i would spend several nights and not even get close to what you just made. Thank you very much for this! cheers, Gunnar Well, i guess i'm just gonna have to play with this and see how it turns out. If (assuming i can figure it out) i get it working i will certainly share my code in here or on this list. - for the dropshadow, do exactly the same as for the line, except you can use the custom vertex shader to expand it a little bit more and change the opacity to make it a more blurry. Here i really do wonder if it isn't easier to just make a simple line component and use QtGraphicalEffects for the shadowing... I guess experimenting with both will tell which option works best. - for the gradient under the line, create a trianglestrip and colorize it according based on the y position in the fragment shader. Yeah, figured it would be something like that. Will do. 2. Another way i see is taking the OpenGL direct approach following the OpenGLunderQML example [1]. I can probably work of that example, but i really try to stay away from doing direct opengl interaction.. Raw OpenGL has its benefits, which is why the example and the feature is there, but I've been thinking that the primary usecase for OpenGLUnderQML is when you have a game/cad app running and QML is just the HUD controls. Using raw opengl for UI elements has the downside that you don't get any inherited clipping, transformation, nor opacity so things might be quite a bit more complicated to manage inside your UI. Exactly my opinion as well. I try to stay away from raw opengl calls. 3. A third possible way that i can think of is by throwing everything out and starting over in a very abstract manner. Making a bunch of small components (in C++) like: (note: this is still for the charting stuff [0]) - 1 component to draw the background with a little more power then a Rectangle. However, if i choose this route i might as well use the QtGraphicalEffects for the added power (gradients) since that provides it. - 1 component for drawing a grid on top of the gradient. - 1 component for drawing a line where i probably only provide the data indicating where the line should be. Again i can use QtGraphicalEffects on top of this to add additional shadow. However, i find the default OpenGL line drawing stuff (even with multisampling) of a very very very poor rendering quality. I'm really thinking of using the vase renderer for drawing a way sharper line [2] Another note, this might also be very interesting for you to draw way sharper scene graph fonts which at the moment still look quite blurry at it's best under desktop environments. The distancefield fonts are unhinted and this is why they look more blurry than native fonts (at least on windows and potentially linux). You can enable native rendering by sacrificing font scalability: http://blog.qt.digia.com/blog/2012/08/08/native-looking-text-in-qml-2/ - I'm stuck at how to animate the line as more data flows in.. I hope you can advice me here in picking an option to go for. It's all quite a bit of work and all likely has the same end result. Right now i'm leaning towards option 3 where i was trying to go for option 1 till this very moment. [0] http://i.stack.imgur.com/Zk2RG.png -- i try to make it look as crisp as this one [1] https://qt.gitorious.org/qt/qtdeclarative/trees/stable/examples/quick/scenegraph/openglunderqml [2] http://www.codeproject.com/Articles/226569/Drawing-polylines-by-tessellation On Mon, Jun 10, 2013
Re: [Interest] Particles Emitter, emit signal when particle life is expired?
On May 14, 2013, at 9:58 AM, Mark mark...@gmail.com wrote: On Sun, May 12, 2013 at 2:08 PM, Mark mark...@gmail.com wrote: Hi, I'm browsing through the Emitter API while searching for some way to get notified when a particle is expired. What i'm having is one emitter that emits 1 particle every 25ms then one trailemitter that adds a trail to the particle. Now in the main emitter (with 1 particle every 25 ms) i want to get notified when the particle dies - which is 625 ms later. How can i do that? I can probably play with the Timer element, but then i'd need a timer for every particle which is quite a pain to do in QML in a dynamic fashion.. I'm actually hoping there is a signal somewhere (or a onSomething...) that i haven't found yet but can also be used to get the same result. If that doesn't exists then i guess i need to make a dynamic timer element for QML, right? The ideal thing - for me - to have here is a signal that fires with the X and Y position where the particle expired. Regards, Mark Anyone? Tracking each individual particle is not really in line with the concept of a particle systems as they are typically set up as fire-and-forget to be as cheap and fast as possible. However, there might be way that works for you, granted that you don't have too many particles live at the same time. If you use the ItemParticle, you can specify a delegate for it. This delegate can be a normal Image {} item, and will be a lot slower (probably in the range 100-1000x worse) than plain a ImageParticle, but you can then track it using the onVisibleChanged signal. When the item is visible, it is alive and when it is hidden its lifespan has ended. cheers, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QtQuick2 image rendering and custom shader overhead
On May 5, 2013, at 11:47 AM, Sean Harmer sean.har...@kdab.com wrote: On 04/05/2013 19:30, Preet wrote: Hi, ... 2. I'd like to use ShaderEffects to apply a somewhat trivial shader to most of the images in my application. The images are black and white icons, and I'd like to use shaders to change the black and white output fragments to different colors (ie maybe blue and green, red and yellow, etc). The shader itself is super simple and probably adds negligable cost to the pipeline, but I'm concerned about how overall performance would be affected compared to the default method QtQuick uses to render a bunch of images. Would QtQuick still intelligently batch the images and draw them using only a few calls? Or would it individually bind the same shader and issue a separate draw call for each image? Using a ShaderEffect item implies rendering the source to a texture via an FBO and then applying the effect's shaders to the resulting texture. Therefore using many ShaderEffects will produce a performance impact at some point. If you really have many of these items to show it would be better to implement a custom item using the scene graph api. Take the existing QSGSimpleTextureNode or image item as starting points and provide a custom material that renders using your colourisation shader. This way you avoid the FBO pass for each item. This is not quite correct :) Using ShaderEffectSource or Item.layer: true does mean going through an FBO. Using ShaderEffect alone or with a plain Image element can be almost the same as using a plain Image element. I say can as the content of the shader greatly impacts the resulting performance. If you do: Image { id: theIcon source: myIcon.png visible: false } ShaderEffect { propery variant source: theIcon width: theIcon.width height: theIcon.height fragmentShader: } There is no FBO involved and the performance will be close to that of rendering a normal Image. Image elements can be used directly as texture sources, you see. In fact any, QQuickItem that implements the QSGTextureProvider interface can be used directly as a texture in a shader effect. It is also possible to use ShaderEffect without textures, for instance to render a gradient. As for batching, our current defualt renderer does not do that, it only reorders rendering commands to minimise state changes and to use the depth buffer to cull elements behind opaque elements. cheers, Gunnar Hope this helps, Sean Preet -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest -- Dr Sean Harmer | sean.har...@kdab.com | Senior Software Engineer Klarälvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Qt5 QML OpenGL and black texture problem
You are at least not setting the required texture parameters which will make the texture incomplete. You typically need to set the textures wrap and min/mag filters at least once: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); btw, I would think the Scene Graph - Rendering FBOs example I added for 5.1 is a good starting place for implementing what you are trying to do here: http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-textureinsgnode.html cheers, Gunnar On May 2, 2013, at 12:31 PM, BOUCARD Olivier boucard_oliv...@yahoo.fr wrote: Hi guys, I'm trying to display some native OpenGL inside a custom QML item using Qt 5.0.2 on a Linux x86_64 with a Nvidia 9600M GT (driver v295.40). I have a custom QQuickPaintedItem with a overloaded paint where I use painter-beginNativePainting() and a shader program: Vertex shader: uniform highp mat4 projectionMatrix; uniform highp mat4 modelViewMatrix; void main(void) { gl_Position = projectionMatrix * modelViewMatrix * gl_Vertex; gl_FrontColor = gl_Color; gl_TexCoord[0] = gl_MultiTexCoord0; } Fragment shader: uniform highp sampler2D diffuseTexture; void main(void) { gl_FragColor = texture2D(diffuseTexture, gl_TexCoord[0].st); //gl_FragColor = gl_Color; // Display the mesh in white - OK //gl_FragColor = vec4(gl_TexCoord[0].st, 0.0, 1.0); // Display the correct coord - OK } I have a mesh class used to load a mesh using Assimp. At the moment I only load a simple cube.obj. The rendering code is the following: void Mesh::render() { if(mData-hasDiffuse) { glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, mData-diffuse); } glEnableVertexAttribArray(SimpleGameEngine::sAttrLocVertex); glEnableVertexAttribArray(SimpleGameEngine::sAttrLocTex0); glBindBuffer(GL_ARRAY_BUFFER, mData-vertexBuffer); glVertexAttribPointer(SimpleGameEngine::sAttrLocVertex, 3, GL_FLOAT, GL_FALSE, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, mData-texBuffer); glVertexAttribPointer(SimpleGameEngine::sAttrLocTex0, 2, GL_FLOAT, GL_FALSE, 0, NULL); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mData-faceBuffer); glDrawElements(GL_TRIANGLES, mData-faceNum * 3,GL_UNSIGNED_INT, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); glDisableVertexAttribArray(SimpleGameEngine::sAttrLocTex0); glDisableVertexAttribArray(SimpleGameEngine::sAttrLocVertex); if(mData-hasDiffuse) { glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0); } } My texture is loaded using the following code: void Mesh::setDiffuseTexture(const QImage image) { if(image.isNull()) qFatal(Invalid image); QImage texture = QGLWidget::convertToGLFormat(image); if(texture.isNull()) qFatal(Invalid texture); glGenTextures(1, mData-diffuse); glBindTexture(GL_TEXTURE_2D, mData-diffuse); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture.width(), texture.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, texture.bits()); glBindTexture(GL_TEXTURE_2D, 0); mData-hasDiffuse = true; } Everything works. But as soon as I add the texture my cube turns black. I already try with a procedural 4x4 checker texture and it didn't work either. Any help will be appreciated. Olivier. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Anti-aliasing for QML Canvas on Windows?
Antialiasing on an FBO requires FBO multisampling and framebuffer blit support. Do you have these extensions available? Cheers, Gunnar On 3. mai 2013, at 00:04, Mark mark...@gmail.com wrote: On Thu, May 2, 2013 at 11:47 PM, Mark mark...@gmail.com wrote: On Tue, Mar 12, 2013 at 12:22 AM, Bache-Wiig Jens jens.bache-w...@digia.com wrote: Hi, Sorry for delay, I had not seen your question To enable antialiasing in Qt Quick Canvas, you must set the property antialiasing to true and set the property renderTarget to Canvas.Image Guillaume True. It might also be worth mentioning that we also plan to make this the default setting on Canvas items in Qt 5.1. Jens On Fri, Feb 15, 2013 at 7:49 PM, Mark markg85 at gmail.com wrote: Hi, I'm drawing some shapes on Windows 7 with QML Canvas, but the output really seems aliased as in the anti-aliasing is off. The code: import QtQuick 2.0 Item { width: 400 height: 400 Canvas { id:canvas width:400 height:400 antialiasing: true property string strokeStyle:green property string fillStyle:yellow property int lineWidth:10 property bool fill:true property bool stroke:true onPaint: { var ctx = canvas.getContext('2d'); ctx.save(); ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.strokeStyle = canvas.strokeStyle; ctx.fillStyle = canvas.fillStyle; ctx.lineWidth = canvas.lineWidth; ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle if (canvas.fill) ctx.fill(); if (canvas.stroke) ctx.stroke(); ctx.restore(); } } } I'm using Qt 5.0.1 mingw build x86 on Windows 7. Cheers, Mark Anyone? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest Hi, A late followup on this one. I just tried out http://download.qt-project.org/snapshots/qt/5.1/5.1.0-beta1/backups/2013-05-02-11/qt-windows-opensource-5.1.0-beta1-mingw47-x86-offline-2013-05-02-11.exe and ran the example in: C:\Qt\Qt5.1.0\5.1.0-beta1\mingw47_32\examples\quick\canvas. I noticed (quite fast) that antialiasing is not enabled. Another ANGLE issue? My graphics card is an nvidia one with an intel cpu so i guess the hardware setup is roughly ideal. Any reason why antialiasing is not on? Cheers, Mark Note: it does properly antialias when i set the renderTarget to Canvas.Image but i suppose it should just work with Canvas.FramebufferObject as well. I also tried the opengl package http://download.qt-project.org/snapshots/qt/5.1/5.1.0-beta1/backups/2013-05-02-11/qt-windows-opensource-5.1.0-beta1-msvc2012_opengl-x86_64-offline-2013-05-02-11.exe which works exactly the same as the mingw one. Don't know if both ones are using angle or not but i tried nonetheless. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Rotating objects in QML are killing performance
On Apr 11, 2013, at 8:43 PM, Alan Alpert 4163654...@gmail.com wrote: On Thu, Apr 11, 2013 at 10:08 AM, Michael Andersen mich...@steelcode.com wrote: Forgot list in reply. So no hope of it being fixed in 5.2 then... oh well. I'll go file a bug report. Does this happen on windows too or is this a linux thing? It could also be a driver thing. When reporting the bug please include your graphics card/driver. Does anyone have any ideas for a workaround? Other than don't rotate stuff ? If it's just a continual looping animation, and not particularly interactive, then you could pre-render the rotating rectangle into a gif or sprite sheet and play it with an AnimatedImage or AnimatedSprite. Those are likely to perform better. That is a horrible idea :) A Rectangle is significantly cheaper than a sprite and rotations on anything in Qt Quick 2 is for all intents and purposes a free operation. cheers, Gunnar -- Alan Alpert ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Rotating objects in QML are killing performance
On Apr 12, 2013, at 9:26 AM, Michael Andersen mich...@steelcode.com wrote: Is vsync enabled in your driver? Sounds like it might not be. If not, then Qt Quick 2.0 will render at 100% cpu rendering maybe many thousands of frames per second, even though you only see 60 of them. Unfortunately, VSync is enabled, that would have been a good explanation. Does it get any better if you switch to Unity 2D, the non-fancy one? We have registered some issues with the fancier window managers when using OpenGL. 846cf1a13f80fe4590cc9ad4d9972d7a173accd6 to QtBase, which is going into 5.1, resize issues on gnome for instance. You could also try to set the envvar: QML_BAD_GUI_RENDER_LOOP=1 It switches the render loop to a single-threaded, timer-based loop which updates every 16 ms, not in sync with vsync. The default on linux/X11 is to use a dedicated render thread, advance animations once per frame and rely on vsync to be throttled. cheers, Gunnar I am using the Nvidia binary drivers (v304.51) so in order to double check that applications actually *were* vsynced, I ran glxgears. Turns out that glxgears does the same thing: no repainting while dragging and it lags the whole PC when you drag the app. This is not a small PC, I have a GTX 560 Ti, 32GB of ram and an i7 3930.. why oh why is glxgears lagging... For want of another data point, I ran minecraft, yes I know its a different language and all that, but it does have an OpenGL context... and it doesn't lag the pc at all while the window is being dragged. So I am not sure that this is really Qt's fault, except that the QtQuick 1.1 application did not exhibit the same problems, and it does seem possible to make an OpenGL application that repaints while the window is moved. Any ideas? cheers, Gunnar Here is a simple reproducer of the problem, I create a QtQuick2 application in Qt Creator 2.7. I adjust the QML to look like this: import QtQuick 2.0 Rectangle { width: 400 height: 400 Rectangle { id: redsquare color: red width: 50 height: 50 x: 50 y: 50 } RotationAnimation { loops: Animation.Infinite target: redsquare properties: rotation from: 0 to: 360 duration: 300*5 direction: RotationAnimation.Clockwise running: true } } My main.cpp is the default, but that looks like this: #include QtGui/QGuiApplication #include qtquick2applicationviewer.h int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral(qml/SimpleRotator/main.qml)); viewer.showExpanded(); return app.exec(); } I am new to Qt, so perhaps I am doing something wrong with my animation, but I have tried a couple other methods of animating and they all lag equally badly. The PC I develop on is quite a monster, so if it is lagging on this, I hate to think what it's going to do on my clients' laptops. Anyone have any ideas? Regards Michael ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Running code in the scene graph renderer thread
Hi! I'm implementing a plugin for Qt Multimedia for playing video and audio using hardware acceleration. When opening a content which includes video, I need to instantiate an OpenGL texture and an EGLImageKHR. To do this I need to be in the thread with the current OpenGL context, which should be the renderer thread. I did this in a custom QML component (in the updatePaintNode method), and everything is working correctly: but how do I execute my code in the renderer thread of the scene graph from a Qt Multimedia plugin? What options do I have? I quickly read the Qt Multimedia plugin for Android, but that is a little different because the texture is instantiated by the SurfaceTexture java class. There are two ways you can do this. If you follow samuels way with hooking into QQuickWindow::beforeRendering() that works fine. QQuickWindow is accessible from QQuickItem::window(), and you always have a valid window in the QQuickItem::updatePaintNode() function. An alternative which is more in line with how the API is meant to be used is to create a QSGTexture implementation which wraps your EGLImageKHR and which does what it needs to do in the bind() function. Beware of that the texture from the start though, otherwise, the scene graph sorting will get very confused :) In the updatePaintNode() function, create and set up the QSGTexture instance, assign it to a QSGSimpleTextureNode and return that back to the scene graph, and you should be good to go. cheers, Gunnar ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest