[PD] gem/GLSL: how to compute correct coordinates for rectangular textures

Matteo Sisti Sette matteosistisette at gmail.com
Tue Jan 5 13:15:00 CET 2010


Jack escribió:
>
> [pix_set] ?
> You have an example in examples > Gem > glsl > 06.framebuffer_and_shader
> ++

Thanks a lot, that should do the trick. Both with and without rectangle 
mode I think (have to try though).

Now how could I set sizes for multiple textures, that is for example, 
how would you modify the "05 multitexture" example in the "10 glsl" 
folder in order to work correctly with images of different 
(non-power-of-two) sizes? (not necessarily with rectangular textures)

Whether rectangle mode is active or not, you would need separate texture 
coordinates for the two textures. With rectangle mode, because the width 
and height of the two textures (hence the range of coordinate values) is 
different. Without rectangular mode, because the ratio between actual 
dimensions and internal power-of-two dimensions is different.

@ Cyrille: I attach this to you too 'cause I guess the multitexture 
example is yours (most glsl examples are iirc); it would be a suggestion 
to improve it so it works with images of different sizes.

-- 
Matteo Sisti Sette
matteosistisette at gmail.com
http://www.matteosistisette.com




More information about the Pd-list mailing list