<?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>quixotic project blog</title>
	<atom:link href="http://michi.ist.inspirationslos.de/lang/en/feed/" rel="self" type="application/rss+xml" />
	<link>http://michi.ist.inspirationslos.de</link>
	<description></description>
	<lastBuildDate>Sat, 06 Feb 2010 10:11:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Javadoc Links in IntelliJ Idea with Live Templates</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2010/01/26/adding-javadoc-links-in-intellij-idea-with-live-templates</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2010/01/26/adding-javadoc-links-in-intellij-idea-with-live-templates#comments</comments>
		<pubDate>Tue, 26 Jan 2010 21:55:48 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[intellij idea]]></category>
		<category><![CDATA[javadoc]]></category>
		<category><![CDATA[live template]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=187</guid>
		<description><![CDATA[In Eclipse there is this wonderful little helper for adding Javadoc links while you&#8217;re typing a class name. It looks like this: 

It suggests not just to put the classes name there but also use a @link tag so one can navigate the Javadoc sources later on. The finished comment:

Unfortunately this functionality is not available [...]]]></description>
			<content:encoded><![CDATA[<p>In Eclipse there is this wonderful little helper for adding Javadoc links while you&#8217;re typing a class name. It looks like this: </p>
<p><img src="http://michi.ist.inspirationslos.de/files/2010/01/eclipse-javadoc-links-1-300x76.png" alt="auto completion for Javadoc links in Eclipse" title="auto completion for Javadoc links in Eclipse" width="300" height="76" class="alignnone size-medium wp-image-182" /></p>
<p>It suggests not just to put the classes name there but also use a @link tag so one can navigate the Javadoc sources later on. The finished comment:</p>
<p><img src="http://michi.ist.inspirationslos.de/files/2010/01/eclipse-javadoc-links-2-300x76.png" alt="auto completion for Javadoc links in Eclipse" title="auto completion for Javadoc links in Eclipse" width="300" height="76" class="alignnone size-medium wp-image-183" /></p>
<p>Unfortunately this functionality is not available in JetBrains&#8217; IntelliJ Idea. There is (of course) auto completion for classnames in Idea but it simply doesn&#8217;t put them in a @link tag. A simple trick saves the day: simply create a <a href="http://www.jetbrains.com/idea/features/code_assistance.html">live template</a> with context &#8216;Java comment&#8217; like here:</p>
<p><a href="http://michi.ist.inspirationslos.de/files/2010/01/idea-javadoc-links-1.png"><img src="http://michi.ist.inspirationslos.de/files/2010/01/idea-javadoc-links-1-300x262.png" alt="creating a live template for the javadoc link" title="link live template" width="300" height="262" class="alignnone size-medium wp-image-184" /></a></p>
<p>EDIT: The screenshot is missing the word &#8216;link&#8217;. The complete template should be: &#8216;{@link $LINK$} &#8216;.</p>
<p>Don&#8217;t forget to click on &#8216;Edit variables&#8217; and fill in &#8216;complete()&#8217; as Expression. This activates the auto completion for classnames. </p>
<p>Now everytime a @link in the Javadocs is needed we invoke the Live Templates with Alt + J and enter a classname. The @link tag will be build around that name. It&#8217;s not as simple as with Eclipse, but works pretty well.</p>
<p><img src="http://michi.ist.inspirationslos.de/files/2010/01/idea-javadoc-links-2.png" alt="live template for the javadoc @link" title="live template for the javadoc @link" width="300" height="100" class="alignnone size-full wp-image-185" /></p>
<p><img src="http://michi.ist.inspirationslos.de/files/2010/01/idea-javadoc-links-3.png" alt="live template for the javadoc @link tag" title="live template for the javadoc @link tag" width="300" height="100" class="alignnone size-full wp-image-186" /></p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2010/01/26/adding-javadoc-links-in-intellij-idea-with-live-templates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Immediate mode rendering is dead&#8221;</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2010/01/19/immediate-mode-rendering-is-dead</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2010/01/19/immediate-mode-rendering-is-dead#comments</comments>
		<pubDate>Tue, 19 Jan 2010 18:58:31 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=179</guid>
		<description><![CDATA[&#8220;Immediate mode rendering is dead&#8221; is the title of a topic on the Javagaming Forums I&#8217;ve been following the last two days. It is a really insightfull discussion about the use of Vertex Buffer Objects versus Vertex Arrays and the Immediate Mode.
One says the internet doesn&#8217;t forget and that is especially true for tutorials concerning [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Immediate mode rendering is dead&#8221; is the title of a <a href="http://www.javagaming.org/index.php/topic,21839.0.html">topic on the Javagaming Forums</a> I&#8217;ve been following the last two days. It is a really insightfull discussion about the use of Vertex Buffer Objects versus Vertex Arrays and the Immediate Mode.<br />
One says the internet doesn&#8217;t forget and that is especially true for tutorials concerning OpenGL which have been around for a very long time now. Most of them start by showing how to draw simple geometry using the Immediate Mode and most people posting in the mentioned topic agree that this is the wrong thing to start learning with, at least nowadays.<br />
The topic also includes some example code and benchmarking what methods and ways seem to be the fastest. The contributers just started comparing benchmarks and didn&#8217;t go very deep, but I really hope that there will be deeper insights revealed.<br />
The whole discussion actually started here: <a href="http://www.javagaming.org/index.php/topic,21823.0.html">Sprite!</a>, where princec (from <a href="http://www.puppygames.net/">Puppygames</a>) is writing about his sprite-engine. Also a very interesting read!</p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2010/01/19/immediate-mode-rendering-is-dead/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>new time lapse video</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2010/01/09/new-time-lapse-video</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2010/01/09/new-time-lapse-video#comments</comments>
		<pubDate>Sat, 09 Jan 2010 17:24:26 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[time lapse]]></category>
		<category><![CDATA[ulm]]></category>
		<category><![CDATA[uni ulm]]></category>
		<category><![CDATA[uniklinikum]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=175</guid>
		<description><![CDATA[Almost two years ago I started saving the pictures of a webcam that shows the construction site of a new building at the university of Ulm. Meanwhile I got a collection of almost 50.000 pictures that take up 12 gb of my harddisk. I decided to make a new video. Like the last one this [...]]]></description>
			<content:encoded><![CDATA[<p>Almost two years ago I started saving the pictures of a webcam that shows the construction site of a new building at the university of Ulm. Meanwhile I got a collection of almost 50.000 pictures that take up 12 gb of my harddisk. I decided to make a new video. Like the last one this is only generated by a fraction of  that pictures, namely the ones taken at 10 and 12 o&#8217;clock in the morning each day. Have a look:</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/7_ls7LrnQt0&#038;hl=de_DE&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/7_ls7LrnQt0&#038;hl=de_DE&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2010/01/09/new-time-lapse-video/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColorChooser link is working again</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2010/01/05/colorchooser-link-is-working-again</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2010/01/05/colorchooser-link-is-working-again#comments</comments>
		<pubDate>Tue, 05 Jan 2010 18:40:16 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=171</guid>
		<description><![CDATA[Some time ago (actually really long ago) I put the source code for my color chooser component on the blog. The link didn&#8217;t work for quite some time now and I didn&#8217;t notice. It&#8217;s back up now..
Sourcecode: ColorGradient_v0.1
Webstart: click me!

]]></description>
			<content:encoded><![CDATA[<p>Some time ago (actually really long ago) I put the source code for my color chooser component on the blog. The link didn&#8217;t work for quite some time now and I didn&#8217;t notice. It&#8217;s back up now..<br />
Sourcecode: <a href="http://michi.ist.inspirationslos.de/files/2010/01/ColorGradient_v0.1.zip">ColorGradient_v0.1</a><br />
Webstart: <a href="http://www.quixotic-project.de/webstart/ColorGradient_test1.php">click me!</a></p>
<p><img src="http://michi.ist.inspirationslos.de/files/2007/05/colorgradienttest.jpg" alt="ColorGradient v 0.1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2010/01/05/colorchooser-link-is-working-again/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Trouble with Vertex Buffer Objects solved</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2009/10/25/trouble-with-vertex-buffer-objects-solved</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2009/10/25/trouble-with-vertex-buffer-objects-solved#comments</comments>
		<pubDate>Sun, 25 Oct 2009 17:29:59 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[lwjgl]]></category>
		<category><![CDATA[sleepless nights debugging]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=162</guid>
		<description><![CDATA[It has been a while since I last used Vertex Buffer Objects (VBO) with LWJGL. It seemed as if they had changed some of the method signatures since I used them last time. I couldn&#8217;t even get the simplest example running. After experimenting for a while I finally figured it out. Have a look at [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I last used Vertex Buffer Objects (VBO) with <a href="http://www.lwjgl.org" target="_self">LWJGL</a>. It seemed as if they had changed some of the method signatures since I used them last time. I couldn&#8217;t even get the simplest example running. After experimenting for a while I finally figured it out. Have a look at the signature of the VertexPointer method:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> glVertexPointer<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> size, <span style="color: #000066; font-weight: bold;">int</span> type,
  <span style="color: #000066; font-weight: bold;">int</span> stride, <span style="color: #000066; font-weight: bold;">long</span> pointer_buffer_offset<span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>With the last offset one can specify where the vertex information starts in the buffer given to the VBO management. Well, I could/should have guessed that this offset has to be in <strong>bytes</strong> since I am dealing with a buffer here but instead I used the number of <strong>floats</strong>.. So next time I see an operation dealing with buffers that takes a long argument I&#8217;ll try the byte-count from the beginning..</p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2009/10/25/trouble-with-vertex-buffer-objects-solved/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ein Jahr Uniklinkikbau &#8211; Zeitraffer</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2009/04/18/1-jahr-uniklinkikbau-zeitraffer</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2009/04/18/1-jahr-uniklinkikbau-zeitraffer#comments</comments>
		<pubDate>Sat, 18 Apr 2009 10:06:16 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[time lapse]]></category>
		<category><![CDATA[uni ulm]]></category>
		<category><![CDATA[uniklinikum]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=125</guid>
		<description><![CDATA[Seit nunmehr einem Jahr speichere ich die Bilder, die eine Webcam über der Baustelle der neuen Uniklinik in Ulm macht. Das letzte Zeitraffervideo habe ich im Dezember 2008 erstellt und nun war es Zeit nochmal eines zu machen. Diesmal ist es etwas kürzer, da ich nur zwei Bilder pro Tag verwende. 

Für die volle Pracht [...]]]></description>
			<content:encoded><![CDATA[<p>Seit nunmehr einem Jahr speichere ich die Bilder, die eine Webcam über der Baustelle der neuen Uniklinik in Ulm macht. Das <a href="http://michi.ist.inspirationslos.de/2008/12/22/time-lapse-video/">letzte Zeitraffervideo</a> habe ich im Dezember 2008 erstellt und nun war es Zeit nochmal eines zu machen. Diesmal ist es etwas kürzer, da ich nur zwei Bilder pro Tag verwende. </p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/VZbxU3tQ6eE&#038;hl=de&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VZbxU3tQ6eE&#038;hl=de&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>Für die volle Pracht auf den HD Button drücken!</p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2009/04/18/1-jahr-uniklinkikbau-zeitraffer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino/Meggy Jr Upload Error</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2009/04/07/arduinomeggy-jr-upload-fehler</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2009/04/07/arduinomeggy-jr-upload-fehler#comments</comments>
		<pubDate>Tue, 07 Apr 2009 19:32:41 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[meggy]]></category>
		<category><![CDATA[meggy jr rgb]]></category>
		<category><![CDATA[sleepless nights debugging]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=120</guid>
		<description><![CDATA[
If you are using Meggy Jr with the Serial-to-USB Cable provided in the Evil Mad Scientist shop you might encounter the following error:
avrdude: stk500_getsync(): not in sync: resp=0&#215;00
avrdude: stk500_disable(): protocol error, expect=0&#215;14, resp=0&#215;51
The error manifest while uploading a new sketch to Meggy. If you pull out the USB cable and plug it in again you [...]]]></description>
			<content:encoded><![CDATA[
<p>If you are using Meggy Jr with the Serial-to-USB Cable provided in the Evil Mad Scientist shop you might encounter the following error:</p>
<blockquote><p><em>avrdude: stk500_getsync(): not in sync: resp=0&#215;00<br />
avrdude: stk500_disable(): protocol error, expect=0&#215;14, resp=0&#215;51</em></p></blockquote>
<p>The error manifest while uploading a new sketch to Meggy. If you pull out the USB cable and plug it in again you can upload a sketch successful. But on the next time you try you&#8217;ll get the error again. Luckily there is a pretty simple solution. I found it while digging through the Evil Mad Scientist Forums. It involves setting the &#8220;Set RTS on close&#8221; flag of the COM Port. You can do this in the Device Manager. Find the COM Port that was installed when you first plugged in the USB-to-Serial cable. For me it&#8217;s COM3. In the connection settings click on details and mark the flag selected. That&#8217;s it. I tried this on Windows XP with Service Pack 3, but it should work similiarily on other Windows versions.</p>
<div id="attachment_121" class="wp-caption alignnone" style="width: 310px"><a href="http://michi.ist.inspirationslos.de/files/2009/04/comeinstellungen02.jpg"><img class="size-medium wp-image-121" title="COMPortEinstellungenMeggyJr" src="http://michi.ist.inspirationslos.de/files/2009/04/comeinstellungen02-300x214.jpg" alt="RTS Flag" width="300" height="214" /></a><p class="wp-caption-text">RTS Flag</p></div>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2009/04/07/arduinomeggy-jr-upload-fehler/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erstes Meggy Jr Programm</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2009/04/05/erstes-meggy-jr-programm</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2009/04/05/erstes-meggy-jr-programm#comments</comments>
		<pubDate>Sun, 05 Apr 2009 16:34:25 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[meggy]]></category>
		<category><![CDATA[meggy jr rgb]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=114</guid>
		<description><![CDATA[
Today I finished my first Meggy Jr program. The programming with the Arduino IDE was easy as expected. I wrote a simple Color Chooser application that let&#8217;s the user explore the variety of colors available on Meggy Jr.  Meggy Jr&#8217;s &#60;em&#62;Simple Library&#60;/em&#62; only knows 16 predefined colors. It is possible though to define more colors [...]]]></description>
			<content:encoded><![CDATA[
<p>Today I finished my first Meggy Jr program. The programming with the Arduino IDE was easy as expected. I wrote a simple Color Chooser application that let&#8217;s the user explore the variety of colors available on Meggy Jr.  Meggy Jr&#8217;s &lt;em&gt;Simple Library&lt;/em&gt; only knows 16 predefined colors. It is possible though to define more colors with the Method <code>EditColor(byte color, byte r, byte g, byte b)</code> in which you simply specify the amount of red, green and blue you want in your final color. Each component takes a byte as input and therefore Meggy can display 4096 different colors, theoretically. In practice you will find that even small values for the blue component will make the resulting color blue.</p>
<p>In my last <a href="http://michi.ist.inspirationslos.de/2009/04/04/meggy-jr-rgb/" target="_self">blog entry</a> I mentioned that it is possibly to write data to the pc via a serial connection. The Color Chooser makes use of this feature and writes back the current color and its components to the pc so you can use the values in another project.</p>
<p>I made a video of the running application. The quality sucks, but you&#8217;ll get the idea:</p>
<p><object width="425" height="344" data="http://www.youtube.com/v/kGUu1PVKy5c&amp;hl=de&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/kGUu1PVKy5c&amp;hl=de&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>

<p>During the programming I used the Meggy Jr Programming Guide, a pretty helpful document. You can get it at the <a href="http://www.evilmadscientist.com/article.php/meggyjr" target="_blank">Evil Mad Scientist Laboratories</a>.</p>
<p>The sourcecode of this application is available as <a href="http://michi.ist.inspirationslos.de/files/2009/04/colorchooser.pde" target="_self">download</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2009/04/05/erstes-meggy-jr-programm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meggy Jr RGB</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2009/04/04/meggy-jr-rgb</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2009/04/04/meggy-jr-rgb#comments</comments>
		<pubDate>Sat, 04 Apr 2009 14:58:04 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[meggy]]></category>
		<category><![CDATA[meggy jr rgb]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=102</guid>
		<description><![CDATA[Ich weiss garnicht mehr genau wann und wo ich Meggy Jr RGB zum ersten mal gesehen habe, aber mir war sofort klar, dass ich so ein Ding brauche! Meggy ist eine do-it-yourself Spielekonsole. Das bedeutet, dass man es selbst zusammenbaut und optional auch selbst Programme dafür schreibt. Entwickelt wurde das ganze von Evil Mad Scientist [...]]]></description>
			<content:encoded><![CDATA[<p>Ich weiss garnicht mehr genau wann und wo ich Meggy Jr RGB zum ersten mal gesehen habe, aber mir war sofort klar, dass ich so ein Ding brauche! Meggy ist eine do-it-yourself Spielekonsole. Das bedeutet, dass man es selbst zusammenbaut und optional auch selbst Programme dafür schreibt. Entwickelt wurde das ganze von <a href="http://evilmadscientist.com/">Evil Mad Scientist Laboratories</a> als open-source Hardwareprojekt. Open-source bedeutet in diesem Zusammenhang, dass sowohl das Layout der Platine sowie die für die Programmierung benötigten Librarys frei erhältlich sind. In Meggy werkelt ein Atmega 168 Microcontroller vor sich hin. Meggy baut, im Hinblick auf einfache Toolchains und Prototyping-Qualitäten, auf <a href="http://www.arduino.cc">Arduino</a> auf. </p>
<p>Neben dem Microcontroller ist das Display sicherlich mit das größte Feature: Es ist eine LED Matrix bestehen aus 8&#215;8 Elementen, die jeweils eine große Anzahl verschiedener Farben anzeigen können. Eine Auflösung von 8 auf 8 Pixel hört sich zwar klein an, aber schon die mitgelieferten Spiele zeigen, dass durchaus einiges Potential für gute Spiele vorhanden ist. Bisher habe ich sehr spaßige Meggy-Versionen von Frogger und Space Invaders gespielt. Das vorinstallierte Spiel ist ein sidescrolling Shoot-em-up bei dem man laut Beschreibung die Welt vor ein paar Tomaten rettet :) Es gibt sogar ein Meggy Roguelike (<a href="http://tinysubversions.blogspot.com/search/label/meggyjr">hier</a>), allerdings habe ich es noch nicht selbst gespielt.</p>
<p>Aber Meggy eignet sich nicht nur als Spielekonsole. Mittlerweile gibt es auch eine ganze Reihe von Anwendungen die mit Spielen an sich nichts zu tun haben. Begünstigt wird das durch eine Serial Port mit dem man Meggy mit dem Rest der Welt sprechen lassen kann. Durch die Wahl von Arduino als Entwicklungsumgebung genügt dafür eine einzige Zeile für die Initialisierung und anschließend ein <code>Serial.println("...");</code> um Text den Serial Port runterzuschicken. Als Beispiel sei hier mal das Projekt genannt in dem Meggy zusammen mit einem Arduino WaveShield als Sequenzer benutzt wird: <a href="http://www.youtube.com/watch?v=ZMUG8p_JCpY">MeggySeq</a></p>
<p>Hier ein paar Bilder vom Zusammenbauen:</p>
<div id="attachment_106" class="wp-caption alignnone" style="width: 310px"><a href="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau01.jpg"><img src="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau01-300x225.jpg" alt="Meggys Platine" title="meggyjrrgb-bau01" width="300" height="225" class="size-medium wp-image-106" /></a><p class="wp-caption-text">Meggys Platine</p></div><br />
<div id="attachment_107" class="wp-caption alignnone" style="width: 310px"><a href="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau02.jpg"><img src="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau02-300x225.jpg" alt="Heh, ohne Kommentar.. " title="meggyjrrgb-bau02" width="300" height="225" class="size-medium wp-image-107" /></a><p class="wp-caption-text">Heh, ohne Kommentar.. </p></div><br />
<div id="attachment_108" class="wp-caption alignnone" style="width: 310px"><a href="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau03.jpg"><img src="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau03-300x225.jpg" alt="Halbfertig mit Microcontroller und LED Treiber" title="meggyjrrgb-bau03" width="300" height="225" class="size-medium wp-image-108" /></a><p class="wp-caption-text">Halbfertig mit Microcontroller und LED Treiber</p></div><br />
<div id="attachment_109" class="wp-caption alignnone" style="width: 310px"><a href="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau04.jpg"><img src="http://michi.ist.inspirationslos.de/files/2009/04/meggyjrrgb-bau04-300x225.jpg" alt="Meggy Jr RGB fertig zusammengebaut" title="meggyjrrgb-bau04" width="300" height="225" class="size-medium wp-image-109" /></a><p class="wp-caption-text">Meggy Jr RGB fertig zusammengebaut</p></div>
]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2009/04/04/meggy-jr-rgb/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GLSL Shader in Java mit LWJGL</title>
		<link>http://michi.ist.inspirationslos.de/lang/en/2008/12/29/glsl-shader-in-java-mit-lwjgl</link>
		<comments>http://michi.ist.inspirationslos.de/lang/en/2008/12/29/glsl-shader-in-java-mit-lwjgl#comments</comments>
		<pubDate>Mon, 29 Dec 2008 14:46:26 +0000</pubDate>
		<dc:creator>michi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[glsl]]></category>
		<category><![CDATA[lwjgl]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://michi.ist.inspirationslos.de/?p=81</guid>
		<description><![CDATA[Shaderprogrammierung in GLSL, der Shadersprache unter OpenGL, war bisher ein Buch mit sieben Siegeln für mich. Aber da man ja alles lernen kann habe ich mich auf die Suche nach Tutorials gemacht und auch einige sehr gute entdeckt. Die Einführung von Lighthouse3d ist zum Beispiel sehr zu empfehlen. Hier wird wirklich mit den Grundlagen angefangen [...]]]></description>
			<content:encoded><![CDATA[<p>Shaderprogrammierung in GLSL, der Shadersprache unter OpenGL, war bisher ein Buch mit sieben Siegeln für mich. Aber da man ja alles lernen kann habe ich mich auf die Suche nach Tutorials gemacht und auch einige sehr gute entdeckt. Die Einführung von <a href="http://www.lighthouse3d.com/opengl/glsl/index.php?intro">Lighthouse3d</a> ist zum Beispiel sehr zu empfehlen. Hier wird wirklich mit den Grundlagen angefangen und erstmal eine Beschreibung geliefert wie die Pipeline der Grafikkarten aufgebaut sind und wo genau die verschiedenen Shader zum Einsatz kommen. </p>
<p>Natürlich muss man die geschriebenen (oder abgetippten) Shader auch irgendwie ausprobieren. Hier fand ich das Programm <a href="http://www.typhoonlabs.com/">ShaderDesigner</a> von Typhoon Labs ganz brauchbar. Leider scheint es die Firma nicht mehr zu geben, aber sowohl ShaderDesigner als auch ein ebenfalls super geschriebenes Tutorial für Shader lassen sich nach wie vor von der Seite runterladen. </p>
<p>Schließlich habe ich mich daran gemacht, die Shader auch in einem wirklichen Programm einzusetzen. Hierfür verwende ich die &#8220;Light Weight Java Games Library&#8221; (<a href="http://www.lwjgl.org">LWJGL</a>), meinem Lieblingsbinding von OpenGL an Java. Es stellte sich heraus, dass wenn man mal einen funktionierenden Shader hat, diesen wirklich einfach in ein Programm einbinden kann. Wirklich geholfen hat mir der entsprechende <a href="http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicshaders">Wikieintrag</a> im LWJGL Wiki. Am besten speichert man Vertex- und Fragmentshader in einer Textdatei und legt sie irgendwo im Projektverzeichnis ab. Im Programm werden die Dateien dann mit ganz gewöhnlichen Hausmitteln erstmal geöffnet und in einem Bytearray gespeichert. Dies muss natürlich sowohl für Vertex- als auch für Fragmentshader passieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #003399;">ClassLoader</span> loader <span style="color: #339933;">=</span> ShaderTest.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getClassLoader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #003399;">InputStream</span> is <span style="color: #339933;">=</span> loader.<span style="color: #006633;">getResourceAsStream</span><span style="color: #009900;">&#40;</span>shadername<span style="color: #009900;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> shadercode <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span>;
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">DataInputStream</span> dis <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DataInputStream</span><span style="color: #009900;">&#40;</span>is<span style="color: #009900;">&#41;</span>;
    dis.<span style="color: #006633;">readFully</span><span style="color: #009900;">&#40;</span>shadercode <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span>is.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
    dis.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    is.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Anschließend werden die Bytearrays in einen ByteBuffer kopiert, den LWJGL lieber mag:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;">ByteBuffer shader <span style="color: #339933;">=</span> BufferUtils.<span style="color: #006633;">createByteBuffer</span><span style="color: #009900;">&#40;</span>shadercode.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span>;
shader.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>shadercode<span style="color: #009900;">&#41;</span>;
shader.<span style="color: #006633;">flip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>Nicht vergessen die Buffer zu flippen!<br />
Anschließend teilen wir OpenGL mit, dass wir zwei neue Shaderobjekte brauchen. Dies funktioniert genau wie wenn man eine Textur anlegt: Man teilt OpenGL mit, was man haben will und bekommt ein int zurück, mit dem man das neue Objekt referenzieren kann:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> vertexShaderID <span style="color: #339933;">=</span> ARBShaderObjects.<span style="color: #006633;">glCreateShaderObjectARB</span><span style="color: #009900;">&#40;</span>
ARBVertexShader.<span style="color: #006633;">GL_VERTEX_SHADER_ARB</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">int</span> pixelShaderID <span style="color: #339933;">=</span> ARBShaderObjects.<span style="color: #006633;">glCreateShaderObjectARB</span><span style="color: #009900;">&#40;</span>
ARBFragmentShader.<span style="color: #006633;">GL_FRAGMENT_SHADER_ARB</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>Nachdem die entsprechenden Objekte nun OpenGL bekannt gemacht wurden müssen wir OpenGL nun mitteilen was die Shader genau machen sollen, sprich deren Quellcode übergeben. Danach werden die Shader kompiliert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;">ARBShaderObjects.<span style="color: #006633;">glShaderSourceARB</span><span style="color: #009900;">&#40;</span>vertexShaderID, vertexShader<span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glCompileShaderARB</span><span style="color: #009900;">&#40;</span>vertexShaderID<span style="color: #009900;">&#41;</span>;
&nbsp;
ARBShaderObjects.<span style="color: #006633;">glShaderSourceARB</span><span style="color: #009900;">&#40;</span>pixelShaderID, pixelShader<span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glCompileShaderARB</span><span style="color: #009900;">&#40;</span>pixelShaderID<span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>vertexShader und pixelShader sind die Variablen, die auf die ByteBuffer zeigen und den eingelesenen Quelltext enthalten.<br />
Die beiden Shader werden nun zu einem Programm zusammengebunden. Ein Programm wird dabei ebenso wie ein Shaderobjekt erstellt: bei einem Methodenaufruf erhalten wir ein int mit dem wir das Programm in Zukunft referenzieren. Hat man nur einen Vertex- oder nur einen Fragmentshader zur Hand wird der jeweils andere Teil von OpenGL durch eine Standartimplementierung ersetzt. Zum Schluß werden die Teile ähnlich einem C Programm zusammengebunden.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> shaderProgramID <span style="color: #339933;">=</span> ARBShaderObjects.<span style="color: #006633;">glCreateProgramObjectARB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glAttachObjectARB</span><span style="color: #009900;">&#40;</span>shaderProgramID, vertexShaderID<span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glAttachObjectARB</span><span style="color: #009900;">&#40;</span>shaderProgramID, pixelShaderID<span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glLinkProgramARB</span><span style="color: #009900;">&#40;</span>shaderProgramID<span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>Jetzt sind wir fertig und können den Shader beim Rendern benutzen. Hierzu ruft man im Renderloop bevor das Objekt das den Shader erhalten soll gezeichnet wird die folgende Methode auf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;">ARBShaderObjects.<span style="color: #006633;">glUseProgramObjectARB</span><span style="color: #009900;">&#40;</span>shaderProgramID<span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p>Wird anstatt einem Shaderprogramm &#8220;0&#8243; übergeben benutzt OpenGL die Standarteinstellungen (fixed Pipeline) zum Rendern.</p>
<p>Ein kleiner Test mit einem Toon-Shader aus dem Lighthouse Tutorial sieht dann zum Beispiel so aus:<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/tehoMVoUHb4&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/tehoMVoUHb4&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>Die Veränderung der Farbe des 3d Modells hängt nicht mit dem Licht zusammen sondern wird im Fragmentshader verursacht. Hierzu wird eine Variable vom Javaprogramm aus an den Shader übergeben, die die Zeit seit dem Beginn der Anwendung übergibt. Im Fragmentshader ist die Variable so definiert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;">uniform <span style="color: #000066; font-weight: bold;">float</span> TIME_SINCE_INIT;</pre></td></tr></table></div>

<p>Bei jedem Durchlauf des Renderloops wird diese Variable vom Javaprogramm neu geschrieben. Um den Schreibvorgang durchzuführen wird vorher die Location der Variable bestimmt. Dazu wird OpenGL der mit 0 terminierte Name der Variablen übergeben. Existiert diese, dann liefert OpenGL eine Location in Form eines Integers zurück und man kann mit einem glUniform1fARB-Aufruf den Wert übergeben.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;">ByteBuffer buff <span style="color: #339933;">=</span> BufferUtils.<span style="color: #006633;">createByteBuffer</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">&quot;TIME_SINCE_INIT&quot;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
buff.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;TIME_SINCE_INIT&quot;</span>.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>;
buff.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#41;</span>0<span style="color: #009900;">&#41;</span>;
buff.<span style="color: #006633;">flip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">int</span> location <span style="color: #339933;">=</span> ARBShaderObjects.<span style="color: #006633;">glGetUniformLocationARB</span><span style="color: #009900;">&#40;</span>
    shaderProgramID, buff<span style="color: #009900;">&#41;</span>;
ARBShaderObjects.<span style="color: #006633;">glUniform1fARB</span><span style="color: #009900;">&#40;</span>location, gameLogicTimer.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://michi.ist.inspirationslos.de/lang/en/2008/12/29/glsl-shader-in-java-mit-lwjgl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
