<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CreativeApplications.Net &#187; learning</title>
	<atom:link href="http://www.creativeapplications.net/tag/learning/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.creativeapplications.net</link>
	<description>Apps that Inspire..</description>
	<lastBuildDate>Thu, 09 Feb 2012 12:41:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Playing with Pixels [Javascript, Processing]</title>
		<link>http://www.creativeapplications.net/processing/playing-with-pixels-javascript-processing/</link>
		<comments>http://www.creativeapplications.net/processing/playing-with-pixels-javascript-processing/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 21:22:02 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[abstract]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[experimental]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascipt]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[visuals]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=21068</guid>
		<description><![CDATA[Here is a portfolio of a french web designer named Gildas Paubert experimenting with processing js. (go in the « play mode ! » section).Continue reading.... Playing with Pixels [Javascript, Processing]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2012/01/Gildas-Paubert-03.png"><img class="alignnone size-large wp-image-21071" title="Gildas Paubert 03" src="http://www.creativeapplications.net/wp-content/uploads/2012/01/Gildas-Paubert-03-640x287.png" alt="" width="640" height="287" /></a></p>
<p>Here is a portfolio of a french web designer named Gildas Paubert experimenting with processing js. (go in the « play mode ! » section).</p><p><a href="http://www.creativeapplications.net/processing/playing-with-pixels-javascript-processing/?utm_source=feed&utm_campaign=rss-mo-more&utm_medium=rss">Continue reading.... Playing with Pixels [Javascript, Processing]</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/processing/playing-with-pixels-javascript-processing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Resonate [Events]</title>
		<link>http://www.creativeapplications.net/events/resonate-events/</link>
		<comments>http://www.creativeapplications.net/events/resonate-events/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 10:31:52 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[belgrade]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[culture]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[resonate]]></category>
		<category><![CDATA[serbia]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=20632</guid>
		<description><![CDATA[We are happy to announce that after months of hard work, and even more to come, Resonate Festival has launched it&#8217;s full site and tickets are now available for purchase. ‘Resonate’ is an initiative by “Magnetic Field B” in collaboration with CreativeApplications.Net and Dom Omladine in Belgrade. It&#8217;s core aim is to set a new standard in the arts industry by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/resonate_day_landscape1.png"><img class="alignnone size-large wp-image-20657" title="External link - Resonate.io" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/resonate_day_landscape1-e1323426387651-640x305.png" alt="External link - Resonate.io" width="640" height="305" /></a></p>
<p>We are happy to announce that after months of hard work, and even more to come, Resonate Festival has launched it&#8217;s <a href="http://resonate.io/">full site</a> and <a href="http://resonate.io/2012/register#tickets">tickets</a> are now available for purchase.</p>
<p>‘Resonate’ is an initiative by “Magnetic Field B” in collaboration with <a href="http://www.creativeapplications.net/" target="_blank">CreativeApplications.Net</a> and <a href="http://www.domomladine.org/" target="_blank">Dom Omladine</a> in Belgrade. It&#8217;s core aim is to set a new standard in the arts industry by creating a new event platform for inspiration, networking, information, knowledge sharing and education. It brings together distinguished, world class artists, with an opportunity of participating in a forward-looking debate on the position of technology in art and culture. But Resonate is also much more than just a festival, expert seminar or exhibition of visual arts. It is a project broad enough to encompass areas ranging from software engineering to visual arts theory, but also to create a bridge between culturally separated segments of the artistic and intellectual scene through a comprehensive, multidisciplinary approach.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall3.jpg"><img class="alignnone size-thumbnail wp-image-20643" title="DomOmladine_MainHall3" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall3-160x160.jpg" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall2.jpg"><img class="alignnone size-thumbnail wp-image-20642" title="DomOmladine_MainHall2" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall2-160x160.jpg" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall.jpg"><img class="alignnone size-thumbnail wp-image-20641" title="DomOmladine_MainHall" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_MainHall-160x160.jpg" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_americana.jpg"><img class="alignnone size-thumbnail wp-image-20637" title="DomOmladine_americana" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/DomOmladine_americana-160x160.jpg" alt="" width="160" height="160" /></a></p>
<p>Taking place in Belgrade, Serbia from 16th &#8211; 17th March 2012, the event will give visitors an overview of current situation in the fields of music, visual arts and digital culture. Guest artists, lecturers and other participants have been chosen to represent the cutting edge of the contemporary creative industry in Europe. Interactivity is the key feature of contemporary communications and as a festival of new media, Resonate will be structured in such a way to reflect this fact on several levels. First of all, that means the interaction between audience and authors, or audience and art forms, as visitors of the festival will be active participants and will have contact with the authors through workshops, lectures, multimedia installations and the music program.</p>
<p>- 20 speakers from Europe, Asia and North America<br />
- Collaborations with both national and international educational institutions<br />
- Talks, workshops, panel discussions, performances and concerts<br />
- Day and night programme (DJ Sets, Live Audio/Visual Performances and Concerts)<br />
- In the heart of europe, city of history and culture – Belgrade</p>
<p>Featuring Nicholas Felton, Josh Nimoy, Jer Thorp, Greg J. Smith, Regine Debatty, Champagne Valentine, Niklas Roy, Benjamin Gaulon, Martial Geoffre-Rouland, Karsten Schmidt, FIELD, LAb[au], Rafaël Rozendaal, United Visual Artists, Written Images, Jürg Lehni, WARP, onedotzero and many more.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/NicholasFelton.jpg"><img class="alignnone size-thumbnail wp-image-20652" title="NicholasFelton" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/NicholasFelton-160x160.jpg" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/JerThorp.png"><img class="alignnone size-thumbnail wp-image-20653" title="JerThorp" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/JerThorp-160x160.png" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/Jürg-Lehni.jpg"><img class="alignnone size-thumbnail wp-image-20645" title="Jürg Lehni" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/Jürg-Lehni-160x160.jpg" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/onedotzero.jpg"><img title="onedotzero" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/onedotzero-160x160.jpg" alt="" width="160" height="160" /></a></p>
<p>&#8230;and this is just the beginning. Yet to announce are night event details including 2 headlining acts, audio-visual performances, DJs, workshops, screenings, panels and more. You will not be disappointed!</p>
<p>Tickets are now on sale (Only €40.00). Book now and save 50% on the door price. Only available for few weeks and in limited numbers.</p>
<p>Dates: 16th &#8211; 17th March 2012<br />
Location: <a href="http://resonate.io/2012/location">Belgrade, Serbia </a></p>
<p><a href="http://resonate.io/2012/register#tickets"><img class="alignnone size-full wp-image-20634" title="resonate_buynow" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/resonate_buynow.png" alt="" width="87" height="34" /></a></p>
<p>Stay up to date with developments by following us on <a href="https://www.facebook.com/resonate.io" target="_blank">Facebook</a> | <a href="http://www.twitter.com/resonate_io" target="_blank">Twitter</a> or <a href="http://resonate.io/2012/night" target="_blank">Subscribe to Newsletter</a>.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/TRON_GFX_PC_03.jpg"><img class="alignnone size-large wp-image-20660" title="TRON_GFX_PC_03" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/TRON_GFX_PC_03-640x538.jpg" alt="" width="640" height="538" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/FIELD.jpg"><img class="alignnone size-large wp-image-20648" title="FIELD" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/FIELD-640x426.jpg" alt="" width="640" height="426" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/KarstenSchmidt.jpg"><img class="alignnone size-full wp-image-20644" title="KarstenSchmidt" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/KarstenSchmidt.jpg" alt="" width="640" height="480" /></a><iframe src="http://player.vimeo.com/video/22440363?title=0&amp;byline=0&amp;portrait=0" frameborder="0" width="640" height="360"></iframe><a href="http://www.creativeapplications.net/wp-content/uploads/2011/12/Rafaël-Rozendaal.jpg"><img class="alignnone size-large wp-image-20647" title="Rafaël Rozendaal" src="http://www.creativeapplications.net/wp-content/uploads/2011/12/Rafaël-Rozendaal-640x304.jpg" alt="" width="640" height="304" /></a><iframe src="http://player.vimeo.com/video/3764456?title=0&amp;byline=0&amp;portrait=0" frameborder="0" width="640" height="480"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/events/resonate-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upverter [News]</title>
		<link>http://www.creativeapplications.net/news/upverter-news/</link>
		<comments>http://www.creativeapplications.net/news/upverter-news/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 22:33:20 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WebApp]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=20374</guid>
		<description><![CDATA[Upverter is a web service, similar to GitHub that allows you to discover, share and work on hardware. Taking full advantage of HTML5, the included editor has all the basics you have come to expect such as undo, redo, rotating, versioning, and sharing designs. Create your schematics on an infinitely large canvas and organize your designs [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/upverter_visual.png"><img class="alignnone size-full wp-image-20380" title="upverter_visual" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/upverter_visual.png" alt="" width="640" height="210" /></a></p>
<p>Upverter is a web service, similar to GitHub that allows you to discover, share and work on hardware.</p>
<p>Taking full advantage of HTML5, the included editor has all the basics you have come to expect such as undo, redo, rotating, versioning, and sharing designs. Create your schematics on an infinitely large canvas and organize your designs how you want to. Also included is their crowd-sourced part library to choose your parts, or add your own. Get insight into what parts are the most popular and cost efficient.</p>
<p>Here is an embeded drawing of Arduino-Uno:</p><p><a href="http://www.creativeapplications.net/news/upverter-news/?utm_source=feed&utm_campaign=rss-mo-more&utm_medium=rss">Continue reading.... Upverter [News]</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/news/upverter-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SpellTower [iPad, Games, openFrameworks]</title>
		<link>http://www.creativeapplications.net/games/spelltower-ipad-games-openframeworks/</link>
		<comments>http://www.creativeapplications.net/games/spelltower-ipad-games-openframeworks/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:43:38 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[openFrameworks]]></category>
		<category><![CDATA[experimental]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[making of]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[words]]></category>
		<category><![CDATA[Zach Gage]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=20271</guid>
		<description><![CDATA[SpellTower is a new iPad game by Zach Gage, the name behind the titles such as Halcyon, Bit Pilot, and Unify. SpellTower is a word puzzle game that combines the traditional word making with Tetris style block physics. In the game, the task is to make long words or use bonus tiles to clear extra [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/spelltower01.png"><img class="alignnone size-large wp-image-20285" title="spelltower01" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/spelltower01-640x320.png" alt="" width="640" height="320" /></a></p>
<p>SpellTower is a new iPad game by Zach Gage, the name behind the titles such as <a href="http://www.creativeapplications.net/games/halcyon-ipad-games-of-preview/">Halcyon</a>, <a href="http://www.creativeapplications.net/iphone/bit-pilot-iphone-games-preview/">Bit Pilot</a>, and <a href="http://www.creativeapplications.net/games/unify-iphone-preview/">Unify</a>. SpellTower is a word puzzle game that combines the traditional word making with Tetris style block physics. In the game, the task is to make long words or use bonus tiles to clear extra letters from the screen. As you work, more word tiles rise from the bottom of the screen, and it&#8217;ll take all of your word wits and tactical know-how to keep them down. If any of the letters make it to the top row, it&#8217;s game over. After playing the game for few days now, I asked Zach what was the inspiration and the reasons for making SpellTower..</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.35.21.png"><img class="alignnone size-thumbnail wp-image-20279" title="Screenshot 2011.11.03 01.35.21" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.35.21-160x160.png" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.36.27.png"><img class="alignnone size-thumbnail wp-image-20280" title="Screenshot 2011.11.03 01.36.27" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.36.27-160x160.png" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.37.19.png"><img class="alignnone size-thumbnail wp-image-20281" title="Screenshot 2011.11.03 01.37.19" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.03-01.37.19-160x160.png" alt="" width="160" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.04-00.52.29.png"><img class="alignnone size-thumbnail wp-image-20283" title="Screenshot 2011.11.04 00.52.29" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/Screenshot-2011.11.04-00.52.29-160x160.png" alt="" width="160" height="160" /></a></p><p><a href="http://www.creativeapplications.net/games/spelltower-ipad-games-openframeworks/?utm_source=feed&utm_campaign=rss-mo-more&utm_medium=rss">Continue reading.... SpellTower [iPad, Games, openFrameworks]</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/games/spelltower-ipad-games-openframeworks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TSUMIKI [c++, Objects]</title>
		<link>http://www.creativeapplications.net/objects/tsumiki-c-objects/</link>
		<comments>http://www.creativeapplications.net/objects/tsumiki-c-objects/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 17:34:03 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[Objects]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[opencv]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[projection]]></category>
		<category><![CDATA[projection mapping]]></category>
		<category><![CDATA[toys]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=20176</guid>
		<description><![CDATA[Created by a newly formed sister company of Aircord.jp: PPP, TSUMIKI is a new series of toys that incorporate computer vision to both recognise physical blocks and project content onto them. The idea behind PPP (Permanent Play Project) is to explore new ways of “playing” for the next generation.  They rearrange longtime beloved toys such as [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/31837251?title=0&amp;byline=0&amp;portrait=0&amp;color=D8DF00" frameborder="0" width="640" height="360"></iframe></p>
<p>Created by a newly formed sister company of Aircord.jp: PPP, TSUMIKI is a new series of toys that incorporate computer vision to both recognise physical blocks and project content onto them.</p>
<p>The idea behind PPP (Permanent Play Project) is to explore new ways of “playing” for the next generation. <em> They rearrange longtime beloved toys such as blocks to bring a whole new value to them.</em> In TSUMIKI, various forest animals appear on the blocks according to the ways you stack them. When two sets of blocks are placed close to each other, it would be in the communication mode, where the animals greet to each other or play together. You can also play with numbers using the toy blocks. When you place the blocks in an order, a number would appear each time at random and their equation is projected on the blocks.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/tsumiki03.png"><img title="tsumiki03" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/tsumiki03-320x179.png" alt="" width="320" height="179" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/11/tsumiki05.png"><img class="alignnone size-medium wp-image-20183" title="tsumiki05" src="http://www.creativeapplications.net/wp-content/uploads/2011/11/tsumiki05-320x178.png" alt="" width="320" height="179" /></a></p><p><a href="http://www.creativeapplications.net/objects/tsumiki-c-objects/?utm_source=feed&utm_campaign=rss-mo-more&utm_medium=rss">Continue reading.... TSUMIKI [c++, Objects]</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/objects/tsumiki-c-objects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generative Art: A Practical Guide [Books, Processing]</title>
		<link>http://www.creativeapplications.net/processing/generative-art-a-practical-guide-books-processing/</link>
		<comments>http://www.creativeapplications.net/processing/generative-art-a-practical-guide-books-processing/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 16:09:20 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[cellular automata]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[emergence]]></category>
		<category><![CDATA[fractals]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[Matt Pearson]]></category>
		<category><![CDATA[perlin]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=18638</guid>
		<description><![CDATA[Generative Art: A Practical Guide using Processing is a book by Matt Pearson, published by Manning. The book offers a guide to creating generative graphics for print, video and the web whilst at the same time addressing the philosophy and practice of using a programming language as an artistic tool. Included is a beginners guide to Processing, and applied [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01x.png"><img class="alignnone size-full wp-image-18653" title="GenerativeArt01x" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01x.png" alt="" width="640" height="478" /></a></p>
<p><em>Generative Art: A Practical Guide using Processing</em> is a book by Matt Pearson, published by Manning. The book offers a guide to creating generative graphics for print, video and the web whilst at the same time addressing the philosophy and practice of using a programming language as an artistic tool. Included is a beginners guide to <em>Processing</em>, and applied tutorials on subjects such as Perlin Noise, Randomness, Fractals, Emergence, Agent Oriented Programming, Three Dimensional Drawing and Cellular Automata. The book also features the work of Robert Hodgin, Jared Tarbell, Aaron Koblin, Casey Reas and many more of the finest contemporary generative artists.</p>
<p>The book starts with foreword by Marius Watz giving a very good overall introduction to computers in the arts especially the history of processing Processing. This is followed by Matt setting context for the reader, giving his background and how his interest in generative art developed. My favorite &#8220;about this book&#8221; section, positions the book in terms of how it should be read and making clear that by no means the book attempts to teach you how to be an artist, but rather how to think about the process:</p>
<p><em>If this book were to be just a collection of recipes for you to follow, to produce certain aesthetically pleasing results, it would be missing the point—not to mention hugely arrogant. The appreciation of art is entirely subjective, so if I were to declare that there is a right way to go about creating art, I would be in need of a slap. </em></p>
<p>Following chapters are about methods and algorithms, both existing and about creating your own. Very much about building a generative machine, Matt has a great skill in making it all sound very easy. This leaves you wanting to launch Processing and begin playing right away. Whether this is related to Matt just being British but the book is filled with small fragments of humor, inserted at places where things are just about to get serious and complicated. Matt&#8217;s tone makes it an easy and fun read and where other books of this nature tend to be either slightly too technical or conceptual, Matt seems to have found the perfect middle ground, being both practical but also pointing out the technical and conceptual issues that should be addressed. This book will by no means provide you with great technical knowledge or set a conceptual ground for your work. Instead, you will quickly become accustomed with the basic principles and algorithms used in the making of generative art together with most certain desire to learn more.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt04a.jpg"><img class="alignnone size-medium wp-image-18660" title="GenerativeArt04a" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt04a-320x320.jpg" alt="" width="320" height="320" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt04b.jpg"><img class="alignnone size-medium wp-image-18661" title="GenerativeArt04b" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt04b-320x320.jpg" alt="" width="320" height="320" /></a></p>
<p>If you are new to creative code and have always been interested in how some of these images have been created, Generative Art: A Practical Guide is a fantastic start. Also those that have some programming skills may uncover some techniques that have not been apparent before.</p>
<p><em>There is no right or wrong way to be a generative artist. There are no rules or recipes. Generative art is about the organic, the emergent, the beautiful, the imprecise, and the unexpected. It’s about exploring these within a world of logic and precise mechanics. This delightful paradoxicality makes it an almost Zen approach to computing: playful and organic, free of restraint, and inviting a natural flow. </em></p>
<p>Contents:</p>
<p><em>• Introduction to the principles of algorithmic art</em><br />
<em> • Brief Processing language tutorial</em><br />
<em> • Establishing artistic “ground rules” for a new work</em><br />
<em> • Using random, semi-random, emergent and fractal processes</em><br />
<em> • Finding fresh approaches to the discipline of programming</em><br />
<em> • 32-page full-color section of beautiful artwork</em></p>
<p>Generative Art: A Practical Guide using Processing is available from:  <a href="http://www.amazon.com/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.com</a>, <a href="http://www.amazon.co.uk/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.co.uk</a>, <a href="http://www.amazon.ca/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.ca</a>, <a href="http://www.amazon.cn/mn/detailApp/ref=sr_1_1?_encoding=UTF8&amp;s=books&amp;qid=1288996470&amp;asin=1935182625&amp;sr=8-1" target="_blank">amazon.cn</a>, <a href="http://www.amazon.fr/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.fr</a>,<a href="http://www.amazon.de/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.de</a>, <a href="http://www.amazon.co.jp/Generative-Art-Matt-Pearson/dp/1935182625/" target="_blank">amazon.co.jp</a>, <a href="http://www.manning.com/pearson/" target="_blank">Manning (eBook)</a>, <a href="http://www.bulkbuybooks.co.uk/scripts/product.asp?ref=202672" target="_blank">bulkbuy discounts</a></p>
<p>+ Every print copy includes the offer of a free eBook (PDF) upon registering your book with Manning &#8211; great for having it on your iPhone/iPad/Android device for on the go.</p>
<p>Free content + source code of the examples featured in the book is available on <a href="http://zenbullets.com/blog/?page_id=799">Matt&#8217;s website</a>.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01b1.jpg"><img class="alignnone size-medium wp-image-18672" title="GenerativeArt01b" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01b1-320x320.jpg" alt="" width="320" height="320" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01a.jpg"><img class="alignnone size-medium wp-image-18652" title="GenerativeArt01a" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt01a-320x320.jpg" alt="" width="320" height="320" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt05b.jpg"><img title="GenerativeArt05b" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt05b-320x320.jpg" alt="" width="320" height="320" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt05a.jpg"><img title="GenerativeArt05a" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt05a-320x320.jpg" alt="" width="320" height="320" /></a></p>
<h2>Giveaway</h2>
<p>People at Manning were kind to send us an additional copy to give away to our readers. <del>All you have to do is tweet this post with comment by clicking on the link below. Best comment will be selected by Matt and myself and one lucky winner will receive the book (P&amp;P included). Contest now closed. </del></p>
<p style="text-align: center;"><del></del>Winner is <a href="http://twitter.com/#!/bigrichardc" target="_blank">Richard</a> from Birmingham.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.creativeapplications.net/wp-content/uploads/2010/05/twettthisclosed.png" alt="" width="143" height="43" /></p>
<p style="text-align: center;">(Make sure you follow <a href="http://twitter.com/creativeapps">@creativeapps</a> so we can DM you if you are chosen)</p>
<p style="text-align: center;"><del>1 Winner will be chosen by Matt and Filip on Thursday 25th August.</del></p>
<h2>Conditions:</h2>
<p>1. Postage and Packing is included. We just need your address.</p>
<p>2. Competition is open to everyone and anyone but you must be over 18 years of age. There will be a total of ONE winner for this competition.</p>
<p>3. Winner will be selected by Matt and Filip.</p>
<p>4. Winner will be contacted on twitter to provide their full name and postal address. If they wish to pass on the book to another person, we will need their name and postal address. If the winner does not respond by the following week we will pick another winner.</p>
<p>5. You can post as many entries (tweets) as you like.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt06b.jpg"><img class="alignnone size-full wp-image-18665" title="GenerativeArt06b" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt06b.jpg" alt="" width="640" height="640" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt06a.jpg"><img class="alignnone size-full wp-image-18664" title="GenerativeArt06a" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt06a.jpg" alt="" width="640" height="640" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt7.jpg"><img class="alignnone size-medium wp-image-18670" title="GenerativeArt7" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt7-320x160.jpg" alt="" width="320" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt8.jpg"><img class="alignnone size-medium wp-image-18669" title="GenerativeArt8" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt8-320x160.jpg" alt="" width="320" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt9.jpg"><img class="alignnone size-medium wp-image-18668" title="GenerativeArt9" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt9-320x160.jpg" alt="" width="320" height="160" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt10.jpg"><img class="alignnone size-medium wp-image-18667" title="GenerativeArt10" src="http://www.creativeapplications.net/wp-content/uploads/2011/08/GenerativeArt10-320x160.jpg" alt="" width="320" height="160" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/processing/generative-art-a-practical-guide-books-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SMS to Paper Airplanes [Processing]</title>
		<link>http://www.creativeapplications.net/processing/sms-to-paper-airplanes-processing/</link>
		<comments>http://www.creativeapplications.net/processing/sms-to-paper-airplanes-processing/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 16:35:05 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[Christian Groß]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[potsdam]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=18052</guid>
		<description><![CDATA[SMS to Paper Airplanes is a project by Christian Groß realised within a class called „program development“ at the university of applied science in Potsdam. The task was to translate an existing data set into a new audio/visual medium, using Processing. Christian visualized sms messages using physical airplanes as an analogy. The properties of airplanes are defined [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/07/100-airplanes-02.jpg"><img class="alignnone size-large wp-image-18056" title="100-airplanes-02" src="http://www.creativeapplications.net/wp-content/uploads/2011/07/100-airplanes-02-640x345.jpg" alt="" width="640" height="345" /></a></p>
<p>SMS to Paper Airplanes is a project by Christian Groß realised within a class called „program development“ at the university of applied science in Potsdam. The task was to translate an existing data set into a new audio/visual medium, using Processing. Christian visualized sms messages using physical airplanes as an analogy. The properties of airplanes are defined by the direction of message, the length, its size and the amount of positive emotional words are represented within the amounts of folds.</p><p><a href="http://www.creativeapplications.net/processing/sms-to-paper-airplanes-processing/?utm_source=feed&utm_campaign=rss-mo-more&utm_medium=rss">Continue reading.... SMS to Paper Airplanes [Processing]</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/processing/sms-to-paper-airplanes-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guide to Meshes In Cinder [Cinder, Tutorials]</title>
		<link>http://www.creativeapplications.net/tutorials/guide-to-meshes-in-cinder-cinder-tutorials/</link>
		<comments>http://www.creativeapplications.net/tutorials/guide-to-meshes-in-cinder-cinder-tutorials/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 08:57:06 +0000</pubDate>
		<dc:creator>Joshua Noble</dc:creator>
				<category><![CDATA[cinder]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[meshes]]></category>
		<category><![CDATA[polygon]]></category>
		<category><![CDATA[texture]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vbo]]></category>
		<category><![CDATA[vertex]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=15565</guid>
		<description><![CDATA[Introduction Written by Joshua Noble, with images by Robert Hodgin This article is going to cover two things in great detail: vertices and meshes and how they are handled in Cinder. There are a few different names for things that may be new to you in this tutorial which I&#8217;ll lay out for you right at the [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p><em>Written by <a href="http://thefactoryfactory.com/">Joshua Noble</a>, with images by <a href="http://roberthodgin.com/">Robert Hodgin</a></em></p>
<p>This article is going to cover two things in great detail: vertices and meshes and how they are handled in Cinder. There are a few different names for things that may be new to you in this tutorial which I&#8217;ll lay out for you right at the beginning: vertices, mesh, TriMesh, VboMesh, and VBOs. If any of those are already familiar to you and you simply want implementation details on how they work, feel free to skip ahead or around, I won&#8217;t be offended. For those of you who want more background, we&#8217;ll proceed in an orderly fashion.<br />
So, let&#8217;s begin at the beginning: the vertex. In Cinder we use the OpenGL coordinate system which is a right-handed system. Initially the world is oriented at the upper left hand corner of your screen, so the x Axis points right, y Axis points downward, z Axis points into the screen (away from the user). A vertex is a point in geometrical shape, or, a vertex is a point in 3D space that has x, y, and z properties that determine where it is in relation to the 0, 0, 0 point (you can think of this as the center) of the world. For instance, a vertex with the values 100, 100, 100, describes a location 100 pixels to the right on the x axis, down on the y axis, and back on the z axis from the origin of the world in which it is located. In your Cinder application, unless you change it, the world is oriented at the upper left hand corner of your screen. All shapes are the result of the connections between vertices. So, a line is made up of the connections between two vertices, a pyramid is a construction made of the connections between five vertices, a cube is made up of the connections between eight vertices.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/line_pyramid_cube.gif"><img class="alignnone size-large wp-image-15566" title="line_pyramid_cube" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/line_pyramid_cube-640x196.gif" alt="" width="640" height="196" /></a></p>
<p>What do these vertices look like in code? Something like this:</p>
<p><code><br />
gl::vertex( Vec3f(300, 100, 0) ); // creates an OpenGL vertex from a Vec3f<br />
</code></p>
<p>Those vertices are passed to your graphics card and your graphics card fill in the spaces in between them in a processing usually called &#8220;the rendering pipeline&#8221;. The rendering pipeline goes more or less like this:<br />
1. Say how you&#8217;re going to connect all the points.<br />
2. Make some points.<br />
3. Say that you&#8217;re done making points.<br />
Saying it in code, and more specficially in Cinder code, looks like this:</p>
<p><code><br />
glBegin(GL_QUAD_STRIP); // start drawing<br />
gl::vertex(Vec3f(20, 20, 0)); // repeated a lot of times with different positions<br />
glEnd(); // stop drawing<br />
</code></p>
<p>You may be thinking: &#8220;I&#8217;ll just make eight vertices and voila: a cube.&#8221; Not so quick. There&#8217;s a hitch and that hitch is that the OpenGL renderer has different ways of connecting the vertices that you pass to it and none are as efficient as to only need eight vertices to create a cube. You&#8217;ve probably seen a version of the following image somewhere before:<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/primitives_new.gif"><img class="alignnone size-large wp-image-15567" title="primitives_new" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/primitives_new-640x269.gif" alt="" width="640" height="269" /></a></p>
<p>Creating eight vertices and expecting the GL_QUAD_STRIP to connect them is going to lead to something looking like this:<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/incorrect_cube.gif"><img class="alignnone size-large wp-image-15568" title="incorrect_cube" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/incorrect_cube-640x271.gif" alt="" width="640" height="271" /></a></p>
<p>Why is that you ask? Well, first off because we used the GL_QUAD_STRIP but it&#8217;s also because there isn&#8217;t an easy way to tell your graphics card that you want to connect all those points into a cube. Generally you have to create your points to fit the drawing mode that you&#8217;ve selected because of what&#8217;s called &#8220;winding&#8221;. A vertex gets connected to another vertex in the order that the mode does it&#8217;s winding and this means that you might need multiple vertices in a given location to create the shape you want. The cube, for example, requires eighteen vertices, not the eight that you would expect. If you note the order of vertices in the GL chart above you&#8217;ll see that all of them use their vertices slightly differently (in particular you should make note of the GL_TRIANGLE_STRIP example). Drawing a shape requires that you keep track of which drawing mode is being used and which order your vertices are declared in. If you&#8217;re thinking: &#8220;it would be nice if there were an abstraction layer for this&#8221; you&#8217;re thinking right. Enter the mesh, which is really just an abstraction of the vertex and drawing mode that we started with but which has the added bonus of managing the draw order for you. That may seem insignificant at first, but it provides some real benefits when working with complex geometry.</p>
<h2>TriMesh</h2>
<p>The TriMesh represents a series of vertices connected with the same connection algorithm as the GL_TRIANGLE_STRIP. It&#8217;s a convienent way to keep track of multiple complex objects, draw and scale them easily, and manage which vertices create which faces of a model. Let&#8217;s get the simplest example out the way first, drawing a square consisting of two triangles. This requires, as you&#8217;d imagine, four vertices that represent the vertices of each triangle.</p>
<p><code><br />
// Position and Color for the four corners<br />
mesh.appendVertex( Vec3f( 10, 10, 0 ) );<br />
mesh.appendColorRGB( Color( 1, 0, 0 ) );<br />
mesh.appendVertex( Vec3f( 10, 300, 0 ) );<br />
mesh.appendColorRGB( Color( 0, 1, 0 ) );<br />
mesh.appendVertex( Vec3f( 300, 300, 0 ) );<br />
mesh.appendColorRGB( Color( 0, 0, 1 ) );<br />
mesh.appendVertex( Vec3f( 300, 10, 0 ) );<br />
mesh.appendColorRGB( Color( 0, 0, 0 ) );</p>
<p>// Indices for each of the four corners<br />
int vIdx0 = mesh.getNumVertices() - 4;<br />
int vIdx1 = mesh.getNumVertices() - 3;<br />
int vIdx2 = mesh.getNumVertices() - 2;<br />
int vIdx3 = mesh.getNumVertices() - 1;</p>
<p>// Two triangles to create our square<br />
mesh.appendTriangle( vIdx0, vIdx1, vIdx2 );<br />
mesh.appendTriangle( vIdx0, vIdx2, vIdx3 );<br />
</code></p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_squares.jpg"><img class="alignnone size-large wp-image-15569" title="sample_squares" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_squares-640x229.jpg" alt="" width="640" height="229" /></a></p>
<p>So far, so good. Now, let&#8217;s extend that a little further and build something in 3D. A simple cube should suffice to demonstrate how the mesh connects all the vertices that it contains. At first glance, the next block of code (140 lines) might seem daunting, but all we are doing is repeating the previous code block 6 times, once per side. Since each side is comprised of 2 triangles, we draw a total of 12 triangles.<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/cubes.jpg"><img class="alignnone size-large wp-image-15570" title="cubes" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/cubes-640x310.jpg" alt="" width="640" height="310" /></a></p>
<p><code><br />
// Create the points of our cube<br />
Vec3f v0(-100,-100,-100);<br />
Vec3f v1( 100,-100,-100);<br />
Vec3f v2( 100, 100,-100);<br />
Vec3f v3(-100, 100,-100);<br />
Vec3f v4(-100,-100, 100);<br />
Vec3f v5( 100,-100, 100);<br />
Vec3f v6( 100, 100, 100);<br />
Vec3f v7(-100, 100, 100);</p>
<p>// Create the colors for each vertex<br />
Color c0( 0, 0, 0 );<br />
Color c1( 1, 0, 0 );<br />
Color c2( 1, 1, 0 );<br />
Color c3( 0, 1, 0 );<br />
Color c4( 0, 0, 1 );<br />
Color c5( 1, 0, 1 );<br />
Color c6( 1, 1, 1 );<br />
Color c7( 0, 1, 1 );</p>
<p>Vec3f faces[6][4] = { /* Vertices for the 6 faces of a cube. */<br />
{v0, v1, v2, v3}, {v3, v2, v6, v7}, {v7, v6, v5, v4},<br />
{v4, v5, v1, v0}, {v5, v6, v2, v1}, {v7, v4, v0, v3} };</p>
<p>Color colors[6][4] = { /* colors for each vertex of the cube. */<br />
{c0, c1, c2, c3}, {c3, c2, c6, c7}, {c7, c6, c5, c4},<br />
{c4, c5, c1, c0}, {c5, c6, c2, c1}, {c7, c4, c0, c3} };</p>
<p>for (int i = 0; i &lt; 6; i++)<br />
{</p>
<p>mesh.appendVertex(faces[i][0]);<br />
mesh.appendColorRGB(colors[i][0]);<br />
mesh.appendVertex(faces[i][1]);<br />
mesh.appendColorRGB(colors[i][1]);<br />
mesh.appendVertex(faces[i][2]);<br />
mesh.appendColorRGB(colors[i][2]);<br />
mesh.appendVertex(faces[i][3]);<br />
mesh.appendColorRGB(colors[i][3]);</p>
<p>int numberVertices = mesh.getNumVertices();</p>
<p>mesh.appendTriangle( numberVertices - 4, numberVertices - 3, numberVertices - 2 );<br />
mesh.appendTriangle( numberVertices - 4, numberVertices - 2, numberVertices - 1 );</p>
<p>}<br />
</code></p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_cube.jpg"><img class="size-full wp-image-15571 alignnone" title="sample_cube" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_cube.jpg" alt="" width="340" height="340" /></a></p>
<p>Accessing the vertices in the TriMesh is a little different than you might imagine it at first, because you can&#8217;t directly access the vertices of the mesh and then alter them. Instead, you make a copy of the vertices using getVertices(), which returns a Vector of the vertices contained by the TriMesh as Vec3f objects and then modifying the values in that vector. To update the vertices in the mesh itself you then need to clear the mesh and append all the vertices again. The same goes for any modifications to the RGB color array as well. Look at the following:</p>
<p><code><br />
void TriMeshSampleApp::update()<br />
{<br />
if( mMesh.getNumVertices() == 0 ) return;</p>
<p>// store all the mesh information</p>
<p>std::vector col = mMesh.getColorsRGB();<br />
std::vector vec = mMesh.getVertices();</p>
<p>int i, j;<br />
i = mMesh.getNumVertices();<br />
j = 0;</p>
<p>mMesh.clear();</p>
<p>// something to add a little movement<br />
float inc = sin( getElapsedSeconds() );</p>
<p>while(j &lt; i)<br />
{<br />
// alter the positions array to get a little dynamism<br />
vec.at(j).x -= inc;<br />
vec.at(j+1).x += inc;<br />
vec.at(j+2).x += inc*2.0f;<br />
vec.at(j+3).x -= inc*2.0f;</p>
<p>// now replace it in the mesh<br />
mMesh.appendVertex( vec.at(j));<br />
mMesh.appendColorRGB( col.at(j) );<br />
mMesh.appendVertex( vec.at(j+1));<br />
mMesh.appendColorRGB( col.at(j+1) );<br />
mMesh.appendVertex( vec.at(j+2));<br />
mMesh.appendColorRGB( col.at(j+2) );<br />
mMesh.appendVertex( vec.at(j+3));<br />
mMesh.appendColorRGB( col.at(j+3) );</p>
<p>int vIdx0 = mMesh.getNumVertices() - 4;<br />
int vIdx1 = mMesh.getNumVertices() - 3;<br />
int vIdx2 = mMesh.getNumVertices() - 2;<br />
int vIdx3 = mMesh.getNumVertices() - 1;</p>
<p>mMesh.appendTriangle( vIdx0, vIdx1, vIdx2 );<br />
mMesh.appendTriangle( vIdx0, vIdx2, vIdx3 );</p>
<p>// go to the next triangle pair<br />
j+=4;<br />
}<br />
}<br />
</code></p>
<p style="text-align: left;">The result?<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_cube2.jpg"><img class="size-full wp-image-15572 alignnone" title="sample_cube2" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/sample_cube2.jpg" alt="" width="446" height="360" /></a></p>
<p>Want to use a gl::Texture to texture the cube? Not so difficult. First, you need to set the texture co-ordinates of each vertex in the TriMesh. This requires that you use texture coordinates, not space coordinates or pixel co-ordinates. So, you may think your image is 500 pixels high and 500 pixels wide, but texture co-ordinates say that your texture is 1&#215;1 with what you think of as upper-left corner (0, 0), still being (0, 0), but the bottom-right corner being (1,1). All the values between the 0, 0 and 1,1 points are scalar, meaning that 0.5 will be the midpoint of the image. So if you assign the texture co-ordinate 0.5, 0.5 to a vertex, the middle of the image will appear at that point. The picture below will hopefully help clarify this:<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/textures.jpg"><img class="size-large wp-image-15573 alignnone" title="textures" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/textures-640x220.jpg" alt="" width="640" height="220" /></a></p>
<p>So, now, how to put our Trimesh and gl::Texture together? When creating the vertices using the appendVertex() and appendColorRGB() methods, use the appendTexCoord() method to create a texture co-ordinate. This indicates the location in the texture that you want to appear at that location in space:</p>
<p><code><br />
mesh.appendVertex(v0);<br />
mesh.appendColorRGB( Color(1, 0, 0) );<br />
mesh.appendTexCoord(Vec2f(0, 0));<br />
mesh.appendVertex(v1);<br />
mesh.appendColorRGB( Color(0, 0, 1) );<br />
mesh.appendTexCoord(Vec2f(1, 0));<br />
mesh.appendVertex(v2);<br />
mesh.appendColorRGB( Color(1, 0, 0) );<br />
mesh.appendTexCoord(Vec2f(1, 1));<br />
mesh.appendVertex(v3);<br />
mesh.appendColorRGB( Color(0, 1, 0) );<br />
mesh.appendTexCoord(Vec2f(0, 1));<br />
</code></p>
<p>Now, to apply a gl::Texture to this TriMesh, call gl::Texture bind(), draw your TriMesh, and then call gl::Texture unbind() and you&#8217;re done.</p>
<p><code><br />
tex.enableAndBind();<br />
gl::draw(mesh);<br />
tex.unbind();<br />
</code></p>
<p>You can even animate the positions of the texture coordinates by copying, modifying, and then re-appending them in the same way that the vertices and RGB coordinates were updated. But there&#8217;s more to the TriMesh than just a nice way to store all the vertices that you create because, let&#8217;s face it, lining up vertices is a drag and there are better and more fun ways to make vertices, for instance, using a 3d modeling program. To that end, you can import and export OBJ files. So, in my favorite 3d modeling program (the opensource and free one) Blender, I&#8217;ll create a classic platonic solid, the isodecahedron, and then export it as an .obj file:<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/icosahedron.jpg"><img class="alignnone size-large wp-image-15574" title="icosahedron" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/icosahedron-640x330.jpg" alt="" width="640" height="330" /></a></p>
<p>Now I can import it using an instance of the ObjLoader class like so:</p>
<p><code><br />
ObjLoader loader( loadResource( SOLID ) );<br />
loader.load( *mesh );<br />
</code></p>
<p>and draw it to the screen by passing it to gl::draw():</p>
<p><code><br />
gl::draw(mesh);<br />
</code></p>
<p>Here it is with some random colors applied to it:<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/icosahedrons.jpg"><img class="alignnone size-large wp-image-15575" title="icosahedrons" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/icosahedrons-640x218.jpg" alt="" width="640" height="218" /></a></p>
<p>You can even manipulate it and export it using the TriMesh::writeObject() method:</p>
<p><code><br />
mesh.write( writeFileStream(meshFileName, true); );<br />
</code></p>
<p>Now, if you thought that was all there was to working with meshes in Cinder you would be wrong. As I mentioned earlier, the way that geometry is drawn on the graphics card is by sending points and telling the card how to connect those points. This might remind you a little of how the Textures work in OpenGL: load some data up there, draw it by referring to it using its TextureId. So then, naturally you might wonder, what if we just stored the points on the card? Introducing the Vertex Buffer Object, aka VBO:</p>
<h2>VBO</h2>
<p>A VBO is a way of storing all of the data of vertex data on the graphics card. You&#8217;ve perhaps heard of Vertex Arrays and Display Lists and the VBO is similiar to both of these, but with a few advantages that we&#8217;ll go over very quickly. Vertex Arrays just let you store all the vertex data in an array on the client side, that is, on the CPU side and then send it to the graphics card when you&#8217;re ready to draw it. The downside of that is that you&#8217;re still storing the data on the client side and sending it over to the graphics card. So, instead of making all of our vertex data in what&#8217;s called &#8220;immediate mode&#8221;, which means between a glBegin() and glEnd() pair, you can just store vertex data in an arrays and you can draw geometric primitives by dereferencing the array elements with array indices. The Display List is a similar technique, using an array to store the created geometry, with the crucial difference that a Display List lives solely on the graphics card. This means that once you&#8217;ve created the vertex data for geometry, you can send it the graphics card and draw it simply by referencing the id of the stored data. The downside is that display lists can&#8217;t be modified. Once they&#8217;ve been sent to the card, you need to load them from the card, modify them, and then resend them to the card to see your changes applied. Since one of the conveniences of moving things to the graphics card is reducing the amount of traffic between the graphics card and the rest of your system. The VBO operates quite similarly to the Display List, with the advantage of allowing you to modify the geometry data on the graphics card without downloading all of it at once.</p>
<p>Now, since we&#8217;re focusing on Cinder, we&#8217;ll be focusing on the VboMesh class that Cinder uses to wrap the core OpenGL functionality. When you create a VboMesh, much like in the TriMesh, you need to decide whether the mesh is going to contain color information, texture coordinate information, but, there is another element to the VboMesh: whether the data is dynamic. Thius is particularly important because it determines whether you&#8217;re able to manipulate vertices in the mesh after creating it and it matters because using dynamic data means that the VboMesh will generate two copies of the data: one on the graphics card and one in the memory of your application. So, if you don&#8217;t need to update the data after it&#8217;s been loaded then you you don&#8217;t need to do anything special and if you do want to create dynamic data, you&#8217;ll need to create a gl::VboMesh::Layout object and pass it to the VboMesh. So, for instance, if you want static positions and static colors you would create a Layout object with those properties set on it, declare a VboMesh and then assign it to the result of a call to VboMesh(). This is because the VboMesh, like so many other things in Cinder, is a shared pointer, which means that it has to be created before you can use it, you can return it from a method without problems, and also that you don&#8217;t have to worry about deallocating the VboMesh once you&#8217;ve created it.<br />
Here&#8217;s one of the constructors for the VboMesh:</p>
<p><code><br />
VboMesh( size_t numVertices, size_t numIndices, Layout layout, GLenum primitiveType );<br />
</code></p>
<p>so that would be used like this:</p>
<p><code><br />
gl::VboMesh mesh;<br />
gl::VboMesh::Layout layout;<br />
layout.setStaticPositions();<br />
layout.setStaticColorsRGBA();<br />
mesh = gl::VboMesh( 24, 20, layout, GL_QUADS );<br />
</code></p>
<p>Now, the numVertices and numIndices need a little explanantion. You&#8217;ll recall from the TriMesh that the number of indices and the number of vertices aren&#8217;t directly correlated. You&#8217;ll almost always need to create more indices than vertices because there are more indices than discrete locations required for most geometry, but that depends on what kind of geometry you&#8217;re creating. This brings us to one of the more confusing elements of working with VboMesh::Layout, which is the idea of indices and dynamic indices in particular. The indices set the location of an Vec3f in the order of drawing elements. Remember how in the first example before introducing the TriMesh, you saw how the order that the vertices were created in affected how they were connected the other vertices? Well, the index for a vertex in the VboMesh works much the same way, indicating where the vertex is in relation to the other vertices and how it should be connected to them. In the graphic below the ways to draw a square using GL_QUADS is shown at the top and left and using GL_TRIANGLE_STRIP at the bottom and right.<br />
<a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/vbo_order.png"><img class="alignnone size-large wp-image-15577" title="vbo_order" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/vbo_order-640x325.png" alt="" width="640" height="325" /></a></p>
<p>Cinder always requires that you create the indices for a mesh before you create the positions for that mesh, because conceptually a vertice without a index can&#8217;t be properly integrated into the mesh and vice versa. The two modes of storing positions means that the process for working with VboMeshes that dynamic positions versus those that have static positions is slightly different. We&#8217;ll do the static first:</p>
<p><code><br />
gl::VboMesh::Layout layout;<br />
layout.setStaticIndices();<br />
layout.setDynamicColorsRGBA();<br />
layout.setStaticPositions();</p>
<p>int vertCount = 24;<br />
int quadCount = 6;<br />
mesh = gl::VboMesh(vertCount, quadCount * 4, layout, GL_QUADS);<br />
</code></p>
<p>When you&#8217;re using static positions you can simply assign positions using a vector of Vec3f objects and calling VboMesh::bufferPositions(). So, our VboMesh creation code looks like this, note the indices being assigned before the positions:</p>
<p><code><br />
vector indices;<br />
int i=0;<br />
while(i &lt; 24){<br />
indices.push_back(i);<br />
i++;<br />
}</p>
<p>mesh.bufferIndices(indices);</p>
<p>positions.push_back(Vec3f(100, 200, 1));<br />
positions.push_back(Vec3f( 200, 200, 1));<br />
positions.push_back(Vec3f( 200, 100, 1));<br />
positions.push_back(Vec3f(100, 100, 1));</p>
<p>positions.push_back(Vec3f( 200, 200, 1));<br />
positions.push_back(Vec3f( 200, 200, 100));<br />
positions.push_back(Vec3f( 200, 100, 100));<br />
positions.push_back(Vec3f( 200, 100, 1));</p>
<p>positions.push_back(Vec3f( 200, 200, 100));<br />
positions.push_back(Vec3f(100, 200, 100));<br />
positions.push_back(Vec3f(100, 100, 100));<br />
positions.push_back(Vec3f( 200, 100, 100));</p>
<p>positions.push_back(Vec3f(100, 200, 100));<br />
positions.push_back(Vec3f(100, 200, 1));<br />
positions.push_back(Vec3f(100, 100, 1));<br />
positions.push_back(Vec3f(100, 100, 100));</p>
<p>positions.push_back(Vec3f(100, 200, 100));<br />
positions.push_back(Vec3f( 200, 200, 100));<br />
positions.push_back(Vec3f( 200, 200, 1));<br />
positions.push_back(Vec3f(100, 200, 1));</p>
<p>positions.push_back(Vec3f(100, 100, 100));<br />
positions.push_back(Vec3f( 200, 100, 100));<br />
positions.push_back(Vec3f( 200, 100, 1));<br />
positions.push_back(Vec3f(100, 100, 1));</p>
<p>// now we can buffer positions<br />
mesh.bufferPositions(positions);<br />
</code></p>
<p>This creates the same old boring looking white cube. Until we update the colors. This requires retrieving the color values from the mesh and using an iterator to examine the values, which is a familiar pattern in Cinder. The VertexIter object is created to iterate over all the values in the mesh, you assign to the result of VboMesh::mapVertexBuffer() like so:</p>
<p><code><br />
void VboTutorial::update()<br />
{<br />
float g = sin(getElapsedSeconds());<br />
float b = cos(getElapsedSeconds());<br />
gl::VboMesh::VertexIter iter = mesh.mapVertexBuffer();<br />
for( int x = 0; x &lt; 24; ++x ) {<br />
//positions.at(x) *= 1.001;<br />
iter.setColorRGBA( ColorA( 1 - (g+b/3), g, b, 0.5) );<br />
++iter;<br />
}<br />
}<br />
</code></p>
<p>Dynamic positions are handled in the same way as dynamic colors. To create the dynamic positions for the simple cube in the VboMesh, setting up the VboMesh is going to look familiar, assigning the indices via a vector of uints, but the actual updating of the positions is going to look quite different because you can&#8217;t pass a position values into the VboMesh by using VboMesh::bufferPositions(). Instead, you create an VertexIter to iterate over and modify the positions:</p>
<p><code><br />
void VboTutorialApp::setup()<br />
{<br />
gl::VboMesh::Layout layout;<br />
layout.setStaticIndices();<br />
layout.setDynamicColorsRGBA();<br />
layout.setDynamicPositions();</p>
<p>int vertCount = 24;<br />
int quadCount = 6;<br />
mesh = gl::VboMesh(vertCount, quadCount * 4, layout, GL_QUADS);<br />
vector indices;<br />
int i=0;<br />
while(i &lt; 24){<br />
indices.push_back(i);<br />
i++;<br />
}</p>
<p>mesh.bufferIndices(indices);<br />
}<br />
</code></p>
<p>Note that creating the VboMesh only buffers the indices and not any positions. Creating position data is done via a VertexIter, for instance, in the update() of the application:</p>
<p><code><br />
void VboTutorialApp::update()<br />
{<br />
gl::VboMesh::VertexIter iter = mesh.mapVertexBuffer();<br />
for( int idx = 0; idx &lt; numberOfVertices; ++idx ) {<br />
iter.setPosition( Vec3f( xVal, yVal, zVal) );<br />
++iter;<br />
}<br />
}<br />
</code></p>
<p>The positions are automatically generated to be unit vector values, stored both on the graphics card and in the application memory, When you modify the VertexIter you mark a certain range of data as needing to be uploaded to the graphics card. For those interested in the underlying functionality, this uses the stored local copy of the vertex and index information to pass to glBufferDataARB(). The values are only uploaded to the card when index, color, or position data is modified saving time and space on any draw operation when changes haven&#8217;t been made. This is an important nuance because the idea of keeping records both on the graphics card and in the application memory is used throughout the VboMesh, color data, texture positions, and even indices. If you create dynamic texture positions using either setDynamicTexCoords2d() if you&#8217;re using 2d coordinates or setDynamicTexCoords3d() if you&#8217;re using 3d coordinates, you can reposition a texture on a mesh dynamically. There are some key differences between 2d textures and 3d textures that you can read up more on here . To move a texture around the x axis of the mesh, create a VertexIter and then modify the texture using setTexCoord3d2() or setTexCoord2d2() depending on the texture type that you&#8217;re using. For instance, shifting a 2d texture around:</p>
<p><code><br />
// dynmaically generate our new positions based on a simple sine wave for mesh<br />
gl::VboMesh::VertexIter iter2 = mVboMesh2.mapVertexBuffer();<br />
for( int x = 0; x &lt; VERTICES_X; ++x ) {<br />
for( int z = 0; z &lt; VERTICES_Z; ++z ) {<br />
float height = sin( z / (float)VERTICES_Z * zFreq + x / (float)VERTICES_X * xFreq + offset ) / 5.0f;<br />
iter2.setPosition( Vec3f( x / (float)VERTICES_X, height, z / (float)VERTICES_Z ) + Vec3f( 0, 0.5, 0 ) );<br />
iter.setTexCoord2d2( Vec2f( x / (float)VERTICES_X, z / (float)VERTICES_Z ));<br />
++iter2;<br />
}<br />
}<br />
</code></p>
<p>You can also copy the values from one VboMesh to another, retrieving values from a mesh using the VboMesh::getIndexVbo() to get the indices from a mesh and VboMesh::getStaticVbo() to get the vertex data from the mesh. The VboMesh can be constructed like so assuming that there&#8217;s another VboMesh called otherMesh:</p>
<p><code><br />
mesh = gl::VboMesh( numberVertices, numberQuads * 4, otherMesh.getLayout(), GL_QUADS, &amp;otherMesh.getIndexVbo(), NULL, &amp;otherMesh.getDynamicVbo());<br />
</code></p>
<p>You may be noticing the last two parameters, which are pointers to either the static or dynamic VBO data from the source VBO.</p>
<p><code><br />
VboMesh( size_t numVertices, size_t numIndices, Layout layout, GLenum primitiveType, Vbo *indexBuffer, Vbo *staticBuffer, Vbo *dynamicBuffer );<br />
</code></p>
<p>Which you use will depend on how the source has been created, using the dynamic properties from a source VBO requires that the source has dynamic positionsVBO with dynamic properties. Using the static values from a buffer means copying the values over so that they can be manipulated independently. This means that the target mesh will have the same properties as the source mesh until they are altered. Using the dynamic properties of a mesh means that the target mesh is using the same data as the source and changes to the source will be reflected in the target mesh. This makes it easy to reflect changes across meshes, for instance color effects or textures, but makes your meshes dependent on the source mesh.</p>
<p>For the last trick of interoperation between the mesh types in Cinder, a VboMesh can load a mesh from a TriMesh instance, which means that you can easily import and export an .obj file to a VBO with ease, for instance:</p>
<p><code><br />
ObjLoader loader( loadResource( OBJ_FILE_RESOURCE ));<br />
loader.load(&amp;trimesh);<br />
gl::VboMesh mesh = gl::VboMesh(trimesh);<br />
</code></p>
<p>And that gets you from a modeling tool to a VBO quite painlessly.</p>
<p>As a final demonstration of how much is built into the VBO and mesh handling in Cinder you can easily create normals and set the normals for a VBO using the VertexIter object and its setNormal() method. A normal is simply a vector that&#8217;s perpendicular to the face of a triangle or quad in a mesh or other piece of OpenGL geometry and they&#8217;re quite important if you plan to use lighting of any kind when rendering a TriMesh or VBO to the screen. The normal essentially tells OpenGL how any light is to be reflected off of a particular face. This allows you to create shading, depth, and other real world lighting effects. It&#8217;s also a little out of the scope of this guide, so I&#8217;ll point you to a chapter from OpenGL Programming aka &#8220;The Red Book&#8221; Using the VertexIter allows you set the normal position for each vertex in a VBO (or in a TriMesh for that matter) by iterating through the vertices of the VBO and setting each normal with an appropriate value. The algorithm here was taken from the <a href="http://www.opengl.org/wiki/Calculating_a_Surface_Normal">http://www.opengl.org/wiki/Calculating_a_Surface_Normal</a> OpenGL wiki which explains the algorithm in a little bit greater detail, as well as providing an alternative algorithm.</p>
<p><code><br />
Vec3f v0, v1, v2;</p>
<p>// dynmaically generate our new positions based on a simple sine wave<br />
gl::VboMesh::VertexIter iter = mVboMesh.mapVertexBuffer();<br />
for( int x = 0; x &lt; VERTICES_X; ++x ) {<br />
for( int z = 0; z &lt; VERTICES_Z ; ++z ) {</p>
<p>float height = sin( z / (float)VERTICES_Z * zFreq + x / (float)VERTICES_X * xFreq + offset ) / 2.0f;<br />
if( currentVert == 0) {<br />
v0.set( x / (float)VERTICES_X, height, z / (float)VERTICES_Z );<br />
++currentVert;<br />
} else if ( currentVert == 1) {<br />
v1.set( x / (float)VERTICES_X, height, z / (float)VERTICES_Z );<br />
++currentVert;<br />
} else {</p>
<p>//v3.set( x / (float)VERTICES_X, height, z / (float)VERTICES_Z );<br />
v2.set( x / (float)VERTICES_X, height, z / (float)VERTICES_Z );</p>
<p>Vec3f uu = v2 - v0;<br />
Vec3f vv = v1 - v0;<br />
Vec3f n = uu.cross(vv).normalized();</p>
<p>iter.setPosition(v0);<br />
iter.setNormal(n);<br />
++iter;<br />
iter.setPosition(v1);<br />
iter.setNormal(n);<br />
++iter;<br />
iter.setPosition(v2);<br />
iter.setNormal(n);<br />
++iter;<br />
currentVert = 0;</p>
<p>}<br />
}<br />
}<br />
</code></p>
<p>So hopefully you&#8217;re feeling a little more comfortable not only with creating and manipulating meshes in Cinder, but also with underestanding what some of the underlying mechanics of a mesh and OpenGL geometry are as well. This guide has barely scratched the surface, but it should be enough to get you started. For more information you can check the excellent references at <a href="http://songho.ca/opengl/gl_vbo.html">songho</a> or to the reference for the <a href="http://libcinder.org/docs/v0.8.2/classcinder_1_1_tri_mesh.html">TriMesh</a> and <a href="http://libcinder.org/docs/v0.8.2/classcinder_1_1gl_1_1_vbo_mesh.html">VBO mesh</a>. Have fun, and make something beautiful.</p>
<p>&#8211;</p>
<p><em>Joshua Noble is a writer, designer, and programmer based in Portland, Oregon and New York City. He&#8217;s the author of, most recently, </em><a href="http://www.amazon.com/Programming-Interactivity-Designers-Processing-Openframeworks/dp/0596154143"><em>Programming Interactivity</em></a><em> and the forthcoming book Research for Living.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/tutorials/guide-to-meshes-in-cinder-cinder-tutorials/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Processing Paris [Events]</title>
		<link>http://www.creativeapplications.net/processing/processing-paris-events/</link>
		<comments>http://www.creativeapplications.net/processing/processing-paris-events/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 16:01:50 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[paris]]></category>
		<category><![CDATA[sharing]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=15380</guid>
		<description><![CDATA[After a highly successful first edition in 2010, Processing Paris are proud to announce the second installment of their series of workshops for creatives working with Processing. Three Processing workshops have been organised : - A beginners workshop with Christian Delecluse. - An intermediate workshop with Julien Gachadoat. - A masterclass with Hartmut Bohnacker. ** [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/Poster_Alterantive_800x600.jpg"><img class="alignnone size-large wp-image-15382" title="Poster_Alterantive_800x600" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/Poster_Alterantive_800x600-640x480.jpg" alt="" width="640" height="480" /></a></p>
<p>After a highly successful first edition in 2010, <a href="http://www.processingparis.org/">Processing Paris</a> are proud to announce the second installment of their series of workshops for creatives working with Processing. Three Processing workshops have been organised :</p>
<p>- A beginners workshop with Christian Delecluse.<br />
- An intermediate workshop with Julien Gachadoat.<br />
- A masterclass with Hartmut Bohnacker. **</p>
<p><strong>Date : 22/23 April 2011</strong><br />
Price : 60, 75 &amp; 90 Euros respectively.</p>
<p>Where : La Fonderie de l’Image, 83 Avenue Gallieni, 93170 Bagnolet, Paris, <a href="www.lafonderiedelimage.org">www.lafonderiedelimage.org</a></p>
<p>How : For further information and to register, please send the team an email stating your full name, address and which workshop you would like to attend to : info@freeartbureau.org</p>
<p>You may also consult the web site for details on this and other events : <a href="http://www.processingparis.org">www.processingparis.org</a></p>
<p>Please note that due to limited places it is imperative to register beforehand to ensure a place.  <strong>The deadline for registering is April 15.</strong></p>
<p>The workshops run from10:00 to 18:00. No need for a computer although you are welcome to bring your own. For the advanced class, you will require a very good level of English. Both the beginners and intermediate class will be taught in French. Full information of the workshops&#8217; content will be communicated very soon.</p>
<p>Processing Paris is an initiative organised by <a href="http://freeartbureau.org">FAB</a>, in collaboration with La Fonderie de L&#8217;Image.</p>
<p><a href="http://freeartbureau.org">FAB</a> (The Free Art Bureau) is a non-profit organisation set up for artists &amp; designers using code as their main creative tool and medium. They organise workshops, conferences, forums, exhibitions as well as support &amp; document work specifically created with code. They believe in sharing, educating, innovating and promoting. They believe that being free is an essential way of life and work.</p>
<p><strong><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp1.jpg"><img class="alignnone size-medium wp-image-15383" title="processingparisp1" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp1-320x213.jpg" alt="" width="320" height="213" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp2.jpg"><img class="alignnone size-medium wp-image-15384" title="processingparisp2" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp2-320x213.jpg" alt="" width="320" height="213" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp3.jpg"><img class="alignnone size-medium wp-image-15385" title="processingparisp3" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp3-320x213.jpg" alt="" width="320" height="213" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp4.jpg"><img class="alignnone size-medium wp-image-15386" title="processingparisp4" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/processingparisp4-320x213.jpg" alt="" width="320" height="213" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2011/03/Flyer_eng.jpg"><img class="alignnone size-large wp-image-15389" title="Flyer_eng" src="http://www.creativeapplications.net/wp-content/uploads/2011/03/Flyer_eng-640x473.jpg" alt="" width="640" height="473" /></a><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/processing/processing-paris-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Camera Apps [iPhone, Tutorial, openFrameworks]</title>
		<link>http://www.creativeapplications.net/iphone/camera-apps-iphone-tutorial-openframeworks/</link>
		<comments>http://www.creativeapplications.net/iphone/camera-apps-iphone-tutorial-openframeworks/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 12:55:42 +0000</pubDate>
		<dc:creator>Filip</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[openFrameworks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AppStore]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[photgraphy]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.creativeapplications.net/?p=12954</guid>
		<description><![CDATA[This is an introduction tutorial in creating photo apps for the iPhone based on the tutorial by Atsushi Tadokoro. If you are already familiar with openFrameworks you can skip right to the &#8220;goal&#8221; section. If you haven&#8217;t used openframeworks before, read on to learn how to download, install and use xcode to get this tutorial [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/oftutorial_camera.png"><img class="alignnone size-full wp-image-12981" title="oftutorial_camera" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/oftutorial_camera.png" alt="" width="640" height="180" /></a></p>
<p>This is an introduction tutorial in creating photo apps for the iPhone based on the tutorial by <a href="http://yoppa.org/iphone10/1163.html">Atsushi Tadokoro</a>. If you are already familiar with openFrameworks you can skip right to the &#8220;goal&#8221; section. If you haven&#8217;t used openframeworks before, read on to learn how to download, install and use xcode to get this tutorial on your iPhone.</p>
<p>Before we start, to be able to deploy development applications to the iPhone, ie run them on the device or publish to the AppStore, you will need to be registered with Apple as iPhone developer. This is a somewhat convoluted process but the registration itself does not take a lot of time. The downside that that it will cost you $99/year. You do not necessarily need to be registered as a iPhone developer to experiment with this tutorial as you can always use the iPhone emulator to play with your applications. Considering this is a photo application we are creating, you will not be able to take photos from the emulator, instead the code includes using images from the library when application is run in the emulator.</p>
<p><a href="http://www.openframeworks.cc/">openFrameworks</a> in an open source c++ creative code framework which runs inside xCode, a development application provided by Apple as a part of Apple SDK (software development kit). To be able to use oF (openFrameworks) you first need to download iPhone SDK (<a href="http://developer.apple.com/devcenter/ios/index.action">Download</a>). You will need to register on Apple&#8217;s site to gain access to the download but this is pretty straight forward. Once you have download and installed xCode, you need to download openFrameworks. oF comes in a number of versions, the one you want is <a href="http://www.openframeworks.cc/download">v0061_iPhone</a>. This is the latest official release at the time of writing this tutorial. Should you want to jump ahead, you can always look at the <a href="https://github.com/openframeworks/openFrameworks">github source</a>, the latest development version. For this tutorial, v0061_iPhone should be good to go. Download oF and unzip the folder. You can put the oF folder anywhere on your computer, what is important is that all the applications you create (xCode Projects) are located inside this folder. The correct location for all your files should be openframeworksfolder/apps/yournameorappname/xcodeprojectsfolders. It&#8217;s really important that you have another folder between apps and your xcode projects. oF xCode projects include a bunch of references to the files contained within the oF folder. Regardless of whether you new app is empty or not, for it to compile (build/run), needs to know where the main oF files are.</p>
<p>To start a new project, duplicate &#8220;emptyExample&#8221; folder located inside /apps/iPhoneExamples folder and put it in the appropriate new folder inside /apps folder (see above). This is your starting file and should contain all the link and references to get going.</p>
<p>NOTE: The making of this original tutorial happened before the latest version of Apple SDK (the one you just downloaded) was available. To make your tutorial files run, you will need to change BASE SDK configuration. To do this, inside xcode, go to the left menu, expand &#8220;targets&#8221; folder and double click on the application. Change &#8220;Base SDK&#8221; to &#8220;iOS Device 4.1&#8243;. Alternatively, download the working (oFv0061_iPhone) emptyExample <a href="http://www.creativeapplications.net/files/tutorials/of/0061/emptyExample.zip">here</a>. If you are downloading files below, you will need to do the same to them.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/basesdk.png"><img class="alignnone size-large wp-image-12959" title="basesdk" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/basesdk-640x515.png" alt="" width="640" height="515" /></a></p>
<p>When you open the example project, you will find many folders on the left and link to other files. You should be concerned (for the time being) only with the files located inside the &#8220;src&#8221; folder, the the source folder. There you will find <em>main.mm</em>, <em>testApp.h</em> and <em>testApp.mm</em> files. <em>main.mm</em> file you will hardly ever need to touch, this just defines global settings, <em>testApp.h</em> is where your definitions go, ie for example the variables and <em>testApp.mm</em> is where your code sits. In the following examples will be dealing with <em>testApp.h</em> and <em>testApp.mm</em> files.</p>
<p>To test whether your example project works, click on the &#8220;Build and Run&#8221; button in the top of the xCode window. To ensure you are deploying to the emulator and not device, make sure that on the left pull down menu &#8220;simulator&#8221; is selected. Alternatively if you would like to deploy straight to your device, choose &#8220;device&#8221;. If you code is good, you should now see emulator open running your empty application or do the same on the device.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/deploying1.png"><img class="alignnone size-large wp-image-12958" title="deploying" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/deploying1-640x189.png" alt="" width="640" height="189" /></a></p>
<p>The basic setup of oF files is very similar to Processing if you used it before. If not, basically there are a number of events that take place when your iphone goes through your code. First one is setup, this is where you predefine all the things that run only once. Update is where things happen each frame, say for example you want the object to move from left to right, well you&#8217;d do that in the update, telling in the code to move the object by 1 pixel with each progressing frame. Draw is where you say what to draw on the screen. touchDown is what happens when you tap on the screen, touchMoved when you move your finger along the screen, touchup is when your release and the one we are going to be using here is touchDoubleTap, what happens when you tap twice on the screen. For the sake of keeping this example simple, we&#8217;ll just use double tap as a button to open camera.</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/setup.png"><img class="alignnone size-full wp-image-12980" title="setup" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/setup.png" alt="" width="640" height="354" /></a></p>
<p>Now we are ready to jump into the code.</p>
<h2><span><span>Take a Picture</span></span></h2>
<p><span><span>We are going to first learn how to take a simple picture. Once we know that, we&#8217;ll learn how to apply effects or alter pixel data we obtain from the camera.</span></span></p>
<p><span> </span>- Built-in camera to take pictures, images of photographs (ofImage) to copy and display<br />
- The underlying features of the camera application and later</p>
<p>Your testApp.h</p>
<p>[sourcecode language="c"]<br />
#pragma once</p>
<p>#include &quot;ofMain.h&quot;<br />
#include &quot;ofxiPhone.h&quot;<br />
#include &quot;ofxiPhoneExtras.h&quot;</p>
<p>class testApp : public ofxiPhoneApp {</p>
<p>public:<br />
	void setup();<br />
	void update();<br />
	void draw();<br />
	void exit();</p>
<p>	void touchDown(ofTouchEventArgs &amp;touch);<br />
	void touchMoved(ofTouchEventArgs &amp;touch);<br />
	void touchUp(ofTouchEventArgs &amp;touch);<br />
	void touchDoubleTap(ofTouchEventArgs &amp;touch);</p>
<p>	void lostFocus();<br />
	void gotFocus();<br />
	void gotMemoryWarning();<br />
	void deviceOrientationChanged(int newOrientation);</p>
<p>	unsigned char * cameraPixels;<br />
	ofxiPhoneImagePicker * camera;<br />
	ofImage	photo;<br />
    int status;</p>
<p>};<br />
[/sourcecode]</p>
<p>Your testApp.mm</p>
<p>[sourcecode language="c"]<br />
#include &quot;testApp.h&quot;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::setup(){<br />
	// register touch events<br />
	ofRegisterTouchEvents(this);</p>
<p>	// initialize the accelerometer<br />
	ofxAccelerometer.setup();</p>
<p>	//iPhoneAlerts will be sent to this.<br />
	ofxiPhoneAlerts.addListener(this);</p>
<p>	//If you want a landscape oreintation<br />
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);</p>
<p>	ofBackground(127,127,127);</p>
<p>	cameraPixels = NULL;<br />
	camera = new ofxiPhoneImagePicker();<br />
	camera-&gt;setMaxDimension(480);</p>
<p>    status = 0;<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::update(){</p>
<p>#ifndef _USE_SIMULATOR<br />
    //condition to use simulator for testing<br />
	if(camera-&gt;imageUpdated){<br />
		//Camera&#8217;s memory space<br />
		if (cameraPixels == NULL){<br />
			cameraPixels = new unsigned char [camera-&gt;width * camera-&gt;height*4];<br />
		}</p>
<p>        //Now that I&#8217;m still upside down camera images, the image upside down<br />
		for (int i = 0; i &lt; camera-&gt;height; i++){<br />
			memcpy(cameraPixels+(camera-&gt;height-i-1)*camera-&gt;width*4, camera-&gt;pixels+i*camera-&gt;width*4, camera-&gt;width*4);<br />
		}</p>
<p>		// The captured image from the camera for processing ofImage (photo) Copy<br />
		photo.setFromPixels(cameraPixels, camera-&gt;width, camera-&gt;height, OF_IMAGE_COLOR_ALPHA);<br />
        camera-&gt;imageUpdated = false;<br />
        status = 1;<br />
	}<br />
#endif</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::draw(){</p>
<p>	if (status == 0) {<br />
        //Display the screen to shoot<br />
        ofSetColor(255, 255, 255);<br />
        ofDrawBitmapString(&quot;Double tap on the screen!!&quot;, 40, ofGetHeight()/2-5);<br />
    }</p>
<p>    if(status == 1){<br />
        //Display the captured image<br />
        photo.draw(0, 0);<br />
    }</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::exit(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDown(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchMoved(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchUp(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDoubleTap(ofTouchEventArgs &amp;touch){</p>
<p>	////UNCOMMENT/COMMENT AS NEEDED</p>
<p>	////If using Simulator: loading images</p>
<p>	//    photo.loadImage(&quot;images/photo.png&quot;);<br />
	//    photo.setImageType(OF_IMAGE_COLOR_ALPHA);<br />
	//    status = 1;</p>
<p>	////or to open Photo library in the simulator or actual device</p>
<p>	//camera-&gt;openLibrary();</p>
<p>	//When using real: a new photo shoot</p>
<p>    camera-&gt;openCamera();</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::lostFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotMemoryWarning(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::deviceOrientationChanged(int newOrientation){</p>
<p>}<br />
[/sourcecode]</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-1.png"><img class="alignnone size-full wp-image-12967" title="Pastebot 2010-11-11 11.34.07 AM 1" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-1.png" alt="" width="320" height="480" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-2.png"><img class="alignnone size-full wp-image-12966" title="Pastebot 2010-11-11 11.34.07 AM 2" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-2.png" alt="" width="320" height="480" /></a></p>
<h2><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-2.png"></a>Camera Mosaic</h2>
<p>- Processed into a mosaic of photographs<br />
- Picked up at regular intervals of pixel information photographs, drawing a rectangle RGB obtained based on information<br />
- Pixel information of the photographic image, getPixel () function is used to remove<br />
- Photographic image, every pixel 1 RGBA (Red, Green, Blue, Alpha) that contains information on four<br />
- When we scan the pixel is treated as one unit to keep in mind four pixels</p>
<p>Your testApp.h</p>
<p>[sourcecode language="c"]<br />
#pragma once</p>
<p>#include &quot;ofMain.h&quot;<br />
#include &quot;ofxiPhone.h&quot;<br />
#include &quot;ofxiPhoneExtras.h&quot;</p>
<p>class testApp : public ofxiPhoneApp {</p>
<p>public:<br />
	void setup();<br />
	void update();<br />
	void draw();<br />
	void exit();</p>
<p>	void touchDown(ofTouchEventArgs &amp;touch);<br />
	void touchMoved(ofTouchEventArgs &amp;touch);<br />
	void touchUp(ofTouchEventArgs &amp;touch);<br />
	void touchDoubleTap(ofTouchEventArgs &amp;touch);</p>
<p>	void lostFocus();<br />
	void gotFocus();<br />
	void gotMemoryWarning();<br />
	void deviceOrientationChanged(int newOrientation);</p>
<p>	unsigned char * cameraPixels;<br />
	ofxiPhoneImagePicker * camera;<br />
	ofImage	photo;<br />
    int status;</p>
<p>};<br />
[/sourcecode]</p>
<p>Your testApp.mm</p>
<p>[sourcecode language="c"]</p>
<p>#include &quot;testApp.h&quot;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::setup(){<br />
	// register touch events<br />
	ofRegisterTouchEvents(this);</p>
<p>	// initialize the accelerometer<br />
	ofxAccelerometer.setup();</p>
<p>	//iPhoneAlerts will be sent to this.<br />
	ofxiPhoneAlerts.addListener(this);</p>
<p>	//If you want a landscape oreintation<br />
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);</p>
<p>	ofBackground(127,127,127);</p>
<p>	cameraPixels = NULL;<br />
	camera = new ofxiPhoneImagePicker();<br />
	camera-&gt;setMaxDimension(480);</p>
<p>    status = 0;<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::update(){</p>
<p>#ifndef _USE_SIMULATOR<br />
    //When using real<br />
	if(camera-&gt;imageUpdated){<br />
		//Camera&#8217;s memory space<br />
		if (cameraPixels == NULL){<br />
			cameraPixels = new unsigned char [camera-&gt;width * camera-&gt;height*4];<br />
		}</p>
<p>		// Now that I&#8217;m still upside down camera images, the image upside down<br />
		for (int i = 0; i &lt; camera-&gt;height; i++){<br />
			memcpy(cameraPixels+(camera-&gt;height-i-1)*camera-&gt;width*4, camera-&gt;pixels+i*camera-&gt;width*4, camera-&gt;width*4);<br />
		}</p>
<p>		// The captured image from the camera for processing ofImage (photo) Copy<br />
		photo.setFromPixels(cameraPixels, camera-&gt;width, camera-&gt;height, OF_IMAGE_COLOR_ALPHA);<br />
        camera-&gt;imageUpdated = false;<br />
        status = 1;<br />
	}<br />
#endif</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::draw(){</p>
<p>    if (status == 0) {<br />
        //Display the screen to shoot<br />
        ofSetColor(255, 255, 255);<br />
        ofDrawBitmapString(&quot;Double tap on the screen!!&quot;, 40, ofGetHeight()/2-5);<br />
    }</p>
<p>    if(status == 1){<br />
        //Display the captured image<br />
        photo.draw(0, 0);</p>
<p>        //Bitmap information stored in the array of image data<br />
        unsigned char * pixels = photo.getPixels();</p>
<p>        //Image width and height of income<br />
        int w = photo.width;<br />
        int h = photo.height;</p>
<p>        //スキャンする間隔<br />
        int skip = 20;</p>
<p>        //Of a mosaic: the pixel color at regular intervals to detect and draw<br />
        for (int j = 0; j &lt; h; j+=skip){<br />
            for (int i = 0; i &lt; w; i+=skip){<br />
                int valueR = pixels[j*4*w + i*4];<br />
                int valueG = pixels[j*4*w + i*4+1];<br />
                int valueB = pixels[j*4*w + i*4+2];<br />
                ofSetColor(valueR,valueG,valueB);<br />
                ofRect(i, j, skip, skip);<br />
            }<br />
        }<br />
    }<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::exit(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDown(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchMoved(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchUp(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDoubleTap(ofTouchEventArgs &amp;touch){</p>
<p>	////UNCOMMENT/COMMENT AS NEEDED</p>
<p>	////If using Simulator: loading images</p>
<p>	//    photo.loadImage(&quot;images/photo.png&quot;);<br />
	//    photo.setImageType(OF_IMAGE_COLOR_ALPHA);<br />
	//    status = 1;</p>
<p>	////or to open Photo library in the simulator or actual device</p>
<p>	//camera-&gt;openLibrary();</p>
<p>	//When using real: a new photo shoot</p>
<p>    camera-&gt;openCamera();</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::lostFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotMemoryWarning(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::deviceOrientationChanged(int newOrientation){</p>
<p>}<br />
[/sourcecode]</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-3.png"><img class="alignnone size-full wp-image-12969" title="Pastebot 2010-11-11 11.34.07 AM 3" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-3.png" alt="" width="320" height="480" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-4.png"><img class="alignnone size-full wp-image-12968" title="Pastebot 2010-11-11 11.34.07 AM 4" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.34.07-AM-4.png" alt="" width="320" height="480" /></a></p>
<h2>Scan Camera</h2>
<p>- Using the application of Mosaic<br />
- A certain height (Y coordinate) of the pixel information<br />
- All X coordinate to obtain RGBA values, like displaying a vertical bar to expand<br />
- To get height, which can be changed by touching the screen<br />
- Effects can be obtained at the specified line to scan photos</p>
<p>Your testApp.h</p>
<p>[sourcecode language="c"]</p>
<p>#pragma once</p>
<p>#include &quot;ofMain.h&quot;<br />
#include &quot;ofxiPhone.h&quot;<br />
#include &quot;ofxiPhoneExtras.h&quot;</p>
<p>class testApp : public ofxiPhoneApp {</p>
<p>public:<br />
	void setup();<br />
	void update();<br />
	void draw();<br />
	void exit();</p>
<p>	void touchDown(ofTouchEventArgs &amp;touch);<br />
	void touchMoved(ofTouchEventArgs &amp;touch);<br />
	void touchUp(ofTouchEventArgs &amp;touch);<br />
	void touchDoubleTap(ofTouchEventArgs &amp;touch);</p>
<p>	void lostFocus();<br />
	void gotFocus();<br />
	void gotMemoryWarning();<br />
	void deviceOrientationChanged(int newOrientation);</p>
<p>	unsigned char * cameraPixels;<br />
	ofxiPhoneImagePicker * camera;<br />
	ofImage	photo;<br />
    int status;<br />
	int scanHeight;<br />
};<br />
[/sourcecode]</p>
<p>Your testApp.mm</p>
<p>[sourcecode language="c"]<br />
#include &quot;testApp.h&quot;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::setup(){<br />
	// register touch events<br />
	ofRegisterTouchEvents(this);</p>
<p>	// initialize the accelerometer<br />
	ofxAccelerometer.setup();</p>
<p>	//iPhoneAlerts will be sent to this.<br />
	ofxiPhoneAlerts.addListener(this);</p>
<p>	//If you want a landscape oreintation<br />
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);</p>
<p>	ofBackground(127,127,127);</p>
<p>	cameraPixels = NULL;<br />
	camera = new ofxiPhoneImagePicker();<br />
	camera-&gt;setMaxDimension(480);</p>
<p>    status = 0;<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::update(){</p>
<p>#ifndef _USE_SIMULATOR<br />
    //When using real<br />
	if(camera-&gt;imageUpdated){<br />
		//Camera&#8217;s memory space<br />
		if (cameraPixels == NULL){<br />
			cameraPixels = new unsigned char [camera-&gt;width * camera-&gt;height*4];<br />
		}</p>
<p>		// Now that I&#8217;m still upside down camera images, the image upside down<br />
		for (int i = 0; i &lt; camera-&gt;height; i++){<br />
			memcpy(cameraPixels+(camera-&gt;height-i-1)*camera-&gt;width*4, camera-&gt;pixels+i*camera-&gt;width*4, camera-&gt;width*4);<br />
		}</p>
<p>		// The captured image from the camera for processing ofImage (photo) Copy<br />
		photo.setFromPixels(cameraPixels, camera-&gt;width, camera-&gt;height, OF_IMAGE_COLOR_ALPHA);<br />
        camera-&gt;imageUpdated = false;<br />
        status = 1;<br />
	}<br />
#endif</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::draw(){</p>
<p>    if (status == 0) {<br />
        //Display the screen to shoot<br />
        ofSetColor(255, 255, 255);<br />
        ofDrawBitmapString(&quot;Double tap on the screen!!&quot;, 40, ofGetHeight()/2-5);<br />
    }</p>
<p>    if(status == 1){<br />
        //Display the captured image<br />
        photo.draw(0, 0);</p>
<p>        //Bitmap information stored in the array of image data<br />
        unsigned char * pixels = photo.getPixels();</p>
<p>        //Image width and height of income<br />
        int w = photo.width;<br />
        int h = photo.height;</p>
<p>        //Of a mosaic: the pixel color at regular intervals to detect and draw<br />
        for (int i = 0; i &lt; w; i++){<br />
            int valueR = pixels[scanHeight*4*w + i*4];<br />
            int valueG = pixels[scanHeight*4*w + i*4+1];<br />
            int valueB = pixels[scanHeight*4*w + i*4+2];<br />
            ofSetColor(valueR,valueG,valueB);<br />
            ofRect(i, 0, 1, h);<br />
        }</p>
<p>        //Display it where to scan<br />
        ofSetColor(255, 255, 255);<br />
        ofLine(0, scanHeight, ofGetWidth(), scanHeight);<br />
    }<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::exit(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDown(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchMoved(ofTouchEventArgs &amp;touch){<br />
	//Where you drag the screen to determine the height scan<br />
	scanHeight = touch.y;</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchUp(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDoubleTap(ofTouchEventArgs &amp;touch){</p>
<p>	////UNCOMMENT/COMMENT AS NEEDED</p>
<p>	////If using Simulator: loading images</p>
<p>	//    photo.loadImage(&quot;images/photo.png&quot;);<br />
	//    photo.setImageType(OF_IMAGE_COLOR_ALPHA);<br />
	//    status = 1;</p>
<p>	////or to open Photo library in the simulator or actual device</p>
<p>	//camera-&gt;openLibrary();</p>
<p>	//When using real: a new photo shoot</p>
<p>    camera-&gt;openCamera();</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::lostFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotMemoryWarning(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::deviceOrientationChanged(int newOrientation){</p>
<p>}<br />
[/sourcecode]</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.52.04-AM-1.png"><img class="alignnone size-full wp-image-12971" title="Pastebot 2010-11-11 11.52.04 AM 1" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.52.04-AM-1.png" alt="" width="320" height="480" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.52.04-AM-2.png"><img class="alignnone size-full wp-image-12970" title="Pastebot 2010-11-11 11.52.04 AM 2" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-11.52.04-AM-2.png" alt="" width="320" height="480" /></a></p>
<h2>Pixelate Camera (Greyscale)</h2>
<p>- Analysis of photographic images pixel information<br />
- RGB images at a constant interval to another level (brightness) to get, taking the average value<br />
- Going in circles while changing the radius value<br />
- As gray dots represent the photo that was printed in black and white</p>
<p>Your testApp.h</p>
<p>[sourcecode language="c"]<br />
#pragma once</p>
<p>#include &quot;ofMain.h&quot;<br />
#include &quot;ofxiPhone.h&quot;<br />
#include &quot;ofxiPhoneExtras.h&quot;</p>
<p>class testApp : public ofxiPhoneApp {</p>
<p>public:<br />
	void setup();<br />
	void update();<br />
	void draw();<br />
	void exit();</p>
<p>	void touchDown(ofTouchEventArgs &amp;touch);<br />
	void touchMoved(ofTouchEventArgs &amp;touch);<br />
	void touchUp(ofTouchEventArgs &amp;touch);<br />
	void touchDoubleTap(ofTouchEventArgs &amp;touch);</p>
<p>	void lostFocus();<br />
	void gotFocus();<br />
	void gotMemoryWarning();<br />
	void deviceOrientationChanged(int newOrientation);</p>
<p>	unsigned char * cameraPixels;<br />
	ofxiPhoneImagePicker * camera;<br />
	ofImage	photo;<br />
    int status;</p>
<p>};<br />
[/sourcecode]</p>
<p>Your testApp.mm</p>
<p>[sourcecode language="c"]<br />
#include &quot;testApp.h&quot;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::setup(){<br />
	// register touch events<br />
	ofRegisterTouchEvents(this);</p>
<p>	// initialize the accelerometer<br />
	ofxAccelerometer.setup();</p>
<p>	//iPhoneAlerts will be sent to this.<br />
	ofxiPhoneAlerts.addListener(this);</p>
<p>	//If you want a landscape oreintation<br />
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);</p>
<p>	ofBackground(127,127,127);<br />
	ofEnableSmoothing();<br />
	ofSetCircleResolution(64);<br />
	ofEnableAlphaBlending();</p>
<p>	cameraPixels = NULL;<br />
	camera = new ofxiPhoneImagePicker();<br />
	camera-&gt;setMaxDimension(480);</p>
<p>    status = 0;<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::update(){</p>
<p>#ifndef _USE_SIMULATOR<br />
    //When using real<br />
	if(camera-&gt;imageUpdated){<br />
		//Camera&#8217;s memory space<br />
		if (cameraPixels == NULL){<br />
			cameraPixels = new unsigned char [camera-&gt;width * camera-&gt;height*4];<br />
		}</p>
<p>		// Now that I&#8217;m still upside down camera images, the image upside down<br />
		for (int i = 0; i &lt; camera-&gt;height; i++){<br />
			memcpy(cameraPixels+(camera-&gt;height-i-1)*camera-&gt;width*4, camera-&gt;pixels+i*camera-&gt;width*4, camera-&gt;width*4);<br />
		}</p>
<p>		// The captured image from the camera for processing ofImage (photo) Copy<br />
		photo.setFromPixels(cameraPixels, camera-&gt;width, camera-&gt;height, OF_IMAGE_COLOR_ALPHA);<br />
        camera-&gt;imageUpdated = false;<br />
        status = 1;<br />
	}<br />
#endif</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::draw(){</p>
<p>    if (status == 0) {<br />
        //Display the screen to shoot<br />
        ofSetColor(255, 255, 255);<br />
        ofDrawBitmapString(&quot;Double tap on the screen!!&quot;, 40, ofGetHeight()/2-5);<br />
    }</p>
<p>    if(status == 1){<br />
        //Display the captured image<br />
        photo.draw(0, 0);</p>
<p>        //Bitmap information stored in the array of image data<br />
        unsigned char * pixels = photo.getPixels();</p>
<p>        //Image width and height of income<br />
        int w = photo.width;<br />
        int h = photo.height;</p>
<p>        //Set the radius of the pixelate<br />
        int r = 12;</p>
<p>        //Scan the image at regular intervals<br />
        for (int j = 0; j &lt; h; j+=r){<br />
            for (int i = 0; i &lt; w; i+=r){<br />
                //Get the value of RGB pixel<br />
                //RGBA so arranged in the order of 4 per pixel<br />
                int valueR = pixels[j*4*w + i*4];<br />
                int valueG = pixels[j*4*w + i*4+1];<br />
                int valueB = pixels[j*4*w + i*4+2];</p>
<p>                //RGB values for calculating the average value of<br />
                float value = r*(valueR+valueG+valueB)/2.0/255.0;</p>
<p>                //Get the RGB values based on drawing a circle<br />
                //Get the brightness of the pixels, which will correspond to the radius<br />
                ofSetColor(255,255,255,100);<br />
                ofCircle(i, j, value);<br />
            }<br />
        }</p>
<p>    }<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::exit(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDown(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchMoved(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchUp(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDoubleTap(ofTouchEventArgs &amp;touch){</p>
<p>	////UNCOMMENT/COMMENT AS NEEDED</p>
<p>	////If using Simulator: loading images</p>
<p>	//    photo.loadImage(&quot;images/photo.png&quot;);<br />
	//    photo.setImageType(OF_IMAGE_COLOR_ALPHA);<br />
	//    status = 1;</p>
<p>	////or to open Photo library in the simulator or actual device</p>
<p>	//camera-&gt;openLibrary();</p>
<p>	//When using real: a new photo shoot</p>
<p>    camera-&gt;openCamera();</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::lostFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotMemoryWarning(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::deviceOrientationChanged(int newOrientation){</p>
<p>}<br />
[/sourcecode]</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.05.26-PM-1.png"><img class="alignnone size-full wp-image-12973" title="Pastebot 2010-11-11 12.05.26 PM 1" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.05.26-PM-1.png" alt="" width="320" height="480" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.05.26-PM-2.png"><img class="alignnone size-full wp-image-12974" title="Pastebot 2010-11-11 12.05.26 PM 2" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.05.26-PM-2.png" alt="" width="320" height="480" /></a></p>
<h2>Pixelate Camera (Colour)</h2>
<p>- The color version of Pixelate<br />
- RGB separate circles, we repeatedly<br />
- The synthesis of color when drawing the point where the change is additive synthesis<br />
- Use OpenGL commands directly &#8211; glEnable (GL_BLEND); and glBlendFunc (GL_SRC_ALPHA, GL_ONE); feasible<br />
- As gray dots represent a color photograph printed as</p>
<p>Your testApp.h</p>
<p>[sourcecode language="c"]<br />
#pragma once</p>
<p>#include &quot;ofMain.h&quot;<br />
#include &quot;ofxiPhone.h&quot;<br />
#include &quot;ofxiPhoneExtras.h&quot;</p>
<p>class testApp : public ofxiPhoneApp {</p>
<p>public:<br />
	void setup();<br />
	void update();<br />
	void draw();<br />
	void exit();</p>
<p>	void touchDown(ofTouchEventArgs &amp;touch);<br />
	void touchMoved(ofTouchEventArgs &amp;touch);<br />
	void touchUp(ofTouchEventArgs &amp;touch);<br />
	void touchDoubleTap(ofTouchEventArgs &amp;touch);</p>
<p>	void lostFocus();<br />
	void gotFocus();<br />
	void gotMemoryWarning();<br />
	void deviceOrientationChanged(int newOrientation);</p>
<p>	unsigned char * cameraPixels;<br />
	ofxiPhoneImagePicker * camera;<br />
	ofImage	photo;<br />
    int status;</p>
<p>};<br />
[/sourcecode]</p>
<p>Your testApp.mm</p>
<p>[sourcecode language="c"]<br />
#include &quot;testApp.h&quot;</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::setup(){<br />
	// register touch events<br />
	ofRegisterTouchEvents(this);</p>
<p>	// initialize the accelerometer<br />
	ofxAccelerometer.setup();</p>
<p>	//iPhoneAlerts will be sent to this.<br />
	ofxiPhoneAlerts.addListener(this);</p>
<p>	//If you want a landscape oreintation<br />
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);</p>
<p>	ofBackground(127,127,127);<br />
	ofEnableSmoothing();<br />
	ofSetCircleResolution(64);<br />
	ofEnableAlphaBlending();</p>
<p>	cameraPixels = NULL;<br />
	camera = new ofxiPhoneImagePicker();<br />
	camera-&gt;setMaxDimension(480);</p>
<p>    status = 0;<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::update(){</p>
<p>#ifndef _USE_SIMULATOR<br />
    //When using real<br />
	if(camera-&gt;imageUpdated){<br />
		//Camera&#8217;s memory space<br />
		if (cameraPixels == NULL){<br />
			cameraPixels = new unsigned char [camera-&gt;width * camera-&gt;height*4];<br />
		}</p>
<p>		// Now that I&#8217;m still upside down camera images, the image upside down<br />
		for (int i = 0; i &lt; camera-&gt;height; i++){<br />
			memcpy(cameraPixels+(camera-&gt;height-i-1)*camera-&gt;width*4, camera-&gt;pixels+i*camera-&gt;width*4, camera-&gt;width*4);<br />
		}</p>
<p>		// The captured image from the camera for processing ofImage (photo) Copy<br />
		photo.setFromPixels(cameraPixels, camera-&gt;width, camera-&gt;height, OF_IMAGE_COLOR_ALPHA);<br />
        camera-&gt;imageUpdated = false;<br />
        status = 1;<br />
	}<br />
#endif</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::draw(){</p>
<p>    if (status == 0) {<br />
        //Display the screen to shoot<br />
        ofSetColor(255, 255, 255);<br />
        ofDrawBitmapString(&quot;Double tap on the screen!!&quot;, 40, ofGetHeight()/2-5);<br />
    }</p>
<p>    if(status == 1){<br />
        //Display the captured image<br />
        photo.draw(0, 0);</p>
<p>        //Bitmap information stored in the array of image data<br />
        unsigned char * pixels = photo.getPixels();</p>
<p>        //Image width and height of income<br />
        int w = photo.width;<br />
        int h = photo.height;</p>
<p>        //Set the radius of the pixelate<br />
        int r = 12;</p>
<p>        //Scan the image at regular intervals<br />
        for (int j = 0; j &lt; h; j+=r){<br />
            for (int i = 0; i &lt; w; i+=r){<br />
                //Get the value of RGB pixel<br />
                //RGBA so arranged in the order of 4 per pixel<br />
                int valueR = pixels[j*4*w + i*4];<br />
                int valueG = pixels[j*4*w + i*4+1];<br />
                int valueB = pixels[j*4*w + i*4+2];</p>
<p>				// Get the RGB values based on drawing a circle<br />
				// Get the brightness of the pixels, which will correspond to the radius of the circle<br />
                ofSetColor(255, 0, 0, 63);<br />
                ofCircle(i, j, r*valueR/255.0*2.0);<br />
                ofSetColor(0, 255, 0, 63);<br />
                ofCircle(i, j, r*valueG/255.0*2.0);<br />
                ofSetColor(0, 0, 255, 63);<br />
                ofCircle(i, j, r*valueB/255.0*2.0);<br />
            }<br />
        }</p>
<p>    }<br />
}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::exit(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDown(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchMoved(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchUp(ofTouchEventArgs &amp;touch){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::touchDoubleTap(ofTouchEventArgs &amp;touch){</p>
<p>	////UNCOMMENT/COMMENT AS NEEDED</p>
<p>	////If using Simulator: loading images</p>
<p>	//    photo.loadImage(&quot;images/photo.png&quot;);<br />
	//    photo.setImageType(OF_IMAGE_COLOR_ALPHA);<br />
	//    status = 1;</p>
<p>	////or to open Photo library in the simulator or actual device</p>
<p>	//camera-&gt;openLibrary();</p>
<p>	//When using real: a new photo shoot</p>
<p>    camera-&gt;openCamera();</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::lostFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotFocus(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::gotMemoryWarning(){</p>
<p>}</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
void testApp::deviceOrientationChanged(int newOrientation){</p>
<p>}<br />
[/sourcecode]</p>
<p><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.13.23-PM-1.png"><img class="alignnone size-full wp-image-12977" title="Pastebot 2010-11-11 12.13.23 PM 1" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.13.23-PM-1.png" alt="" width="320" height="480" /></a><a href="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.13.23-PM-2.png"><img class="alignnone size-full wp-image-12976" title="Pastebot 2010-11-11 12.13.23 PM 2" src="http://www.creativeapplications.net/wp-content/uploads/2010/11/Pastebot-2010-11-11-12.13.23-PM-2.png" alt="" width="320" height="480" /></a></p>
<h2>Conclusion</h2>
<p>As you can see, you can produce quite a lot with very little code indeed. Of course, this is just the beginning and if you were interested in building a real app out of any of the above examples you would also build an UI, buttons, help, etc. The &#8216;draw&#8217; method is your friend, from simple rectangles to make buttons to code in the touchdown such as:</p>
<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff} span.s1 {color: #d4009b} span.s2 {color: #8d7dd1} --><em>if(touch.x&gt;70 &amp;&amp; touch.x&lt;90 &amp;&amp; touch.y&gt;325 &amp;&amp; touch.y&lt;355) {</em></p>
<p><em>//somethings happens here</em></p>
<p><em>}</em></p>
<p>to define the click are where something might happen, such as opening the library of photos <em>(camera-&gt; openLibrary ()</em>; instead of <em>camera-&gt; openCamera ();</em>)</p>
<p>To see the full reference of commands, see <a href="http://www.openframeworks.cc/documentation">openFrameworks website</a>.</p>
<p>We hope this has been useful and provided a nice + quick introduction into openFrameworks on the iPhone. Any other tutorials you would like to see or if you have any questions please leave a comment below.</p>
<p><a href="http://www.creativeapplications.net/files/tutorials/of/0061/PhotoApp_oF_Tutorial.zip">DOWNLOAD TUTORIAL FILES</a></p>
<h2>Credits</h2>
<p>This tutorial first appeared on <a href="http://yoppa.org/iphone10/1163.html">http://yoppa.org</a>, created by Atsushi Tadokoro. Introduction and translation by Filip Visnjic with the help of google translate, together with few changes to make it easier for beginners (i hope).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.creativeapplications.net/iphone/camera-apps-iphone-tutorial-openframeworks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

