Forums

OverviewV-Play 2 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
    V-Play 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
    V-Play 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support