Matteo Sisti Sette a écrit :
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)
unfortunatly, multitexture coordinate does not work with Gem. so you can only use 1st image coordinate. if the other images dos not have the same size, you have to "manually" adjust the coordinate : in the shader :
textcoord1=gl_TexCoord[0].st textcoord2=gl_TexCoord[0].st*coef.xy
with : coef.x = size_image2.x/size_image1.x coef.y = size_image2.y/size_image1.y)
same for other textures.
you can compute "coef" in the patch using pix_info to get image size or fix it if your images always have the same size.
you can also mix rectangulare / not rectangular texture this way, but it is a bit crappy...
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);
if you want answer for me, you should make shorter mail. i hardly read mail that are longer than 5 or 10 lines.
c
it would be a suggestion to improve it so it works with images of different sizes.