These are chat archives for pixijs/pixi.js

10th
Jul 2017
Jos
@Rojoss
Jul 10 2017 14:15
Whoops forgot I asked it here too. Either way, I posted it also on the forum and got some replies there and it turns out it was the monitor.
It's a crappy 4k monitor with a refresh rate of 30Hertz so that's why it drops to 30FPS.
I have another question though which is something completely different but I'm having trouble doing custom triangulation for the mesh.
I've seen there are multiple draw modes but I've tried a lot of draw modes and tried a bunch of combinations for the indices but it never renders properly.
So I looked at the source code and the Rope, Plane code etc and they all extend Mesh and then override the refresh function.
Is that the only way to render custom meshes? Because the way I did it is to just create a Mesh instance and set the vertices/indices and uvs.
public draw(): void {
    this.mesh.vertices = new Float32Array(this.vertices);
    this.mesh.uvs = new Float32Array(this.uvs);
    this.mesh.indices = new Uint16Array(this.indices);
}
Jos
@Rojoss
Jul 10 2017 14:20
const i = this.vertices.length;
this.vertices.push(points[1].x, points[1].y, points[0].x, points[0].y);
this.indices.push(i-2, i, i+1);
this.indices.push(i-2, i+1, i-1);
this.draw();
That's what I do now pretty much which isn't working, so do I triangulate it wrong or do I have to extend Mesh and do everything in refresh?
It's for a multiplayer game which can be rolled back, so often it happens that a lot of points are added/removed before a draw is needed which is why I made it work this way as it would perform better.
Jos
@Rojoss
Jul 10 2017 14:49
Just refactored code to extend mesh and implement refresh and that doesn't make any difference.
I assume the indices are wrong then or it's just not rendering properly.