initMapTilesProgram :: WebGLRenderingContext -> Scf -> IO RenderMTilesProgram
initMapTilesProgram gl rmtTexOpacity = do
  shader <- initShaders gl
    [(gl_VERTEX_SHADER, vertexMapShaderText)
    ,(gl_FRAGMENT_SHADER, fragmentMapShaderText)
    ]
    [(attrLocCoords, "aVertexPosition")
    ,(attrLocTexCoords,"aTextureCoord")
    ]
  let uProjLoc = unifLoc shader "uProjM"
      uViewLoc = unifLoc shader "uViewM"
      uCustomLoc3 = unifLoc shader "uSampler"
      uCustomLoc4 = unifLoc shader "uClippingDist"
      uCustomLoc5 = unifLoc shader "uTexOpacity"
      rmtRenderProg = RenderingProgram {..}
      rmtTiles = []

  rmtTexCoordsBuffer <- createBuffer gl
  texCoordsIO <- unsafeArrayThaw texCoords
  bindBuffer gl gl_ARRAY_BUFFER $ Just rmtTexCoordsBuffer
  bufferData' gl gl_ARRAY_BUFFER texCoordsIO gl_STATIC_DRAW

  return RenderMTilesProgram {..}
initMapTilesProgram :: WebGLRenderingContext -> Scf -> IO RenderMTilesProgram
initMapTilesProgram gl rmtTexOpacity = do
  shader <- initShaders gl
    [(gl_VERTEX_SHADER, vertexMapShaderText)
    ,(gl_FRAGMENT_SHADER, fragmentMapShaderText)
    ]
    [(attrLocCoords, "aVertexPosition")
    ,(attrLocTexCoords,"aTextureCoord")
    ]
  let uProjLoc = unifLoc shader "uProjM"
      uViewLoc = unifLoc shader "uViewM"
      uCustomLoc3 = unifLoc shader "uSampler"
      uCustomLoc4 = unifLoc shader "uClippingDist"
      uCustomLoc5 = unifLoc shader "uTexOpacity"
      rmtRenderProg = RenderingProgram {..}
      rmtTiles = []

  rmtTexCoordsBuffer <- createBuffer gl
  texCoordsIO <- unsafeArrayThaw texCoords
  bindBuffer gl gl_ARRAY_BUFFER $ Just rmtTexCoordsBuffer
  bufferData' gl gl_ARRAY_BUFFER texCoordsIO gl_STATIC_DRAW

  return RenderMTilesProgram {..}
initMapTilesProgram gl rmtTexOpacity = do
  shader <- initShaders gl
    [(gl_VERTEX_SHADER, vertexMapShaderText)
    ,(gl_FRAGMENT_SHADER, fragmentMapShaderText)
    ]
    [(attrLocCoords, "aVertexPosition")
    ,(attrLocTexCoords,"aTextureCoord")
    ]
  let uProjLoc = unifLoc shader "uProjM"
      uViewLoc = unifLoc shader "uViewM"
      uCustomLoc3 = unifLoc shader "uSampler"
      uCustomLoc4 = unifLoc shader "uClippingDist"
      uCustomLoc5 = unifLoc shader "uTexOpacity"
      rmtRenderProg = RenderingProgram {..}
      rmtTiles = []

  rmtTexCoordsBuffer <- createBuffer gl
  texCoordsIO <- unsafeArrayThaw texCoords
  bindBuffer gl gl_ARRAY_BUFFER $ Just rmtTexCoordsBuffer
  bufferData' gl gl_ARRAY_BUFFER texCoordsIO gl_STATIC_DRAW

  return RenderMTilesProgram {..}