<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ofelia images -&gt; variables]]></title><description><![CDATA[<p>I'm starting to look at ofelia (excited about this, actually <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/smiley.png" title=":D" alt=":D" /> ).</p>
<p>But I find myself confused about what images and variables.</p>
<p>I managed to make my own patch doing:</p>
<ul>
<li>[ofSetup] -&gt; [load ...( -&gt; ofImage name</li>
<li>[ofDraw] -&gt; [ofImage name ...]</li>
</ul>
<p>... and it draws the picture properly.</p>
<p>But I saw other examples using the images within an [ofelia f] object -- for example, the pointillism example loads the image into [ofImage $0-img] and then has <code>[ofDraw] -&gt; [ofRequire $0-img] -&gt; ... -&gt; [ofelia f; local img, m = a[1].image, a[2]; ...]</code>.</p>
<p>So I made <code>[ofDraw] -&gt; [ofRequire name] -&gt; [ofelia f; ...]</code> and now I don't know what to do.</p>
<p><code>name:draw(...)</code> just throws a lot of nil reference errors into the console window... but clearly example files are able to use images within [ofelia f]...? If I have &quot;require&quot;d name, then I suppose &quot;name&quot; should be available somehow?</p>
<p>What is the relationship between the [ofRequire] objects and the implicit <code>a</code> argument?</p>
<p>Apologies if this is supposed to be obvious. I went looking for a tutorial series and I didn't find anything, so I'm attempting to infer first principles from examples. That can take you only so far.</p>
<p>Thanks,<br />
hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 04:51:54 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/12323.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Sep 2019 06:57:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Tue, 24 Sep 2019 06:59:04 GMT]]></title><description><![CDATA[<p>I'm starting to look at ofelia (excited about this, actually <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/smiley.png" title=":D" alt=":D" /> ).</p>
<p>But I find myself confused about what images and variables.</p>
<p>I managed to make my own patch doing:</p>
<ul>
<li>[ofSetup] -&gt; [load ...( -&gt; ofImage name</li>
<li>[ofDraw] -&gt; [ofImage name ...]</li>
</ul>
<p>... and it draws the picture properly.</p>
<p>But I saw other examples using the images within an [ofelia f] object -- for example, the pointillism example loads the image into [ofImage $0-img] and then has <code>[ofDraw] -&gt; [ofRequire $0-img] -&gt; ... -&gt; [ofelia f; local img, m = a[1].image, a[2]; ...]</code>.</p>
<p>So I made <code>[ofDraw] -&gt; [ofRequire name] -&gt; [ofelia f; ...]</code> and now I don't know what to do.</p>
<p><code>name:draw(...)</code> just throws a lot of nil reference errors into the console window... but clearly example files are able to use images within [ofelia f]...? If I have &quot;require&quot;d name, then I suppose &quot;name&quot; should be available somehow?</p>
<p>What is the relationship between the [ofRequire] objects and the implicit <code>a</code> argument?</p>
<p>Apologies if this is supposed to be obvious. I went looking for a tutorial series and I didn't find anything, so I'm attempting to infer first principles from examples. That can take you only so far.</p>
<p>Thanks,<br />
hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Tue, 24 Sep 2019 06:59:04 GMT</pubDate></item><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Tue, 24 Sep 2019 12:19:13 GMT]]></title><description><![CDATA[<p>[ofRequire] loads the «M» variable from an [ofelia] object.</p>
<p>Let' say you have this [ofelia function] with name <em>$0-script</em>:<br />
<code>ofelia function $0-script;</code><br />
<code>M.x = 10;</code></p>
<p>You could use [ofRequire $0-script] to get the «M» variable defined in the [ofelia] object with name <em>$0-script</em>.</p>
<p>If you do this:<br />
<code>[ofRequire $0-script]</code><br />
↓<br />
<code>ofelia function $0-another-script;</code><br />
<code>print(a.x);</code></p>
<p>This will print «10». What could be confusing is that I now use the «a» variable to access the «M» variable. That's because every float, symbol, pointer is received in the [ofelia function] with the name «a». Like:</p>
<p><code>[100(</code><br />
↓<br />
<code>ofelia function $0-another-script;</code><br />
<code>print(a);</code></p>
<p>This will print the number «100». Now, since [ofImage] is actually an [ofelia define] object which cointains the variable <em>M.image</em>, if you require this script you will be able to access the image in an [ofelia function] using <em>a.image</em>, like this:</p>
<p><code>[...]</code><br />
↓<br />
<code>[ofImage $0-nice-image]</code></p>
<p>and then:</p>
<p><code>[ofRequire $0-nice-image]</code><br />
↓<br />
<code>ofelia function;</code><br />
<code>print(a.image:getWidth())</code></p>
<p>This will print the width of the image.<br />
Hope this helps!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/2</guid><dc:creator><![CDATA[dom1817]]></dc:creator><pubDate>Tue, 24 Sep 2019 12:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Wed, 25 Sep 2019 02:01:16 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/dom1817">@dom1817</a> Much appreciate the help. This won't make much sense until I play with it myself -- unfortunately I am extremely busy in the next few days and Friday will be my first opportunity to do anything with it. But I think I can piece it together based on this.</p>
<p>Thanks!<br />
hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/3</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Wed, 25 Sep 2019 02:01:16 GMT</pubDate></item><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Thu, 26 Sep 2019 00:31:38 GMT]]></title><description><![CDATA[<p>BTW I had a little time between a meeting and a concert yesterday, and I did get that working.</p>
<p>Next question is -- where to get more information about...</p>
<ul>
<li>[of***] objects, and</li>
<li>of***() functions available for use within scripts.</li>
</ul>
<p>That is... if I open the help patch for [ofImage], it takes me to ofelia-object-help.pd... which doesn't explain that [ofImage] is an [ofelia define] (how should I know that it isn't [ofelia function]?) or that it establishes <code>M.image</code> rather than some other name.</p>
<p>For the scripting functions, the pd help browser takes me to classesAndGlobalFunctions.txt, with a flat list of function names without arguments or any description of behavior. OK, I finally found <a href="https://github.com/openframeworks/openFrameworks/wiki/Tutorials,-Examples-and-Documentation" rel="nofollow">https://github.com/openframeworks/openFrameworks/wiki/Tutorials,-Examples-and-Documentation</a> (but I'm having problems accessing it at the moment).</p>
<p>So it's an interesting challenge... but I should also admit that my own SuperCollider extensions are rather badly documented, so I understand <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/laughing.png" title="laughing" alt=":laughing:" /></p>
<p>hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/4</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Thu, 26 Sep 2019 00:31:38 GMT</pubDate></item><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Thu, 26 Sep 2019 09:34:14 GMT]]></title><description><![CDATA[<p>Yes, I totally get what you mean. There are a lot of layers (Pd, Lua, OpenFrameworks) that are not very well documented and require a bit of guess work.</p>
<p>Actually until the <a href="https://github.com/cuinjune/Ofelia/releases/tag/v2.3.1" rel="nofollow">previous version</a> of Ofelia each [of] object had its own Lua code accessible, but now they are all embedded as objects (that's why you can't see the script but only the generic help file).</p>
<p>That said, when working with more complex stuff I find much easier to just write my own scripts in a code editor and load them using an [ofelia define] object. This way you have full control on what is happening and you just need to check the OpenFrameworks <a href="https://openframeworks.cc/documentation/" rel="nofollow">documentation</a> to see the methods and properties of each object.</p>
<p>Then it probably depends on how comfortable you are with traditional coding <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/grin.png" title="grin" alt=":grin:" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/5</guid><dc:creator><![CDATA[dom1817]]></dc:creator><pubDate>Thu, 26 Sep 2019 09:34:14 GMT</pubDate></item><item><title><![CDATA[Reply to Ofelia images -&gt; variables on Thu, 26 Sep 2019 13:12:41 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/dom1817">@dom1817</a> &quot;Then it probably depends on how comfortable you are with traditional coding&quot;</p>
<p>I am very comfortable with it -- more comfortable than I am with dataflows. (I'll stop short of issuing my standard rant on the subject. I'm sure you've all heard it all before anyway.)</p>
<p>Students at my college, not so much. I've got a few months to figure out the right balance between dataflow objects and code blocks...</p>
<p>hjh</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/12323/ofelia-images-variables/6</guid><dc:creator><![CDATA[ddw_music]]></dc:creator><pubDate>Thu, 26 Sep 2019 13:12:41 GMT</pubDate></item></channel></rss>