           @collection.add(layer)
           
           # Load texture
-          @wfits.loadTexture(band, arr)
+          @wfits.loadImage(band, arr, dataunit.width, dataunit.height)
           
           dfs[index].resolve()
         )

  constructor: (selector) ->
    super selector
    
    # Request the appropriate webfits api (canvas or webgl)
    @getApi()
    
    # Run when the webfits api is received
    @on 'swviewer:ready', =>
      # NOTE: Dimensions and global extent are hard coded
      el = document.querySelector(@selector)
      @wfits = new astro.WebFITS.Api(el, @dimension, @dimension)
      @wfits.setGlobalExtent(@surveyMinPixel, @surveyMaxPixel)
      ctx = @wfits.getContext()
      
      unless ctx?
        alert 'Something went wrong initializing the context'
      
      @unbind 'swviewer:ready'

    
  updateScale: (band, value) =>
    @wfits.setScale(band, value)
  
  updateStretch: (value) =>
    @wfits.setStretch(value)


window.Ubret.SpacewarpViewer = SpacewarpViewer
