Skip to content

Instantly share code, notes, and snippets.

@ChALkeR
Last active June 27, 2017 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChALkeR/bb8937e8ffaf31e496a31e988f93e628 to your computer and use it in GitHub Desktop.
Save ChALkeR/bb8937e8ffaf31e496a31e988f93e628 to your computer and use it in GitHub Desktop.
QtQuick.Particles GPU usage issue
import QtQuick 2.0
import QtQuick.Particles 2.0
Item {
width: 1500
height: 800
Rectangle {
color: 'black'
anchors.fill: parent
}
ParticleSystem {
id: system
anchors.fill: parent
Emitter {
id: emitter
enabled: false
emitRate: 1
lifeSpan: 2000
size: 24
sizeVariation: 16
velocity: AngleDirection {angleVariation: 180; magnitude: 150; magnitudeVariation: 260}
acceleration: AngleDirection {angleVariation: 180; magnitude: 0; magnitudeVariation: 60}
}
function boom(count) {
visible = true;
emitter.enabled = true;
emitter.burst(count);
emitter.enabled = false;
}
// GPU is being eaten like crazy even if this line is commented out
Component.onCompleted: boom(100)
ItemParticle {
delegate: Rectangle {
color: 'red'
width: 4
height: 4
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment