     window.alert "Shader Error!"
     return null
   
+  # Buat Map berisi program, lokasi attribute, dan lokasi uniform
   rMap = {}
   rMap.program    = program
   rMap.attributes = {}

    gl.drawElements gl.LINE_STRIP, indexbuf.numItems, gl.UNSIGNED_SHORT, 0

    stack = mvMatrixPop(stack)

  update = (gl, renderFunc) ->
    window.requestAnimationFrame(update.bind(null,gl, renderFunc))
    renderFunc(gl)
    animate()
  
  gl.clearColor 0.0, 0.0, 0.0, 1.0
  gl.clearDepth 1.0
  gl.enable gl.DEPTH_TEST

  update(gl, render.bind(null, shaderProgram, vertbuf, indexbuf))

mvMatrixPush = (stack, current) ->
  copy = mat4.create()
  mat4.set current, copy
  newStack = stack.concat(copy)
  return newStack

mvMatrixPop = (stack) ->
  throw "Invalid popMatrix" if stack.length == 0
  return stack.slice(0,-1)

createShaderProgram = (gl, vertexSource, fragmentSource, attributes, uniforms) ->
  createShader = (gl, shaderSource,shaderType) ->
    shader = gl.createShader shaderType

  loadFile "js/models/cone.json",
    handleLoadFile.bind(null, gl)

# Fungsi untuk menangani pemuatan model
# gl: WebGL Context
# model: model data dengan vertex dan index
handleLoadFile = (gl, model) ->
  # Buat Vertex dan Index Buffers
  vertbuf = createBuffer gl, gl.ARRAY_BUFFER, model.vertices, 3
  indexbuf = createBuffer gl, gl.ELEMENT_ARRAY_BUFFER, model.indices,
    1, Uint16Array
  
  # Vertex Shader
  vert = """
  attribute vec3 position;
  
