Rendering multiple GL Lines?

ian's picture

I'm trying to put together a graffiti wall as part of a videowall installation I'm doing in a month or so's time. The idea is to take the TUIO information from the multitouch part of MSP Remote and feed that into a GL Line Structure patch to create a line.

This is all working fine, but...it's all one continous line - because I'm just adding to the structure. If you take your fingers away from the remote and then try to start drawing somewhere else (for example, moving on to another letter), the GL Structure patch naturally draws a line from the last point to the new point. Now I could create multiple renderers and work out some twisty logic in the javascript patch to try and fudge a solution, but I was wondering if there's an obvious way of allowing discontinous lines that I'm missing...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cwright's picture
Re: Rendering multiple GL Lines?

Double up end end points, and set the Line type to "Line Segments" -- instead of P0, P1, P2, P3 in the structure, have P0, P1, P1, P2, P2, P3.. -- it's a little more difficult, but it'll let you draw several separate segments without needing to render multiple structures.

PreviewAttachmentSize
LineType.png
LineType.png34.78 KB

ian's picture
Re: Rendering multiple GL Lines?

Aha! Thanks! Seems to be working out quite well :).

bernardo's picture
Re: Rendering multiple GL Lines?

hi ian can you tell me how you accomplished this? i can't seem to duplicate a strucuture member i am getting kinda numb...

toneburst's picture
Re: Rendering multiple GL Lines?

Is there an OpenGL performance hit to doubling-up points in this way? I'm assuming there will be some structure-related slowdown, too.

a|x

bernardo's picture
Re: Rendering multiple GL Lines?

oh well i wont mind if it passes from 100fps to 60fps :) still need some help thanks

bernardo's picture
Re: Rendering multiple GL Lines?

so how can i export a point with P0, P1, P1,P2,P2,P3,P3... and so on?

my example uses the javascript push function, but it pushes all the points... please help

bernardo's picture
Re: Rendering multiple GL Lines?

some code:

var result = new Object();
 
function (__structure points) main (__number inputPressure, __boolean draw, __boolean reset, __number xTheta)
{
   if(reset || result.points == undefined)
      result.points = new Array;
   if(draw)
   {
      var point = new Array;
      point[0] =xTheta;
      point[1] = inputPressure;
      if (result.points[0]){
      result.points.push(point);//push mode 
      }
      else{
      result.points.push(point,point);//push mode
      }
   }
 
   return result;
}
//partial code from kineme cwright

bernardo's picture
Re: Rendering multiple GL Lines?

getting kinda lonely here but i got what i wanted i guess but still no work... anyone? thanks bern

var result = new Object();
 
function (__structure points) main (__number inputPressure,__number inputX, __number inputY, __boolean draw, __boolean reset, __number xTheta, __number yTheta, __number zTheta)
{
   if(reset || result.points == undefined)
      result.points = new Array;
   if(draw)
   {
      var point = new Array;
      point[0] = inputX;
      point[1] = inputY;
      point[2] = inputPressure;
      result.points[0] = point;
      result.points.push(point,point);//push mode
 
   }
 
   return result;
}
///special thanks to kineme.net chris

cybero's picture
Re: Rendering multiple GL Lines?

well I get this from your code, see attached, and you're wanting to be able to put out multiple structures concurrently, why not just make multiple structure outputs?

PreviewAttachmentSize
bernardomultiplelinsone.qtz18.43 KB

bernardo's picture
Re: Rendering multiple GL Lines?

i am trying to create a 2d array that stores the previous line and the next one on a new structure... kinda pen up stops line pen down starts a new line

plus i get this for an error:

(null) : Patch with name "/queue structure in parallel" is missing

Macro Patch Cannot create node of class "/queue structure in parallel" and identifier "(null)"

Macro Patch Cannot create connection from ["key_0020" @ "Keyboard_1"] to ["Reset_Signal" @ "Patch_1"]

Macro Patch Cannot create connection from ["points" @ "JavaScript_1"] to ["Values" @ "Patch_1"]

(null) State restoration failed on

cybero's picture
Re: Rendering multiple GL Lines?

I think that either you are on Leo or you are needing to refresh your frameworks from installation disk , plus appropriate update on Snow Leo.

The composition calling for queue structure in parallel is requiring that their be a patch of that name in your Library and its SL only.

bernardo's picture
Re: Rendering multiple GL Lines?

thanks cybero... yes i am in leopard winter hasn't arrived on this side... keep searching....

cybero's picture
Re: Rendering multiple GL Lines?

I think you might need to copy and paste the code form inside the JS patch into a new JS patch and then connect that up, must be the indexed name that has been changed or something that results in perfectly good JS that must have been working after a fashion for you on Leo to then not work when returned from a Snow Leo user.

I just built my example up using GL patches a Script patch, a Mouse patch, a Keyboard and an Interpolator. The Queue Structure in Parallel was unconnected to anything, its the JS disconnection situation that has me a trifle baffled.

I say this because this won't work in Leo runtimes and the error is the same JS error you've gotten, neither 32 nor 64 bit runtime works without error.

I've taken out the offending item and re-saved the file, if it provokes the same error, then try the workaround suggested above, or something similar.

Does that JS work for you in Leo?

PreviewAttachmentSize
bernardomultiplelinsone.qtz6.5 KB

gtoledo3's picture
Re: Rendering multiple GL Lines?

Hmm, that runs in Leopard, but it doesn't make separate lines...

For instance, you have pressure attached to x position... so mouse up and down can't possibly generate anything meaningful (?).

I am probably missing something on this one, I haven't totally read the whole thread. I haven't tried it in SL either.

cybero's picture
Re: Rendering multiple GL Lines?

LOL - must be needing some new glasses.

bernardo's picture
Re: Rendering multiple GL Lines?

yeah but i guess you're are in the right path... but still no go too here in leo mode waiting for the snow though

bernardo's picture
Re: Rendering multiple GL Lines?

still trying though

bernardo's picture
Re: Rendering multiple GL Lines?

ok trying the path of 3d arrays

gtoledo3's picture
Re: Rendering multiple GL Lines?

Ohhh, I think this is the topic I was thinking of when posting on another thread. If you feed a queue a nan value, the line will break, allowing you to create another segment that isn't "connected" to the first. This is an "auto" demonstration, but it would be easy enough to setup the mouse patch w/ a multiplexer so that nan is fed to an input when there is no keypress.

bernardo's picture
Re: Rendering multiple GL Lines?

NICE!

bernardo's picture
Re: Rendering multiple GL Lines?

even nicer is when nan is the same as NaN