JS: loading textures on start up


    Jan 06 2007 | 2:03 pm
    ok..... last one(I hope.) I'm trying very hard to follow the
    documentation here. I hope this isn't something stupid because I
    really feel bad asking for so much help.
    the problem here, is that it takes 3 tries to get a texture loaded in
    jit.js. in max it appears that jit.gl.texture makes max wait until
    its done loading the file. but in javascript, it lets JS executing
    the code. any work arounds for this?
    ///////////////////////////MAX
    ////////////////NAME THIS testTexture.js
    autowatch=1;
    var changeMeToAValidImagePath = "moooooooo"
    var myrender = null;
    var dirtTexture =null
    var background = null
    var myrender = new JitterObject("jit.gl.render","zoe");
    function loadbang()
    {
    post("begin loadbang--n");
    dirtTexture = new JitterObject("jit.gl.texture","zoe")
    dirtTexture.name = "dirt"
    dirtTexture.file = changeMeToAValidImagePath
    post("dirtTexture.dim AFTER dirtTexture.file
    assignment: ,",dirtTexture.dim,"n");
    background = new JitterObject("jit.gl.gridshape","zoe")
    background.shape = "plane"
    background.texture = "dirt";
    draw();
    }
    function draw()
    {
    myrender.erase();
    myrender.drawclients();
    myrender.swap();
    }