Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

flicker with llSetTexture

Wicc Cunningham
Registered User
Join date: 25 Jun 2004
Posts: 52
02-20-2006 14:15
I wanted to make myself a new banner for my store and thoought about doing an "animated" one that uses textures and just cycles through them. My only problem is that it flickers every once in a while. It blanks out then you see the actual "frame" being displayed. It's not consistent as to when it happens. I thougth that perhaps I need to request memory for this and that would cause it to happen more smoothly or is it a client side problem?

Any help would be appreciated.

Wicc Cunningham

P.S. If anyone has tips how to post a script short of typing each and every line I would appreciate it. As you can see the cut and paste didn't turn out well. **bows before thoes tha post huge scripts**


CODE

//########################################
//######## Wicc Cunningham Scripts Outlet Banner #####
//######## #######
//######## Animated texture that spells out the #######
//######## name of the store. ##########
//########################################

list frames = ["wcsobanner00","wcsobannerblank","wcsobanner00","wcsobannerblank","wcsobanner01","wcsobanner02","wcsobanner03","wcsobanner04","wcsobanner05","wcsobanner06","wcsobanner07","wcsobanner08","wcsobanner09","wcsobanner10","wcsobanner11","wcsobanner12","wcsobanner13","wcsobanner14","wcsobanner15","wcsobanner16","wcsobanner17","wcsobanner18","wcsobanner19","wcsobanner20","wcsobanner21","wcsobanner22","wcsobanner23","wcsobanner24","wcsobanner25","wcsobanner26","wcsobanner27","wcsobanner28","wcsobanner29","wcsobase","wcsobanner29","wcsobase","wcsobannerblank"];

integer counter = 0;
float delay = 0.3;

default {

state_entry()
{
llSetText("Touch Me for a Landmark",<0.0,1.0,0.0>,1.0);
llSetTimerEvent(delay);
}

touch_start(integer total_touches)
{
integer x;
for(x = 0; x < total_touches; x++)
{
llGiveInventory(llDetectedKey(x), "landmarkname");
}
}

timer()
{
llSetTexture(llList2String(frames, counter), ALL_SIDES);
counter++;
if(counter == llGetListLength(frames)) counter = 0;
}
}
Saaz Roentgen
Minifig
Join date: 30 Aug 2003
Posts: 14
02-22-2006 16:06
llSetTextureAnim might work better for this kind of thing - easier to code, and it may also fix the flicker problem. Basically you combine your separate textures into one big one, and use this call to make the client automatically animate the frames. (Make the one call in state_entry, and you can get rid of all the timer stuff.)
_____________________
I would kill everyone in this room for a drop of sweet beer.
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
02-22-2006 18:01
And you'll do your part to reduce lag and slow the cpu-death of the metaverse! (Ignore that line)

Specifically,

CODE
llSetTextureAnim(integer mode, integer side, integer x_frames, integer y_frames, float start, float length, float rate);


So, if you had an image with the left side being the first picture and the right side the second, and you wanted it on all sides...

CODE
llSetTextureAnim( ANIM_ON | LOOP , ALL_SIDES, 2, 1, 0.0, 0.0, 1);


The flicker would probably be your client changing textures-- it may take a moment to fetch the texture from its cache. With this method, the animation becomes a property of the primitive, and becomes entirely client side. (Similar to the difference between llMakeExplosion and llParticleSystem)
Wicc Cunningham
Registered User
Join date: 25 Jun 2004
Posts: 52
02-24-2006 05:57
Thanks!! I guess that is how my gryphon avatar's eye blink since it looks like it's just a texture. I'll have to experiment with it.