Hi, thanks for the tips, learnt a lot. I would say Case 1 is solved, but still 
stuck on Case 2 :) 
(replies below)

On 4 Oct 2010, at 08:31, Alastair Leith wrote:

> also added a dummy input to smooth the execution (sets the Viewer fps value 
> too)
wow I don't understand the significance of the dummy input. Without the dummy 
input it doesn't work for me at all! It doesn't just smooth it, it makes it 
work! how does the dummy input make it work? It's not actually being used 
anywhere. A JS bug?

> A simple Log() statement showed that the update function was getting called 
> every frame. I have to emphasis I would NEVER be able to use the JS patch 
> effectively without the Log() statement to debug/examine it. (Used to do it 
> manually but Log() is better). Can't recommend it enough, (even to a seasoned 
> programmer like you).
I didn't know about Log, it sure has changed my life now for debugging JS. I 
see the log goes to the console, where there is always a bit of a delay. Is it 
possible to see the log output directly in QC in realtime without switching to 
debug mode (which is super slow).

> A few more edits were enough to get it going but at this point I want to 
> observe that putting a JS patch inside an iterator and having each iteration 
> contribute to what seems to be the unified structure (data), is a real 
> eye-opener to me. I seems kind of weird and I'm not convinced it's all above 
> board yet ;-) 
I'm not suggesting this is the best way to do it, just the solution that I came 
up with. Feels hacky to me too.

> Global structures across JS patches aren't allowed so that doesn't explain 
> it… must be the QCs implementation of JS patch inside an iterator.
> 
> Mousing over the Struct_Out port I created shows the 10 items despite the 
> absence of a JS loop, can I say weird one more time? 
Not sure which bit surprises you here? The way I see it data is a global array 
and every iterator loop data[iterator_index] is filled with data. So in the end 
data contains the data for all of the objects in one array. 

> 
> To me JS outside the iterator or Kineme Structure Render patch is more 
> straight forward but I appreciate you are attempting a OOP approach so I'm 
> interested to see where you go with this, please keep posting!
I didn't know about the Kineme Structure Render. Is that the GL Structure 
Render? I'll look into it, definitely looks interesting. 


> Anyhow even using an iterator to display the structure the following comp 
> canes it for performance:
For me:
1a gives 40fps @ 1000 and 9fps @ 5000
2a gives 16fps @ 1000 and locks up @ 5000 :) (after a long wait I get 3fps).
Did you get better performance out of 2a?

Also I noticed in 2a they were gradually getting smaller and further, was that 
intentional? I changed it to the same behaviour as 1a so the fps comparison 
would be fair (drawing same number of pixels in case fillrate was an issue with 
lots of cubes)

I think it makes sense that 1a would be faster. There is only one loop (the 
iterator) which cycles through, updates and draws. Whereas in 2a there are two 
loops, one in JS (for the update) and one for the iterator (the draw). 






