anchor.diff:          GL.BindTexture( TextureTarget.Texture2D, texhdl )
           (*Uploads data to the texture specified for the active texture unit*)
           GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba
  -                            , bm.Width, bm.Height, 0, PixelFormat.Bgra
  +                            , bmdata.Width, bmdata.Height, 0, PixelFormat.Bgra
                               , PixelType.UnsignedByte, bytes)
   
  -        Some( PathTexture( texhdl, bm.Width, bm.Height, path ) )
  +        Some( PathTexture( texhdl, bmdata.Width, bmdata.Height, path ) )
       with
           | _ -> None
        
  -    
  +
  +let buildMVPFromModel( rotation, scale, translation:Vector2, aspect:float32 ) =
  +    let rotation = cos(rotation),sin(rotation)
  +    let mutable rotMat = Matrix4.Identity;
  +    rotMat.Row0 <- Vector4(fst(rotation), -1.0f * snd(rotation), 0.0f, 0.0f)
  +    rotMat.Row1 <- Vector4(snd(rotation), fst(rotation), 0.0f, 0.0f)
  +    let mutable scaleMat = Matrix4.Identity
  +    scaleMat.Row0 <- Vector4( scale, 0.0f, 0.0f, 0.0f )
  +    scaleMat.Row1 <- Vector4( 0.0f, scale, 0.0f, 0.0f )
  +    scaleMat.Row2 <- Vector4( 0.0f, 0.0f, scale, 0.0f )
  +    let mutable translationMat = Matrix4.Identity
  +    translationMat.Row3 <- Vector4( translation.X, translation.Y, 0.0f, 1.0f )
  +
  +    let mutable projection = Matrix4.Identity
  +    projection.Row1 <- Vector4( 0.0f, aspect, 0.0f, 0.0f )
  +
  +    let model = Matrix4.Mult( Matrix4.Mult( rotMat, scaleMat ), translationMat )
  +    let mvp = Matrix4.Mult(projection, model )
  +    mvp
   
   
   type RenderContext(inModel:ModelData, inDest:Image) =
  
positive.code:         let alloc = renderer.Allocation 
          let width = alloc.Width
          let height = alloc.Height
          rc.render(width, height)
  
      
      let toolkit = Toolkit.Init()
  
negative.code:         if not existingmatches then
              bgtex <- createGlTexFromPath( model.source )
              checkGLError()
         
         
  
      let checkImageBuffers() = 
          if bgimagevert = 0 then
              bgimagevert <- createAndUploadDataf32([|-1.f;-1.f;
                                        -1.f; 1.f; 
                                         1.f; 1.f; 
                                         1.f; -1.f |]
                                         , BufferTarget.ArrayBuffer
                                         , BufferUsageHint.StaticDraw )
              bgimageidx <- createAndUploadDatai32( [|0;1;2;2;3;0|]
                                         , BufferTarget.ArrayBuffer
                                         , BufferUsageHint.StaticDraw )
  
              bgshader <- compileShaderProgram( bgimage_vert, bgimage_frag )   
              
  
      let checkPyramidData() = 
          if pyramidvert = 0 then
              let multtable = Array.map sincos angles
              pyramidvert <- createAndUploadDataf32( 
                   tridata
                   , BufferTarget.ArrayBuffer
                   , BufferUsageHint.StaticDraw )
              pyramididx <- createAndUploadDatai32(
                              [|0; 1; 2;
                                0; 2; 3;
                                0; 3; 1;|]
                                 , BufferTarget.ElementArrayBuffer
                                 , BufferUsageHint.StaticDraw )
              pyramidshder <- compileShaderProgram( pyramid_vert, pyramid_frag )
                
          
      let renderSourceImage() = 
          checkSourceImage()
          if bgtex.IsSome then
              checkImageBuffers()
              GL.UseProgram( bgshader.Value.progHandle )
              GL.BindBuffer( BufferTarget.ArrayBuffer, bgimagevert )
              GL.EnableVertexAttribArray( 0 )
  