Saturday, 15 January 2011

three.js - THREE.loadTexture() cause flashing in setInterval() update -



three.js - THREE.loadTexture() cause flashing in setInterval() update -

im looking update materials texture image source in 3 js.

i can calling next in init()

setinterval(function(){ var pullimg = $('#frame_loader').attr('src'); var tmp = three.imageutils.loadtexture(pullimg); planemesh.material.map = tmp; planemesh.material.needsupdate = true; },100);

however, results in lot of flashiness.

i theorize having asynchronous render loop culprit.

however, when effort migrate above contents of setinterval() render(), texture not applied. planemesh remains black.

how might rid of flashing?

ahhhh, wasnt waiting texture load.

stick material update anonymous callback in loadtexture() , flash/flicker stops

three.imageutils.loadtexture(pullimg,{},function(){ planemesh.material.map = tmp; planemesh.material.needsupdate = true; });

three.js

No comments:

Post a Comment