OpenGL FBO ping-pong like behavior with jitter? is it possible?


    May 11 2011 | 2:31 am
    Greetings
    I’m very new to the MAX/MSP environment so I apologize if this question is too rudimentary. But for my first MAX/MSP project I have run into a bit of problem that no level of google-ing seems to help.
    I want to use a shader to iterate over a texture for a number of passes. Typically in the opengl world I would create two FBO objects and use the results of each pass as an input into the next one. Essentially I would ping-pong between them. In trying to do duplicate this behavior in MAX/MSP I have attempted to do this in a javascript node. The following code looks like it should work but it most definitely does not.
    function bang()
    {
    radslab1.jit_gl_texture("tex1","texture");
    radslab1.jit_gl_texture("tex0", "srcTexture");
    radslab1.draw();
    radslab0.jit_gl_texture("tex0", "srcTexture");
    var i=0;
    for (i = 0; i {
    if( i % 2 > 0 ){
    radslab0.jit_gl_texture(radslab1.out_name,"texture");
    radslab0.jit_gl_texture("tex0", "srcTexture");
    radslab0.draw();
    }else{
    radslab1.jit_gl_texture(radslab0.out_name, "texture");
    radslab1.jit_gl_texture("tex0", "srcTexture");
    radslab1.draw();
    }
    }
    mat.jit_gl_texture(radslab0.out_name);
    // outlet(1, "jit_gl_texture", radslab0.out_name);
    outlet(0, "jit_matrix", mat.name);
    }
    It doesn’t appear that the using the output from the previous slab as an input to the next is working as I excepted. The shader is working for a single pass but subsequent passes are not.
    Looking trough the examples I haven’t found something that does this technique. I’m hoping that somebody might have some pointers or an obvious direction that I’m over looking.
    Thanks in advance if anybody has any advice,
    -Booltox