             @_text = []
 
             up = new THREE.Vector3()
-            @changeHooks.push =>
+            @renderHooks.push =>
                 up.set(0, 1, 0).applyQuaternion @camera.quaternion
                 for text in @_text
                     text.up.copy up

            type    : 'png'      # 'png' or 'jpeg' or 'webp' (the best)
            quality : undefined   # 1 is best quality; 0 is worst; only applies for jpeg or webp
        @renderer.domElement.toDataURL "image/#{opts.type}", opts.quality

    init_light: (color= 0xffffff) ->
        ambient = new THREE.AmbientLight(0x404040)
        @scene.add ambient

        color = 0xffffff
        d     = 10000000
        intensity = 0.5

        for p in [[d,d,d], [d,d,-d], [d,-d,d], [d,-d,-d],[-d,d,d], [-d,d,-d], [-d,-d,d], [-d,-d,-d]]
            directionalLight = new THREE.DirectionalLight color, intensity
            directionalLight.position.set(p...).normalize()
            @scene.add directionalLight

        @light = new THREE.PointLight color
        @light.position.set 0, d, 0

    updateBoundingBox: (obj) ->
        obj.geometry.computeBoundingBox()

        else
            f()

    renderScene: (force = false) ->
        if @_rendering? and @_rendering
            # already in the process of rendering
            return

        if @rendererType isnt 'dynamic'
            # scene's are only rendered when they are dynamic
            return

        if not @camera?
            return # nothing to do yet

        @_rendering = true

        if not force
            position = @camera.position
            if not @_lastPosition?
                force = true
                @_lastPosition = position.clone()
                #@_renderDistance = @minDim*@minDim/10000
            else if @_lastPosition.distanceToSquared(position) > 0.05
                force = true
                @_lastPosition.copy position

        if force
            @controls.update()
            for hook in @renderHooks
                hook()
            @renderer.render @scene, @camera

        @_rendering = false

math3d.render_3d_scene = (opts) ->
    opts = defaults opts,
