 
     @debugContext = WebGLDebugUtils.makeDebugContext @nativeContext, null, throwErrorOnUndefinedArgument, null
 
-    @gl = gl = if @_debugMode then @debugContext else @nativeContext
+
+    @gl = if @_debugMode then @debugContext else @nativeContext
+
+
+    @_drawingModeNames = {}
+    for mode in VALID_DRAWING_MODES
+      intMode = @gl[mode]
+      if intMode == undefined
+        throw new Error(mode + " is not a valid drawing mode")
+      @_drawingModeNames[mode] = intMode
+      @_drawingModeNames[intMode] = mode
+
+  _setupContext: ->
+    gl = @gl
 
     # create all the object
     @_vertexBuffer = gl.createBuffer()


  _setFragmentShaderSource: (value) ->
    @_fragmentShaderSource = value
    @_scheduleFrame()



    gl.enableVertexAttribArray VERTEX_INDEX_ATTRIBUTE_LOCATION


  _render: ->
    gl = @gl

