ffgl

Description

FreeFrame is a cross platform real-time video effects plugin system. Fluxus supports FreeFrame 1.5 also known as FreeFrameGL or FFGL. FF CPU software rendering plugins are not supported at the moment. For more information visit http://www.freeframe.org

Example

 (clear)

 ; pixelprimitive with 2 textures and an active renderer
 (define p (build-pixels 256 256 #t 2))

 ; load the FFGLTile plugin from the FreeFrame SDK
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (for ([i (ffgl-get-info)]) ; print plugin information
        (printf "~a~n" i))
   (printf "~a~n" (ffgl-get-parameters)) ; parameter names as strings
   (ffgl-process p ; pixel primitive
                (pixels->texture p 1) ; output texture
                (pixels->texture p 0))) ; input texture

 (with-primitive p
    ; the renderer of the pixelprimitive renders to texture 0
    (pixels-render-to (pixels->texture p 0))
    ; the pixel primitive is displayed using texture 1
    (pixels-display (pixels->texture p 1)))
 (define (anim)
    ; set plugin parameters as keywords arguments
    (with-ffgl plugin
        (ffgl-set-parameter! #:tilex (/ (mouse-x) (vx (get-screen-size)))
                             #:tiley (/ (mouse-y) (vy (get-screen-size)))))
    ; render to the input pixelprimitive
    (with-pixels-renderer p
        (with-state
            (clear-colour #(0 1 0))
            (scale 5)
            (rotate (vector (* 50 (time)) -17 (* -35 (time))))
            (draw-cube))))

 (every-frame (anim))

(ffgl-load filename-string width-number height-number)

Returns plugininstance-number

Loads an FFGL plugin and returns a plugin instance. Plugin width and height have to be the same as the resolution of the pixel primitive you are about to process with the plugin.

Example

 (clear)
 ; load the FFGLTile plugin from the FreeFrame SDK
 (define plugin (ffgl-load "FFGLTile" 256 256))

(ffgl-get-info)

Returns (list of plugin-version-number plugin-id-string plugin-name-string plugin-type-symbol plugint-description-string plugin-about-string)

Returns plugin information.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (for ([i (ffgl-get-info)]) ; print plugin information
        (printf "~a~n" i)))

(ffgl-get-parameters)

Returns parameter-string-list

Returns the list of parameters.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (printf "~a~n" (ffgl-get-parameters)))

(ffgl-get-parameter-default parameter-name-symbol)

Returns default-parameter-value

Returns the default parameter value for the given parameter.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (printf "tilex default: ~a~n" (ffgl-get-parameter-default 'tilex)))

(ffgl-get-parameter parameter-name-symbol)

Returns parameter-value

Returns the current value of the given parameter.

Example

 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (printf "tilex default: ~a~n" (ffgl-get-parameter 'tilex)))

(ffgl-activate boolean)

Returns void

Activates, deactivates the plugin.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (ffgl-activate #t))

(ffgl-active?)

Returns boolean

Returns #t if the plugin is active, or #f otherwise.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (when (ffgl-active?)
     (display "plugin is active")))

(ffgl-get-min-inputs)

Returns number

Returns the minimum number of input pixel primitives the plugin requires.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (printf "~a~n" (ffgl-get-min-inputs)))

(ffgl-get-max-inputs)

Returns number

Returns the maximum number of input pixel primitives the plugin accepts.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (printf "~a~n" (ffgl-get-max-inputs)))

(ffgl-set-time! time-number)

Returns void

Sets the time in seconds.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTime" 256 256))

 (with-ffgl plugin
   (ffgl-set-time! (time)))

(ffgl-process output-pixelprimitiveid-number output-textureid-number input-textureid-number ...)

Returns void

Sets output pixel primitive, output texture and input textures for the grabbed plugin. The resolution of the pixel primitive and the textures have to be same as the resolution the plugin initialised. This is automatic if the textures belong to the same pixel primitive.

Example

 (clear)
 (define p (build-pixels 256 256 #t 2))

 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
    (ffgl-process p
                  (pixels->texture p 1) ; output
                  (pixels->texture p 0))) ; input

 (with-primitive p
    (pixels-render-to (pixels->texture p 0))
    (pixels-display (pixels->texture p 1)))

 (define (anim)
    (with-pixels-renderer p
        (with-state
            (clear-colour #(0 1 0))
            (scale 5)
            (rotate (vector (* 50 (time)) -17 (* -35 (time))))
            (draw-cube))))

 (every-frame (anim))

(ffgl-clear-instances)

Returns void

Clears FFGL plugin instances.

Example

 (ffgl-clear-instances)

(ffgl-clear-cache)

Returns void

Clears FFGL plugin cache and instances.

Example

 (ffgl-clear-cache)

(with-ffgl ffgl-pluginid expression ...)

Returns result of last expression

Allows you to work with the specified FFGL plugin.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (for ([i (ffgl-get-info)])
        (printf "~a~n" i)))

(ffgl-set-parameter! parameter-name-keyword parameter-value ...)

Returns void

Sets ffgl plugin parameters.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
        (ffgl-set-parameter! #:tilex .5 #:tiley .2))

(with-ffgl ffgl-pluginid expression ...)

Returns result of last expression

Allows you to work with the specified FFGL plugin.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
   (for ([i (ffgl-get-info)])
        (printf "~a~n" i)))

(ffgl-set-parameter! parameter-name-keyword parameter-value ...)

Returns void

Sets ffgl plugin parameters.

Example

 (clear)
 (define plugin (ffgl-load "FFGLTile" 256 256))

 (with-ffgl plugin
        (ffgl-set-parameter! #:tilex .5 #:tiley .2))