> 
> 
> On 04/10/2010, at 6:36 AM, Mehmet Akten wrote:
> 
> 
>> ah thanks yea, that should be d.mass , not mass.
>> also it should be pos += vel / mass, not pos = vel / mass. (i haven't slept 
>> much this past week).
>> So that explains the disappearing. 
>> 
>> It seems the update() is called only once per run. Even though in debug mode 
>> the JS patch is flashing red every frame, if I set pos to random every 
>> frame, it still doesn't move. So I need to make it get called every frame 
>> some how. Maybe that isn't too complicated, then there is still the Case 2 :)
>> 
>> 
>> P.S. I've pulled this thread in from the Quartz list to the QC list.
>> 
>> 
>>      
>> MSA Visuals Ltd.
>> Unit 107 Netil Studios
>> 1-7 Westgate St.
>> London E8 3RL, UK
>> +44 20 8123 9986
>> www.msavisuals.com
>> 
>> On 3 Oct 2010, at 20:27, George Toledo wrote:
>> 
>> 
>>> Also.... still sussing out where you are going/what you need to do (sorry, 
>>> it's taking a moment to sink in).
>>> 
>>> ...but I just opened up the composition and ran it. Mass wasn't being 
>>> declared anywhere, and if you did declare it where you have it in the 
>>> javascript, it will "fart out" (excuse my highly technical term).
>>> 
>>> This re-order allows there to be a mass value that doesn't cause error in 
>>> the javascript compiler. Apologies if my re-order precludes something that 
>>> you're trying to accomplish that's going over my head (as in, I'm still 
>>> sussing out the desires in your original post, in relation to this qtz.)
>>> 
>>> -GT
>>> 
>>> On Sun, Oct 3, 2010 at 3:16 PM, Mehmet Akten <[email protected]> wrote:
>>> 
>>> 
>>> 
>>> -- 
>>>> Thanks george, that makes perfect sense, I'll git it a shot.
>>>> 
>>>> P.S. I accidentally posted this to the quartz dev list first. I reposted 
>>>> on the QC list too as its more related to that. Probably best not to 
>>>> continue this thread on this list. Apologies for the double post.
>>>> 
>>>> 
>>>> 
>>>>    
>>>> MSA Visuals Ltd.
>>>> Unit 107 Netil Studios
>>>> 1-7 Westgate St.
>>>> London E8 3RL, UK
>>>> +44 20 8123 9986
>>>> www.msavisuals.com
>>>> 
>>>> On 3 Oct 2010, at 20:11, George Toledo wrote:
>>>> 
>>>> 
>>>> Quick note: still reading through your case scenarios; the feedback patch 
>>>> will work inside of the iterator if you don't have consumer patches. The 
>>>> results can then be gathered in a queue and published out, where the 
>>>> values can then be iterated through again if necessary. Not saying this is 
>>>> necessarily always efficient, but it's possible.
>>>> 
>>>> -GT
>>>> 
>>>> On Sun, Oct 3, 2010 at 2:58 PM, Mehmet Akten <[email protected]> wrote:
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>>> Hi all, a much discussed topic I'm sure...
>>>>> 
>>>>> I know QC is not designed as a 'proper' OOP programming language etc. so 
>>>>> a question regarding object oriented programming re quartz composer may 
>>>>> be irrelevant, but nevertheless I'm trying to get my head around how best 
>>>>> to tackle some basic data/behaviour management approaches in QC.
>>>>> 
>>>>> Take this scenario (this isn't for anything so I don't have specific 
>>>>> goal, just a test case).
>>>>> 
>>>>> Case 1:
>>>>> I have N initial cubes, flying around with some basic behaviour. E.g. In 
>>>>> this particular case, I want them to each have a target point, they fly 
>>>>> to their target point based on various parameters (mass etc). When they 
>>>>> reach their target, they pick a new target and fly there. I'm sure I did 
>>>>> this kinda stuff in the past using global JS vars, but I couldn't get it 
>>>>> to work this time. I've attached my comp, if I have one iteration, I see 
>>>>> my cube, but it doesn't move. If I have more than 1 iteration, they all 
>>>>> appear, but then disappear after a short while. 
>>>>> 
>>>>> What I'm doing may be very hacky (JS patch in an iterator with a global 
>>>>> array of structures). THe feedback patch seems to try and address this 
>>>>> issue, but obviously doesn't work in an iterator.
>>>>> 
>>>>> 
>>>>> Then there's more. Imagine a few more basic scenarios.
>>>>> 
>>>>> Case 2:
>>>>> 1. when I click in an empty space, a new object is created and added to 
>>>>> the flock
>>>>> 2. when i click on an existing object, it is deleted
>>>>> 3. pressing 'e' toggles the app between 'edit' mode and 'play' mode. in 
>>>>> 'edit mode they all stop moving and when you click on an existing object 
>>>>> you get some very basic options:
>>>>>   a. by clicking elsewhere you can set the new target for that object
>>>>>   b. pressing d deletes the object
>>>>>   c. numbers 1-9 defines how that particular object should be drawn 
>>>>> (texture, cube, sphere etc.)
>>>>>   d. etc.
>>>>> 
>>>>> I can imagine how to do #3 (keep track of a bool in the root.data 
>>>>> object). and #3c (multiplexer). #1, #2, #3a and #3b should be straight 
>>>>> forward too, but its the data management that I can't get my head around. 
>>>>>   
>>>>> 
>>>>> I know if it gets too complicated it just makes sense to write a plugin, 
>>>>> but I just want to see exactly how far can can QC be taken in this way 
>>>>> regarding logic and behaviours. The scenario I mention above doesn't seem 
>>>>> too complicated, in fact is quite basic and I feel you should be able to 
>>>>> do it within a noodley environment.
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> P.S. connecting the JS output to enable of a billboard worked by the way, 
>>>>> thanks for the tip alessandro
>>>>> 
>>>>> Cheers,
>>>>> 
>>>>> Memo.
>>>>> 
>>>>> 
>>>>> 
>>>>>   
>>>>> MSA Visuals Ltd.
>>>>> Unit 107 Netil Studios
>>>>> 1-7 Westgate St.
>>>>> London E8 3RL, UK
>>>>> +44 20 8123 9986
>>>>> www.msavisuals.com
>>>>> 
>>>>> 
>>>>>  _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Quartz-dev mailing list      ([email protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> http://lists.apple.com/mailman/options/quartz-dev/gtoledo3%40gmail.com
>>>>> 
>>>>> This email sent to [email protected]
>>>> George Toledo
>>>> [email protected]
>>>> www.georgetoledo.com
>>>> 
>>>> The information contained in this E-mail and any attachments may be 
>>>> confidential.
>>>> If you have received this E-mail in error, please notify us immediately by 
>>>> telephone or return E-mail.
>>>> You should not use or disclose the contents of this E-mail or any of the 
>>>> attachments for any purpose or to any persons.
>>>> 
>>>> 
>>>>  _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Quartz-dev mailing list      ([email protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/quartz-dev/gtoledo3%40gmail.com
>>>> 
>>>> This email sent to [email protected]
>>> George Toledo
>>> [email protected]
>>> www.georgetoledo.com
>>> 
>>> The information contained in this E-mail and any attachments may be 
>>> confidential.
>>> If you have received this E-mail in error, please notify us immediately by 
>>> telephone or return E-mail.
>>> You should not use or disclose the contents of this E-mail or any of the 
>>> attachments for any purpose or to any persons.
>>> 
>>> <OOP test1_b.qtz>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Quartzcomposer-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/quartzcomposer-dev/qc.student.au%40gmail.com
>> 
>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to