FlamingGenius
FlamingGenius

Reputation: 216

requestAnimFrame not defined

I am building my own custom engine using javascript(dont ask why)

my code was working fine until I added in the bline algorithm for line drawing(much faster then using a recursive function) and then all of a sudden this code broke and im not entirely sure why

This is the error showing up in the console

Uncaught ReferenceError: requestAnimFrame is not defined at HTMLDocument.init (main.js?v=0.0.6:40)

And here is the code

function init() {
    canvas = document.getElementById("frontBuffer");
    mera = new GameCore.Camera();
    device = new GameCore.Device(canvas);
    mesh = new GameCore.Mesh("Cube", 8, 12);
    meshes.push(mesh);
    mesh.Vertices[0] = new BABYLON.Vector3(-1, 1, 1);
    mesh.Vertices[1] = new BABYLON.Vector3(1, 1, 1);
    mesh.Vertices[2] = new BABYLON.Vector3(-1, -1, 1);
    mesh.Vertices[3] = new BABYLON.Vector3(1, -1, 1);
    mesh.Vertices[4] = new BABYLON.Vector3(-1, 1, -1);
    mesh.Vertices[5] = new BABYLON.Vector3(1, 1, -1);
    mesh.Vertices[6] = new BABYLON.Vector3(1, -1, -1);
    mesh.Vertices[7] = new BABYLON.Vector3(-1, -1, -1);
    mesh.Faces[0] = { A:0, B:1, C:2 };
    mesh.Faces[1] = { A:1, B:2, C:3 };
    mesh.Faces[2] = { A:1, B:3, C:6 };
    mesh.Faces[3] = { A:1, B:5, C:6 };
    mesh.Faces[4] = { A:0, B:1, C:4 };
    mesh.Faces[5] = { A:1, B:4, C:5 };

    mesh.Faces[6] = { A:2, B:3, C:7 };
    mesh.Faces[7] = { A:3, B:6, C:7 };
    mesh.Faces[8] = { A:0, B:2, C:7 };
    mesh.Faces[9] = { A:0, B:4, C:7 };
    mesh.Faces[10] = { A:4, B:5, C:6 };
    mesh.Faces[11] = { A:4, B:6, C:7 };

    mera.Position = new BABYLON.Vector3(0, 0, 10);
    mera.Target = new BABYLON.Vector3(0, 0, 0);

    requestAnimFrame(drawingLoop);
}

Upvotes: 0

Views: 2309

Answers (1)

c-smile
c-smile

Reputation: 27470

In fact it is requestAnimationFrame()

Upvotes: 3

Related Questions