anchor.diff:          use reader = new StreamReader(stream)
           reader.ReadToEnd()
   
  -    /// Loads the shader sourcecode from the text file.
  -    let LoadTextFile (textFileName : string) = 
  +    /// Load the shader sourcecode from the text file.
  +    static member LoadTextFile (textFileName : string) = 
           if Regex(@"^(([a-zA-Z]:\\)|([a-zA-Z]://)|(//)).*").IsMatch(textFileName) then
               File.ReadAllText(textFileName)
           else
               File.ReadAllText(Path.Combine(__SOURCE_DIRECTORY__, textFileName))
   
  -
  -    let OpenGL (openGLVersion : Version.OpenGLVersion) 
  -                (renderContextType : RenderContextType)
  -                width height bitDepth 
  -                (parameters : obj) =
  +    /// Create an OpenGL instance of named version, otherwise throw an exception. 
  +    /// https://github.com/mattdesl/lwjgl-basics/wiki/GLSL-Versions
  +    static member OpenGL (openGLVersion : Version.OpenGLVersion) 
  +                         (renderContextType : RenderContextType)
  +                         width height bitDepth 
  +                         (parameters : obj) =
           let gl = OpenGL()
           if not (gl.Create(openGLVersion, 
                             renderContextType, 
  -                          width, height, 32, 
  +                          width, height, bitDepth, 
                             parameters)) then
               failwith (sprintf "Base.glCreate SharpGL.Version.OpenGLVersion %A" openGLVersion)       
           gl
   
  -
  -
  -
  -
  -
  -
  -
  -module Main = 
  -
  -
  -    // https://github.com/mattdesl/lwjgl-basics/wiki/GLSL-Versions
  +    /// Called after the window and OpenGL are initialized. Called exactly once, before the main loop.
  +    static member Init (gl : OpenGL ref) 
  +             (shaderProgram : ShaderProgram) 
  +             (attributeLocations : Dictionary<uint32, string>) 
  +             vertexShaderCode 
  +             fragmentShaderCode =
  +        shaderProgram.Bind(!gl)
  +        attributeLocations.AsEnumerable()
  +        |> Seq.iter (fun x -> shaderProgram.BindAttributeLocation(!gl, x.Key, x.Value))
  +    
  +        let vertexShader gl shaderSource = 
  +            let shader =  Shaders.VertexShader()
  +            shader.CreateInContext(!gl)
  +            shader.SetSource(shaderSource)
  +            shader.Compile()
  +            if not (shader.CompileStatus.HasValue) then 
  +                failwith (sprintf "failed with source:\n %s" shaderSource)
  +            if not (shader.CompileStatus.Value) then
  +                failwith (sprintf "failed with source:\n%s\ninfoLog:\n%s" shaderSource shader.InfoLog)
  +            shader
  +
  +        let fragmentShader gl shaderSource = 
  +            let shader =  Shaders.FragmentShader()
  +            shader.CreateInContext(!gl)
  +            shader.SetSource(shaderSource)
  +            shader.Compile()
  +            if not (shader.CompileStatus.HasValue) then 
  +                failwith (sprintf "failed with source:\n %s" shaderSource)
  +            if not (shader.CompileStatus.Value) then
  +                failwith (sprintf "failed with source:\n%s\ninfoLog:\n%s" shaderSource shader.InfoLog)
  +            shader
  +
  +        let pixelVertexShader = vertexShader gl vertexShaderCode
  +        let pixelFragmentShader = fragmentShader gl fragmentShaderCode
  +
  +        pixelVertexShader.IsEnabled <- true
  +        pixelFragmentShader.IsEnabled <- true
  +    
  +        (!gl).AttachShader (shaderProgram.ShaderProgramObject, pixelVertexShader.ShaderObject)
  +        (!gl).AttachShader (shaderProgram.ShaderProgramObject, pixelFragmentShader.ShaderObject)
  +        (!gl).LinkProgram (shaderProgram.ShaderProgramObject)
  +        (!gl).DetachShader (shaderProgram.ShaderProgramObject, pixelVertexShader.ShaderObject)
  +        (!gl).DetachShader (shaderProgram.ShaderProgramObject, pixelFragmentShader.ShaderObject)
  +
  +        pixelVertexShader, pixelFragmentShader
  +
  +
  +module Globals = 
  + 
       let vertexShaderCode =
           """
   #version 140
  
positive.code:            0.75f; -0.75f; 0.0f; 1.0f;
             -0.75f; -0.75f; 0.0f; 1.0f |]
  
      let positionBufferObject = [|for i in [0u .. 2u] do yield 0u|]
  
      let vao = [|for i in [0u .. 2u] do yield 0u|]
      
      let shaderProgram = ShaderProgram()
  
      /// Called after the window and OpenGL are initialized. Called exactly once, before the main loop.
      let Init (gl : OpenGL) =
  
          let attributeLocations = new Dictionary<uint32, string>()
          let positionAttribute = 0u
          let normalAttribute = 1u
          let indexAttribute = 2u        
          attributeLocations.Add (positionAttribute, "Position")
          attributeLocations.Add (normalAttribute, "Normal")
          attributeLocations.Add (indexAttribute, "outputColor")
          
          shaderProgram.Bind(gl)
          attributeLocations.AsEnumerable()
          |> Seq.iter (fun x -> shaderProgram.BindAttributeLocation(gl, x.Key, x.Value))
      
          let shader gl shaderSource = 
              let shader = Shaders.VertexShader()
              shader.CreateInContext(gl)
              shader.SetSource(shaderSource)
              shader.Compile()
              if not (shader.CompileStatus.HasValue) then 
                  failwith (sprintf "failed with source:\n %s" shaderSource)
              if not (shader.CompileStatus.Value) then
                  failwith (sprintf "failed with source:\n%s\ninfoLog:\n%s" shaderSource shader.InfoLog)
              shader
  
          let pixelVertexShader = shader gl vertexShaderCode
          let pixelFragmentShader = shader gl fragmentShaderCode
  
          pixelVertexShader.IsEnabled <- true
          pixelFragmentShader.IsEnabled <- true
      
          gl.AttachShader (shaderProgram.ShaderProgramObject, pixelVertexShader.ShaderObject)
          gl.AttachShader (shaderProgram.ShaderProgramObject, pixelFragmentShader.ShaderObject)
          gl.LinkProgram (shaderProgram.ShaderProgramObject)
          
          gl.GenBuffers(3, positionBufferObject)
  
          gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0u)//positionBufferObject.[0])
          gl.BufferData(OpenGL.GL_ARRAY_BUFFER, vertices, OpenGL.GL_STATIC_DRAW)
          gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, 0u)
  
          gl.GenVertexArrays(3, vao)
          gl.BindVertexArray(vao.[0])
  
      let Display (gl : OpenGL) =
          gl.ClearColor (1.f,1.f,1.f,0.2f) //(0.f,0.6f,0.8f,0.5f)
          gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT)
          //gl.Color (0.f,0.6f,0.8f,0.5f)
  
          gl.UseProgram(shaderProgram.ShaderProgramObject)
  
          gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, vao.[0])
          gl.EnableVertexAttribArray(0u)
          gl.VertexAttribPointer(0u, 4, OpenGL.GL_FLOAT, false, 0, IntPtr(int vao.[0]))
  
          gl.DrawArrays(OpenGL.GL_TRIANGLES, (int vao.[0]), 3)
          gl.Flush()
  //        gl.DisableVertexAttribArray(0u)
  //        gl.UseProgram(0u)
  //        shaderProgram.Unbind(gl)
         
      let loadXamlWindow (filename:string) =
          let reader = XmlReader.Create(filename)
  
negative.code: open GlmNet
  
  
  /// F# convenience wrapper for SharpGL
  type Base =
      
      /// Load the shader sourcecode from the named manifest resource.
      static member LoadManifestResource (textFileName : string) =
          let executingAssembly = Assembly.GetExecutingAssembly()
          let pathToDots = textFileName.Replace("\\", ".")
          let location = String.Format("{0}.{1}", executingAssembly.GetName().Name, pathToDots)
  