Hi,
I must be stupid or something. I can't see any relevant difference
between the attached patch (and its shader) and the example "01 simple
texture" in the "10 GLSL" folder.
However, the abovementioned example works fine here, while the attached
example shows up as a all-one-color square (probably the color of one
corner pixel of the image).
It looks much like an attempt to use normalized coordinates (0..1) where
whatevertheyarecalled coordinates are expected (0..width,0..height).
However, "my" shader seems identical to Cyrille's one and I'm sending
the [rectangle 1( message to all textures, so I can't understand why one
works while the other doesn't...
It must be right in front of my eyes but I don't see it.
(oh you need img1,2,3.jpg from the example folder to test it)
thanks
m.
--
Matteo Sisti Sette
matteosistisette@gmail.com
http://www.matteosistisette.com
#N canvas 393 27 1264 656 12;
#X obj 441 576 gemwin;
#X msg 437 515 create , 1;
#X msg 484 547 destroy;
#X obj 58 177 glsl_vertex;
#X obj 59 313 glsl_fragment;
#X obj 143 211 change;
#X obj 160 342 change;
#X obj 155 385 t b f;
#X obj 153 418 pack 0 0;
#X obj 60 490 glsl_program;
#X msg 154 454 link $1 $2;
#X obj 59 543 pix_texture;
#X obj 188 24 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 353 162 pix_image img1.jpg;
#X obj 506 163 pix_image img2.jpg;
#X obj 69 33 gemhead 50;
#X obj 353 73 gemhead 22;
#X obj 508 77 gemhead 23;
#X obj 348 263 pix_texture;
#X obj 511 259 pix_texture;
#X msg 373 221 texunit 0;
#X msg 519 221 texunit 1;
#X msg 229 387 curtex 0;
#X obj 664 260 pix_texture;
#X obj 661 78 gemhead 24;
#X msg 672 222 texunit 2;
#X obj 659 164 pix_image img3.jpg;
#X floatatom 212 525 5 0 0 0 - - -;
#X obj 70 60 t a a;
#X obj 56 122 separator;
#X msg 349 409 rectangle 1;
#X obj 348 384 loadbang;
#X msg 757 119 rectangle 1;
#X obj 762 53 loadbang;
#X msg 136 99 open trivialshader.vert;
#X msg 114 259 open trivialshader.frag;
#X obj 60 600 square 4;
#X connect 1 0 0 0;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
#X connect 3 1 5 0;
#X connect 4 0 9 0;
#X connect 4 1 6 0;
#X connect 5 0 8 0;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X connect 7 1 8 1;
#X connect 8 0 10 0;
#X connect 9 0 11 0;
#X connect 9 1 27 0;
#X connect 10 0 9 0;
#X connect 11 0 36 0;
#X connect 12 0 34 0;
#X connect 12 0 35 0;
#X connect 13 0 18 0;
#X connect 14 0 19 0;
#X connect 15 0 28 0;
#X connect 16 0 13 0;
#X connect 17 0 14 0;
#X connect 20 0 18 0;
#X connect 21 0 19 0;
#X connect 22 0 9 0;
#X connect 24 0 26 0;
#X connect 25 0 23 0;
#X connect 26 0 23 0;
#X connect 28 0 29 0;
#X connect 29 0 3 0;
#X connect 30 0 11 0;
#X connect 31 0 30 0;
#X connect 32 0 23 0;
#X connect 32 0 19 0;
#X connect 32 0 18 0;
#X connect 33 0 32 0;
#X connect 33 0 25 0;
#X connect 33 0 21 0;
#X connect 33 0 20 0;
#X connect 34 0 3 0;
#X connect 35 0 4 0;
// Cyrille Henry 2007
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
// porcodio
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect curtex;
void main (void)
{
vec2 xy=gl_TexCoord[0].st;
vec4 frontcolor = texture2DRect(curtex, xy);
gl_FragColor = frontcolor;
}