Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Clipping issue on an Android device

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8440

    Jan

    Hey, I ran into an issue on a certain Android device, where clipping of items do not work under certain conditions. I’ve got an android tablet, where the following code only clips on Rotation angles 0 degrees, 90 degrees, 180 degrees & 270 degrees. Other platforms work fine and also another android device works fine. Seems to be a Qt bug, as it also happens in a standard Qt app. Here’s the code:

    		Rectangle {
    			id: clipTurn
    			anchors.centerIn: parent
    			width: 20
    			height: 100
    			color:"red"
    			clip: true
    			property real angle: 0
    			Timer{
    				running:true
    				repeat: true
    				interval: 400
    				onTriggered:{
    					clipTurn.angle+=10;
    				}
    			}
    			Rectangle {
    				anchors.horizontalCenter: parent.horizontalCenter
    				width: 10
    				height: 130
    				color: "yellow"
    			}
    			transform: Rotation { origin.x: clipTurn.width/2; origin.y: clipTurn.width/2; angle: clipTurn.angle}
    		}

    Does anyone at least have a workaround for that?

    #8441

    Jan

    An educated guess would be, that some conversion from polar- to carthesian coordinate system goes wrong…

    Btw: The affected device is a Motorola Xoom with Android 4.0.4 installed

    #8450

    Jan

    Ok, seems like I’ve found the reason for my issue:

    http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph-renderer.html

    Let me cite the description for clipping: “If the item is rotated by a non-90-degree angle, the OpenGL’s stencil buffer is used.

    In my ouptut from the Android device I can see the following:

    W/Qt ( 1125): scenegraph/qsgcontext.cpp:434 (virtual void QSGRenderContext::initialize(QOpenGLContext*)): QSGContext::initialize: stencil buffer support missing, expect rendering errors

    So thats the root cause; but does anyone know what to do? I really need that feature 🙁

     

     

    #8451

    Christian
    Felgo Team

    Hi,

    a workaround would be to use an Image for clipping and use an OpacityMask component, like we did for clipping the contents of a Facebook Profile image. You can see a source codes example in this related forum thread. You could also ask in the Qt Project support forums if others have another workaround for the stencil buffer issue.

    Cheers, Chris

    #8476

    Jan

    Good point, thanks.

    I got it to work in a different way. I was able to separate my sprite into a stretchable and a non stretchable part. That way I don’t need clipping, which seems to be beneficial in regards of UI performance.

    #8477

    Christian
    Felgo Team

    Yes absolutely, clipping has a performance penalty so any approach that prevents it at all is a good one. 🙂

    Can you maybe share the piece of code you used for splitting the sprite, as it may be interesting for other developers too?

    Cheers, Chris

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded