Results 1 to 2 of 2

Thread: Viewport overlap issue for multiple instance of openglunderqml causes erasing other

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    6
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Viewport overlap issue for multiple instance of openglunderqml causes erasing other

    I have created two instances of Squircle(openglunderqml) item

    First instance have size 500,500 alignment in center to screen

    ex:Mini Player in preview

    Second instance have size of screen size alignment to complete screen

    ex:Main Player in viewer

    Initially Main Player does noting will goto preview there we can see mini player user say ok will launch main player

    But during preview I could not see mini player because main player glviewport covering complete screen and its clearing because paint is getting alway its is connected to beforeRendering signal

    code:
    http://doc.qt.io/qt-5/qtquick-sceneg...l-example.html

    I followed above link and made small change glviewport according to instance boundary
    Qt Code:
    1. glViewport(m_viewportSize.x(), m_viewportSize.y(), m_viewportSize.width(), m_viewportSize.height());
    To copy to clipboard, switch view to plain text mode 

    glclear update
    Qt Code:
    1. glClearColor(0, 0, 0, 1);
    2.  
    3. glScissor(m_ViewportSize.x(),m_ViewportSize.y(), m_ViewportSize.width(), m_ViewportSize.height());
    4.  
    5. glEnable(GL_SCISSOR_TEST);
    6. glClear(GL_COLOR_BUFFER_BIT);
    7. glDisable(GL_SCISSOR_TEST);
    To copy to clipboard, switch view to plain text mode 
    main.qml
    Qt Code:
    1. import QtQuick 2.0
    2. import OpenGLUnderQML 1.0
    3.  
    4. Item {
    5. width: 1200
    6. height: 600
    7. Test{
    8. width: 500
    9. height: 500
    10. anchors.centerIn: parent
    11. color: "green"
    12. }
    13. Test{
    14. width: parent.width
    15. height: parent.height
    16. anchors.top: parent.top
    17. anchors.left: parent.left
    18. color: "red"
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 
    Test.qml
    Qt Code:
    1. import QtQuick 2.0
    2. import OpenGLUnderQML 1.0
    3.  
    4. Rectangle {
    5.  
    6. opacity: 0.2
    7. Squircle {
    8. SequentialAnimation on t {
    9. NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
    10. NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
    11. loops: Animation.Infinite
    12. running: true
    13. }
    14. }
    15. //! [1] //! [2]
    16. Rectangle {
    17. color: Qt.rgba(1, 1, 1, 0.7)
    18. radius: 10
    19. border.width: 1
    20. border.color: "white"
    21. anchors.fill: label
    22. anchors.margins: -10
    23. }
    24.  
    25. Text {
    26. id: label
    27. color: "black"
    28. wrapMode: Text.WordWrap
    29. text: "The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickWindow. This text label and its border is rendered using QML"
    30. anchors.right: parent.right
    31. anchors.left: parent.left
    32. anchors.bottom: parent.bottom
    33. anchors.margins: 20
    34. }
    35. }
    To copy to clipboard, switch view to plain text mode 
    [/code]

  2. #2
    Join Date
    Jun 2018
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Viewport overlap issue for multiple instance of openglunderqml causes erasing oth

    Hi,

    Were you able to fix the issue? Even I was trying to do the same and hence while searching on google I came across your post. If you have found the solution please let me know.

    Thanks in advance,
    Mohan

Similar Threads

  1. Multiple instance of Plugin object
    By mcosta in forum Qt Programming
    Replies: 3
    Last Post: 15th June 2011, 17:11
  2. Replies: 1
    Last Post: 14th April 2011, 00:08
  3. multiple toolbars overlap
    By bittuthegr8 in forum Newbie
    Replies: 1
    Last Post: 2nd October 2010, 08:58
  4. Open multiple files with one program instance
    By Ginsengelf in forum Qt Programming
    Replies: 6
    Last Post: 16th March 2009, 15:08
  5. Draw New data, without erasing old ones
    By linuxdev in forum Newbie
    Replies: 11
    Last Post: 7th January 2009, 09:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.