hi all,

i made some changes to the pixel primitive code. now it can handle multiple texture attachments. this means that a pixel primitive has as many textures attached to it as you have requested.

i tried not to break existing code, let me know if i have. ffgl plugin scripts will break, since the interface has been changed. i also fixed the alignment of the pixel primitive, so now its centre and not its bottom-left corner is in the origin as it used to be. this is how other primitives like planes are aligned.

the multiple textures feature simplifies feedback effects and ffgl plugin usage as they no longer need multiple pixel primitives, only one with multiple textures.

changes:
- (build-pixels) takes a 4th optional argument, which is the number of requested textures e.g. (build-pixels 512 512 #t 2) creates an 512x512 primitive with an active renderer and 2 textures - (pixels->texture) also takes an optional argument which is the texture index (defaults to 0), e.g (pixels->texture p 1) gives the handle of the second texture - if you render to the pixel primitive you can specify to which texture the rendering takes place (the first texture by default), e.g.
(with-primitive p
        (pixels-render-to (pixels->texture p 1))
- you can specify which texture is displayed when the pixel primitive is rendered (also the first texture by default)
(with-primitive p
        (pixels-display (pixels->texture p 0))

using these, the feedback example is as simple as this:
http://bit.ly/gLqX3V

ffgl plugins support this new feature. now you can even use multiple plugins on the same pixel primitive. (ffgl-process) has been changed. it also takes the output texture handle and input texture handles instead of pixel primitives:

(ffgl-process output-pixel-primitive output-texture-handle
              input-texture-handle ...)

ffgl examples:
https://gist.github.com/742364

comments and suggestions are welcome.

best,
gabor

Reply via email to