         # make an HTML5 2d canvas on which to draw text
         width   = 300  # this determines max text width; beyond this, text is cut off.
         height  = 150
-        canvas  = $("<canvas style='border:1px solid black' width=#{width} height=#{height}>")[0]
-
-        # get the drawing context
-        context = canvas.getContext("2d")
+        canvas = document.createElement( 'canvas' )
+        canvas.width = width
+        canvas.height = height
+        context = canvas.getContext("2d")  # get the drawing context
 
         # set the fontsize and fix for our text.
         context.font = "Normal " + o.fontsize + "px " + o.fontface

            return

        # rescale all text in scene
        if (new_pos or force) and @_center?
            s = @camera.position.distanceTo(@_center) / 3
            if @_text?
                for sprite in @_text
                    sprite.scale.set(s,s,s)
            if @_frame_labels?
                for sprite in @_frame_labels
                    sprite.scale.set(s,s,s)

        @renderer.render(@scene, @camera)



$.fn.salvus_threejs = (opts={}) ->

                @controls.autoRotateSpeed = @opts.spin
            @controls.autoRotate = true

        @controls.addEventListener 'change', () =>
            if @renderer_type=='dynamic'
                @rescale_objects()
                @renderer.render(@scene, @camera)



    add_camera: (opts) =>
