Hi. My project is freezing on startup (about 50% of the time - black screen won’t respond). I have found what I wrote to cause it.
I create a bunch of particleEmitters, add them, no problems.
If I run them through this method:
public void vary(ParticleEmitter p)
{
float f = r.nextFloat();
Vector3f cols;
if(f<0.333f)//red
{
cols = new Vector3f(0.6f+(r.nextFloat()*0.4f),r.nextFloat()*0.5f,r.nextFloat()*0.5f);
}
else if(f<0.666f)//blue
{
cols = new Vector3f(r.nextFloat()*0.5f,r.nextFloat()*0.5f,0.6f+(r.nextFloat()*0.4f));
}
else
{
cols = new Vector3f(r.nextFloat()*0.5f,0.6f+(r.nextFloat()*0.4f),r.nextFloat()*0.5f);
}
ColorRGBA start = new ColorRGBA(cols.x,cols.y,cols.z,p.getStartColor().a);
ColorRGBA end = new ColorRGBA(cols.x-0.05f + (r.nextFloat()*0.1f),cols.y-0.05f + (r.nextFloat()*0.1f),cols.z-0.05f + (r.nextFloat()*0.1f),p.getEndColor().a);
p.setStartColor(start);
p.setEndColor(end);
int v = -4 + r.nextInt(9);
p.setStartSize(p.getStartSize()+v);
p.setEndSize(p.getEndSize()+v);
p.setParticlesPerSec(p.getParticlesPerSec()-1 + r.nextInt(3));//+-1
}
The freezes start. If I remove vary(emitter);
then all is fine (at least I’ve run it 30 times in a row without a crash).
The method was just a quicky I made to vary a few things like color and so on. Have I done something terrible?
Here is the profiler in case it’s any use: