Texture Handle Question?

Blitz3D Forums/Blitz3D Programming/Texture Handle Question?

Jeremy Alessi(Posted 2003) [#1]
Does anyone know if it's possible to grab the texture handle in a model that has been loaded with loadmesh() this is so I can scroll the texture?


GfK(Posted 2003) [#2]
Yes, just load the texture again with LoadTexture. If the texture has already been loaded with the same flags either with LoadTexture, or by being attached to a model, all you'll receive is a pointer to the existing texture (which is attached to the model already).

Be warned - if you change the texture flags in LoadTexture itself, or use TextureFilter, then two textures will exist instead of one (even if you only use flag 256 on one texture but not on the other).

Keep an eye on AvailVidMem() when using this trick, just to make sure you're getting it right.


DrakeX(Posted 2003) [#3]
interesting! i love it


Jeremy Alessi(Posted 2003) [#4]
I must be doing something wrong. I have the loadtexture() call in a coditional where if I press the space bar it loads the texture and also increments 2 variables one for u and one for the v and positions the texture. However, even though AvailVidMem() doesn't change the texture doesn't move. I tried to load the texture using the alpha flag and the masked flag and that didn't change vid mem either. If I use flag 256 that does change it though. Whatever the deal I can't seem to get a hold of the textures on the model to move them.

If KeyDown(57)
    water_tex=LoadTexture("Media/Images_Models/Stream.png")
    stream_u#=stream_u#+1
    stream_v#=stream_v#+1
    PositionTexture(water_tex,stream_u#,stream_v#)
EndIf


Of course I also tried loading the texture just after the model is loaded. That didn't help.


Jeremy Alessi(Posted 2003) [#5]
Well, with this particular model if I loadtexture() and then entitytexture() the model with the same texture it already had on it from 3DS Max it looks the same (I guess the UV's dictate that) and I can scroll the texture. Of course that's not really what I want to do.


DJWoodgate(Posted 2003) [#6]
Thats the rub I suppose. I guess it implies that although the texture might be the same texture in memory (check by modifying it), you can have multiple handles which also address things like position and rotation which are distinct for each handle. This is of course good although it might be beneficial if this stuff were explained a little more in the docs (though I guess its taken as read by the gurus). Anyway there have been a raft of feature requests that encompass this sort of thing, but they have yet to be realised. Possibly because one could envisage a whole host of extra functions being required to fully access all the entity/brush/texture/surface information. Where would it all end :)