I have been trying to draw a triangle but it is not showing up on the canvas here is my draw function code: here is the whole work: Answer There are some issues: The properties gl.viewportWidth and gl.viewportHeight are never set: In the array of vertex coordinates is a , instead of a . And there is a typo ,