more opengl text movement (particle system)


    May 13 2006 | 9:21 pm
    Hi there,
    I was able so successfully attach opengl text to particles in a opengl context using jit.gl.text2d. It is fairly straight forward to attach a single word (such as in the Tannenbaum example) but I need to attach different text fragments to a particle and retain that text throughout the duration of the particle's life. Right now my text fragments are in a text file. Each line in the file represents a unique text fragment that should be attached to a particle.
    My first attempt was to add a plane of text line indices to the shiva/ vishnu particle matrix. During the jit.iter process when the text coordinates and other style information is fed into the jit.gl.text2d, these line indices were used to grab lines of text from a text file in a [text] object. This strategy caused the system to grind to a halt. I believe this was because the [text] object has a hard time giving up its contents so quickly.
    The solution I have landed on for now is to create a sort of text string buffer (string array ...) using a 2d-single plane jitter matrix to contain the X number of text fragments currently alive in the particle system. This presents a complex, but not impossible housekeeping (indexing) problem, but my partially built system seems to be running quickly enough.
    Is this single-plane-2d jitter matrix strategy as fast as using the "plane" attribute in jit.gl.text2d to access text from a 1D multi- plane jitter matrix? That is -- would it be faster to construct my string buffer (or string array ...) as a 2d-single plane matrix or a 1d-multi-plane matrix?
    All of this aside, does anyone have another strategy for allowing unique text fragments to be attached to a given particle for the entire duration of its life?
    Thanks for the help!
    Christopher

    • May 13 2006 | 9:34 pm
      > Is this single-plane-2d jitter matrix strategy as fast as using the > "plane" attribute in jit.gl.text2d to access text from a 1D multi- > plane jitter matrix? That is -- would it be faster to construct my > string buffer (or string array ...) as a 2d-single plane matrix or a > 1d-multi-plane matrix?
      Well, matrices have a maximum planecount of 32, so that kind of limits how many lines you can have.
      > > All of this aside, does anyone have another strategy for allowing > unique text fragments to be attached to a given particle for the > entire duration of its life?
      I might suggest a JS or JAVA solution. You can probably knock out a JS solution pretty quickly. Just instantiate you jit.gl.text2d as a javascript object and send it text to draw in the JS itself. This will make your system easier to build and more flexible. You can also share your particle matrix between the patch and the JS file by accessing a named matrix is the usual fashion. This way, you can can send a draw command tot he JS file and have it process the particle matrix and send appropritate commands to jit.gl.text2d.
      best, wes