<?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>CM &#187; Misc Programming</title>
	<atom:link href="http://corymathews.com/category/misc-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://corymathews.com</link>
	<description>Things I should remember and then some...</description>
	<lastBuildDate>Thu, 26 Jan 2012 16:27:17 +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>HTML5 Video Observations</title>
		<link>http://corymathews.com/html5-video-observations/</link>
		<comments>http://corymathews.com/html5-video-observations/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 18:07:00 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Misc Programming]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=645</guid>
		<description><![CDATA[First off my goal is to run a bunch of 3-5 minute videos on any 1 single browser on a windows machine, It will run as a kiosk and will not have Internet access. So this finally gives me a good reason to play around with the &#60;video&#62; tag. The videos were provided in a [...]]]></description>
			<content:encoded><![CDATA[<p>First off my goal is to run a bunch of 3-5 minute videos on any 1 single browser on a windows machine, It will run as a kiosk and will not have Internet access. So this finally gives me a good reason to play around with the &lt;video&gt; tag.</p>
<p>The videos were provided in a .mov format so being lazy I tried just sticking those videos in to chrome and it worked&#8230; sorta.</p>
<pre class="prettyprint linenumstrigger linenums">&lt;video width=800 height=600&gt;&lt;source src=video.mov&gt;&lt;/video&gt;</pre>
<h2>Sound Played Every Other Load</h2>
<p>Very quickly the problems started occurring. First off the <a href="http://stackoverflow.com/questions/4248404/sound-plays-every-other-time-the-video-plays-in-chrome">sound stopped playing</a> every other time the video was played.</p>
<p>That seems to be a bug and to fix it I had to  remove the old video tag and replace it every time I played a video.</p>
<h2>Video Load Performance  Problems</h2>
<p>Then I moved from the short demo videos (10 secs) to the full 3 min videos and right off the bat, I saw huge performance delays. So slow that it appeared the videos would not show and the Task Manager did not show activity. <strong>Perhaps there is a file max size I have missed? </strong></p>
<p>Now faced with this major performance problem I set out to see which video format worked fastest on which browser, since I had the luxury of picking a browser.</p>
<p>I converted the video into the .ogv, .mp4 (H.264) and .webm using the  <a href="http://www.mirovideoconverter.com/">Miro Video Converter</a> (Which is REALLY easy and simple). It gave me the following file sizes.</p>
<ul>
<li>.mov &#8211; 631,964KB (Original File)</li>
<li>.mp4 &#8211; 210,954KB</li>
<li>.mp4 &#8211; 66,280KB*</li>
<li>.ogv &#8211; 144,690KB</li>
<li>.webm &#8211; 25,315KB</li>
</ul>
<p>*I ended up using the Adobe Media Encoder to reconvert the second (smaller) .mp4 because it gave better compression and wanted to see what kind of difference it made.</p>
<p>Using the following 3 browsers:</p>
<ul>
<li>Firefox 3.6.12</li>
<li>Chrome 7.0.517.44</li>
<li>Opera 10.63</li>
</ul>
<p>Heres how each format worked in them.</p>
<p><strong>Firefox</strong>:</p>
<ul>
<li>.mov, .mp4 and .webm &#8211; do not run</li>
<li>.ogv &#8211; ran but was very slow to start, after that the video was smooth.</li>
</ul>
<p><strong>Chrome</strong>:</p>
<ul>
<li>.mov &#8211; would not run</li>
<li>.mp4 &#8211; would not run</li>
<li>.mp4 (smaller) &#8211; ran smoothly but took a minute to appear</li>
<li>.ogv &#8211; seems to be sized differently, runs really jagged, and just overall unacceptable.</li>
<li>.webm &#8211; Extremely responsive, but the quality was plain awful.</li>
</ul>
<p><strong>Opera</strong>:</p>
<ul>
<li>.mov, .mp4 &#8211; does not run</li>
<li>.ogv &#8211; Responsive and smooth.</li>
<li>.webm &#8211; Extremely responsive, but the quality was awful. (same as chromes webm)</li>
</ul>
<p>Before I started I assumed Chrome/WebM would be the best overall bet, just from the chatter it has been creating. But it seems that I was wrong.</p>
<p><strong>Overall the .ogv on Opera seemed to be the best option. </strong></p>
<p>It does seem that there is a very apparent association between file-size and initial load time. (bandwidth ignored) But nothing I could find written on the matter, or how to improve it. (<a href="http://twitter.com/#!/CoryMathews">@CoryMathews</a> if you know)</p>
<p>After all this it still seems like the HTML5 video tag is far from ready, but its a hell of a lot nicer to use then flash.</p>
<h2>Great HTML5 Video Tag Articles</h2>
<ul>
<li><a title="HTML5 Video Introduction" href="http://dev.opera.com/articles/view/introduction-html5-video/">Introduction to HTML5 Video &#8211; dev.opera.com</a></li>
<li><a title="HTML5 Video and Audio 2" href="http://my.opera.com/core/blog/2010/03/03/everything-you-need-to-know-about-html5-video-and-audio-2">Everything you need to know about HTML5 Video and Audio 2 &#8211; dev.opera.com</a></li>
<li><a title="HTML5 Video" href="http://diveintohtml5.org/video.html">HTML5 Video &#8211; diveintohtml5.org</a></li>
</ul>
<h2>Sample Source  Code</h2>
<p>Page Structure-ish</p>
<pre class="prettyprint linenumstrigger linenums">...
&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;style&gt;
  #VideoShow { display:none; top:0; left:0; }
  #closeVid { position:absolute; top:0;z-index:5; display:none; }
&lt;/style&gt;
...
&lt;div id=&quot;But1&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;But2&quot;&gt;&lt;/div&gt;
...
&lt;div id='closeVid'&gt;&lt;img src='close.jpg'&gt;&lt;/div&gt;
&lt;div id=&quot;VideoShow&quot;&gt;&lt;/div&gt;
...
$(&quot;#But1&quot;).click(function(){ playVideo(&quot;video.mov&quot;); });
$(&quot;#But2&quot;).click(function(){ playVideo(&quot;video.mp4&quot;); &Acirc;&nbsp;});

function playVideo(videoName) {
  $(&quot;#VideoShow&quot;).fadeIn(300).html(&quot;&lt;video width=800 height=600&gt;&lt;source src=\&quot;&quot; + videoName + &quot;\&quot;'&gt;&lt;/video&gt;&quot;);
  $(&quot;#closeVid&quot;).fadeIn(300);
  var Vid = document.getElementsByTagName('video')[0];
  Vid.play();
  Vid.addEventListener('ended', function(e) {
    closeVideo();
  }, false);
}

function closeVideo() {
  var Vid = document.getElementsByTagName('video')[0];
  Vid.removeEventListener('ended', arguments.callee, false);
  $(&quot;#VideoShow&quot;).fadeOut(300).html(&quot;&quot;);
  $(&quot;#closeVid&quot;).fadeOut(100)
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/html5-video-observations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing a Blender Model into OpenGL</title>
		<link>http://corymathews.com/importing-a-blender-model-into-opengl/</link>
		<comments>http://corymathews.com/importing-a-blender-model-into-opengl/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 05:10:53 +0000</pubDate>
		<dc:creator>CoryMathews</dc:creator>
				<category><![CDATA[Misc Programming]]></category>

		<guid isPermaLink="false">http://corymathews.com/?p=204</guid>
		<description><![CDATA[Recently I was looking for a simple way to export a basic model from blender to use in my opengl code written with c++. After a few searches I came up with nothing and decided to look at all the different ways I could export a blender file. The first that was easy enough to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was looking for a simple way to export a basic model from blender to use in my opengl code written with c++. After a few searches I came up with nothing and decided to look at all the different ways I could export a blender file. The first that was easy enough to recognize the pattern right away was the the Raw Faces (.raw) format.</p>
<p>I quickly created a very basic (and very bad) model of a cup to see how it looked when I exported the cup in the .raw format. You can export a blender model using this format by first selecting the object you want to export (For whatever reason only the selected object(s) will be exported.) Then go to File -&gt; Export -&gt; Raw Faces(.raw). This is what I got after exporting. There shouldn&#8217;t be line wraps, however depending on your monitor you may see them. You can download the file in .raw format <a href="http://corymathews.com/wp-content/uploads/2009/01/cup.raw">here</a>.</p>
<blockquote><p>0.011633 -0.011633 0.011633 -0.001836 -0.016245 0.011633 -0.001512 -0.011633 -0.011633 0.008956 -0.008956 -0.011633<br />
-0.001836 -0.016245 0.011633 -0.011633 -0.011633 0.011633 -0.008956 -0.008956 -0.011633 -0.001512 -0.011633 -0.011633<br />
0.008956 0.008956 -0.011633 -0.001512 0.011633 -0.011633 -0.001836 0.016993 0.011633 0.011633 0.011633 0.011633<br />
-0.001512 0.011633 -0.011633 -0.008956 0.008956 -0.011633 -0.011633 0.011633 0.011633 -0.001836 0.016993 0.011633<br />
0.011633 -0.001745 -0.011633 0.008956 0.008956 -0.011633 0.011633 0.011633 0.011633 0.016943 -0.002119 0.011633<br />
0.016943 -0.002119 0.011633 0.011633 -0.011633 0.011633 0.008956 -0.008956 -0.011633 0.011633 -0.001745 -0.011633<br />
-0.011633 -0.011633 0.011633 -0.016295 -0.002119 0.011633 -0.011633 -0.001745 -0.011633 -0.008956 -0.008956 -0.011633<br />
-0.016295 -0.002119 0.011633 -0.011633 0.011633 0.011633 -0.008956 0.008956 -0.011633 -0.011633 -0.001745 -0.011633<br />
-0.001512 -0.011633 -0.011633 -0.001512 -0.001745 -0.011633 0.011633 -0.001745 -0.011633 0.008956 -0.008956 -0.011633<br />
0.008956 0.008956 -0.011633 0.011633 -0.001745 -0.011633 -0.001512 -0.001745 -0.011633 -0.001512 0.011633 -0.011633<br />
-0.008956 -0.008956 -0.011633 -0.011633 -0.001745 -0.011633 -0.001512 -0.001745 -0.011633 -0.001512 -0.011633 -0.011633<br />
-0.011633 -0.001745 -0.011633 -0.008956 0.008956 -0.011633 -0.001512 0.011633 -0.011633 -0.001512 -0.001745 -0.011633<br />
-0.011633 0.011633 0.011633 -0.016295 -0.002119 0.011633 -0.013645 -0.001861 0.011633 -0.009766 0.009583 0.011633<br />
-0.016295 -0.002119 0.011633 -0.011633 -0.011633 0.011633 -0.009766 -0.009779 0.011633 -0.013645 -0.001861 0.011633<br />
0.011633 -0.011633 0.011633 0.016943 -0.002119 0.011633 0.014015 -0.001861 0.011633 0.009596 -0.009779 0.011633<br />
0.016943 -0.002119 0.011633 0.011633 0.011633 0.011633 0.009596 0.009583 0.011633 0.014015 -0.001861 0.011633<br />
-0.011633 -0.011633 0.011633 -0.001836 -0.016245 0.011633 -0.001613 -0.013616 0.011633 -0.009766 -0.009779 0.011633<br />
-0.001836 -0.016245 0.011633 0.011633 -0.011633 0.011633 0.009596 -0.009779 0.011633 -0.001613 -0.013616 0.011633<br />
-0.001836 0.016993 0.011633 -0.011633 0.011633 0.011633 -0.009766 0.009583 0.011633 -0.001613 0.014044 0.011633<br />
0.011633 0.011633 0.011633 -0.001836 0.016993 0.011633 -0.001613 0.014044 0.011633 0.009596 0.009583 0.011633<br />
0.009596 0.009583 0.011633 -0.001613 0.014044 0.011633 -0.001311 0.010066 -0.007815 0.006850 0.006819 -0.007815<br />
-0.001613 0.014044 0.011633 -0.009766 0.009583 0.011633 -0.007247 0.006819 -0.007815 -0.001311 0.010066 -0.007815<br />
-0.001613 -0.013616 0.011633 0.009596 -0.009779 0.011633 0.006850 -0.007278 -0.007815 -0.001311 -0.010072 -0.007815<br />
-0.009766 -0.009779 0.011633 -0.001613 -0.013616 0.011633 -0.001311 -0.010072 -0.007815 -0.007247 -0.007278 -0.007815<br />
0.014015 -0.001861 0.011633 0.009596 0.009583 0.011633 0.006850 0.006819 -0.007815 0.010067 -0.001513 -0.007815<br />
0.009596 -0.009779 0.011633 0.014015 -0.001861 0.011633 0.010067 -0.001513 -0.007815 0.006850 -0.007278 -0.007815<br />
-0.013645 -0.001861 0.011633 -0.009766 -0.009779 0.011633 -0.007247 -0.007278 -0.007815 -0.010071 -0.001513 -0.007815<br />
-0.009766 0.009583 0.011633 -0.013645 -0.001861 0.011633 -0.010071 -0.001513 -0.007815 -0.007247 0.006819 -0.007815<br />
-0.001311 0.010066 -0.007815 -0.001115 -0.001287 -0.007815 0.010067 -0.001513 -0.007815 0.006850 0.006819 -0.007815<br />
-0.001115 -0.001287 -0.007815 -0.001311 -0.010072 -0.007815 0.006850 -0.007278 -0.007815 0.010067 -0.001513 -0.007815<br />
-0.007247 0.006819 -0.007815 -0.010071 -0.001513 -0.007815 -0.001115 -0.001287 -0.007815 -0.001311 0.010066 -0.007815<br />
-0.010071 -0.001513 -0.007815 -0.007247 -0.007278 -0.007815 -0.001311 -0.010072 -0.007815 -0.001115 -0.001287 -0.007815</p></blockquote>
<p>Basically, if you haven&#8217;t already noticed, it is 4 sets of x,y,z points. You will not get any of the materials when you export the object only the polygons.</p>
<p>Now that we have our object we will need to be able to display it using opengl. First we must read in and store the points. </p>
<blockquote><p>CupVectors[3][4][33];</p>
<p>ifstream cupFile;<br />
cupFile.open(&#8220;cup.raw&#8221;);</p>
<p>for(int z=0;z&lt;=32;z++)<br />
for(int y=0;y&lt;=3;y++)<br />
for(int x=0;x&lt;=2;x++)<br />
cupFile &gt;&gt; CupVectors[x][y][z];</p>
<p>cupFile.close();</p></blockquote>
<p>Pretty simple code. Store the points, open the file, loop through the points, store the points, close the file.</p>
<p>Now that the cup vertex points are stored we are able to easily display them in opengl with another small loop that will create the triangles and save them in our display list.</p>
]]></content:encoded>
			<wfw:commentRss>http://corymathews.com/importing-a-blender-model-into-opengl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

