I'm working on a 3D Renderer with the canvas element and JS but currently the cube I made is not rendering. I currently have it set to just render a wireframe of the cube and am hoping to render the full thing eventually, but when I try to draw the cube it's not showing up. My current rendering function is as follows:
render(){
for (var i=0;i<this.faces.length;i++){
ctx.beginPath()
for (var j=0;j<this.faces[i].points.length;j++) {
ctx.lineTo(this.faces[i].points[j].x,this.faces[i].points[j].y)
}
ctx.lineTo(this.faces[i].points[this.faces[i].length-1].x,this.faces[i].points[this.faces[i].length-1].y)
ctx.closePath()
if (faces[i].color!=null) {
ctx.fillstyle = faces[i].color
}
ctx.stroke()
}
}
Does anyone know why it's not drawing?