Forums > Jitter

jit.gl.texture @dim broken?

June 20, 2006 | 12:05 pm

Hi, I really need to know the size of the texture loaded into the
jit.gl.texture object, but no matter what file I load, I always get dim 255
255 0 returned.

Please tell me I’m missing something.

(windows xp, jitter1.5.2, max4.5.7)

-thijs

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 868 818 50 9109513 print;
#P message 824 766 50 9109513 read;
#P message 758 767 50 9109513 getdim;
#P newex 784 791 94 9109513 jit.gl.texture;
#P connect 0 1 3 0;
#P connect 2 0 0 0;
#P connect 1 0 0 0;
#P window clipboard copycount 4;


June 20, 2006 | 2:18 pm

What do you see that’s wrong here? Everything looks good to me. I
would expect to get 256 256 0 which is what I get with jitter 1.5.2 on
osx.

wes


June 20, 2006 | 2:33 pm

Ah sorry I meant to write 256 256 0 instead of 255 255 0 :-

What I hoped to see was the dimensions of the file that is loaded. Otherwise
how can you know how big your texture is? And what does 256 256 0 stand for
if it’s not the texture size?

-thijs


June 20, 2006 | 2:44 pm

Fair enough. It actually does work….just not right away. The
texture has to be bound before its adapt attribute will kick in a
resize the texture and change the dim attribute. This is because
Jitter is a very harsh environment for opengl and textures are
sensitive creatures that need a proper home in a living opengl
context. So, jit.gl.texture exhibits some delayed behavior that only
kciks in when you actually use the thing. This patch shows that it
works.

best,
wes

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 66 45 226 196617 jit.gl.gridshape z @texture q @lighting_enable 1;
#P toggle 230 215 15 0;
#P message 230 235 68 196617 fullscreen $1;
#N vpatcher 30 89 166 253;
#P window setfont "Sans Serif" 9.;
#P newex 50 71 35 196617 sel 27;
#P newex 50 50 40 196617 key;
#P outlet 50 93 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P pop;
#P newobj 230 195 33 196617 p Esc;
#P newex 128 213 48 196617 loadbang;
#P newex 230 253 138 196617 jit.window z @depthbuffer 1;
#P message 191 253 34 196617 reset;
#P newex 191 274 173 196617 jit.gl.handle z @inherit_transform 1;
#P toggle 128 234 15 0;
#P newex 128 253 57 196617 qmetro 60;
#P newex 128 274 50 196617 t b erase;
#P newex 128 299 73 196617 jit.gl.render z;
#P newex 185 137 50 196617 print;
#P message 141 85 50 196617 read;
#P message 75 86 50 196617 getdim;
#P newex 101 110 119 196617 jit.gl.texture z @name q;
#P connect 1 0 0 0;
#P connect 2 0 0 0;
#P connect 0 1 3 0;
#P fasten 5 1 4 0 173 295 133 295;
#P fasten 5 0 4 0 133 295 133 295;
#P fasten 8 0 4 0 196 295 133 295;
#P connect 9 0 8 0;
#P connect 13 0 10 0;
#P connect 14 0 13 0;
#P connect 12 0 14 0;
#P connect 6 0 5 0;
#P connect 7 0 6 0;
#P connect 11 0 7 0;
#P window clipboard copycount 16;


June 20, 2006 | 3:17 pm

Can I post that to cuteoverload.com? That made my heart warm and
fuzzy! I kid I kid!

v a d e //

http://www.vade.info
abstrakt.vade.info


June 20, 2006 | 3:36 pm

aha! thanks a lot wes. I was getting really nervous about my deadline in 2
days:-)

In case anyone cares, I use this to do relative blurring of the texture. If
you project a large texture onto an object, and then scale it down, the
texture looks really ugly because the downsampling doesn’t do interpolation.
Joshua suggested to use a blurring shader. This looks really nice, but you
have to set the width attribute of the shader relative to downsampling
factor. To calculate the downsampling factor I needed the texture dimensions
and the object scaling.

I guess it’s going to work now. Thanks again.

best, -thijs


Viewing 6 posts - 1 through 6 (of 6 total)