<?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>Lost in the Triangles &#187; rant</title>
	<atom:link href="http://aras-p.info/blog/tags/rant/feed/" rel="self" type="application/rss+xml" />
	<link>http://aras-p.info/blog</link>
	<description>Random thoughts of a triangle pusher</description>
	<lastBuildDate>Fri, 16 Jul 2010 07:04:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Improving C#/Mono for Games</title>
		<link>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/</link>
		<comments>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 19:07:24 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=442</guid>
		<description><![CDATA[A tweet by Michael Hutchinson on C#/Mono usage in games caused me to do a couple of short replies (one, two). But then I started thinking a bit more, and here&#8217;s a longer post on what is needed for C# (and more specifically Mono) to be used in games more. In Unity we use Mono [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://twitter.com/mjhutchinson/status/5643232459">tweet by Michael Hutchinson</a> on C#/Mono usage in games caused me to do a couple of short replies (<a href="http://twitter.com/aras_p/status/5643338294">one</a>, <a href="http://twitter.com/aras_p/status/5643361286">two</a>). But then I started thinking a bit more, and here&#8217;s a longer post on what is needed for C# (and more specifically Mono) to be used in games more.</p>
<p>In <a href="http://unity3d.com/">Unity</a> we use Mono to do game code (well, Unity users are doing that, not us). Overall it&#8217;s great; it has tons of advantages, loads of awesome and a flying ninja here and there. But no technology is perfect, right?</p>
<p><strong>Edit</strong>: Miguel rightly points out in the comments that Mono team is solving or has already solved some of these issues already. In some areas they are moving so fast that we at Unity can&#8217;t keep up!</p>
<p><span id="more-442"></span><br />
<strong>#1: Garbage Collector</strong></p>
<p>Most game developers do not like Garbage Collection (GC) very much. Typically, the more limited/hardcore their target platform is, the more they dislike GC. The reason? Most GC implementations cause rather unpredictable spikes.</p>
<p>Here&#8217;s a run of something recorded in the <em>(awesome)</em> Unity 2.6 profiler. Horizontal axis is time, vertical is CPU time spent in that frame:<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2009/11/gcspikes.png"><img src="http://aras-p.info/blog/wp-content/uploads/2009/11/gcspikes.png" alt="Garbage collection spikes" title="Garbage collection spikes" width="563" height="187" class="alignnone size-full wp-image-441" /></a></p>
<p>At the bottom you see dark red thingies appearing once in a while. This is garbage collector kicking in, because some script code is allocating some memory at runtime.</p>
<p>Now of course, it <em>is possible</em> to write your script code so that it does no allocations (or almost no allocations). Preallocate your objects into pools, manually invoke GC when there&#8217;s a game situation when a small hickup won&#8217;t affect gameplay, etc. In fact, a lot of iPhone games made with Unity do that.</p>
<p>But that kind of side steps the whole advantage of &#8220;garbage collector almost frees you from doing memory management&#8221;. If you&#8217;re not allocating anything anyway, GC could just as well not be there!</p>
<p>A little side story. Me and Unity&#8217;s iPhone tech lead ReJ tried to explain what GC is to a non-programmer. Here&#8217;s what we came up with:</p>
<blockquote><p>
Garbage Collection is this cleaning service for lazy people. They can just leave any garbage on the floor in their house, and once in a while a garbage guy comes, collects all the garbage and takes it outside. Now, there are some intricacies in the service.</p>
<p>First, you never know when the garbage guy will come. You might be taking a shower, doing a meditation or having some &#8220;sexy time&#8221; &#8211; and it&#8217;s in the service agreement that when a garbage guy comes, you have to let him in to do his work.</p>
<p>Second thing is, the garbage guy is usually some homeless drunkard. He smells so bad that when he comes, you have to stop whatever you were doing, go outside and wait until he&#8217;s done with the garbage collection. Even your neighbors, who might be doing something entirely else in parallel, actually have to stop and idle while garbage is being collected in your house!</p>
<p>There are variations of this GC service. One variation is called &#8220;moving GC&#8221;, where the garbage guy also rearranges your furniture while collecting the garbage &#8211; he moves it all into one side of your house. This is so that you can buy a bigger piece of furniture, or throw a huge piece of garbage &#8211; and there will be enough unused space for you to do that! Of course this way GC process takes somewhat longer, but hey, you get all your stuff nicely packed into one corner.</p>
<p>Can&#8217;t you see that this service is the greatest idea of all time?
</p></blockquote>
<p>This is quite a harsh attitude towards GC, and of course it&#8217;s exaggerated. But there is some truth to it. So how could GC be fixed?</p>
<p><em>GC fix #1: more control</em></p>
<p>More explicit control on when &#038; how long GC runs. I want to say to the garbage guy, &#8220;come everyday at 4PM and do your work for 20 minutes&#8221;. In the game, I&#8217;d want to call GC with an upper time limit, say 1 millisecond for each call, and I would be calling that 30 times per second.</p>
<p><em>GC fix #2: sometimes I want to clean garbage myself</em></p>
<p>Inefficiencies and unpredictability of GC cause people to do even more work than a normal, oldskool memory allocation. Why not provide an option to deal with deallocations manually? I.e. a keyword <code>reallynew</code> could allocate an object that is not part of garbage collected world. It would function as a regular .NET object, just it would be user&#8217;s responsibility to <code>reallydelete</code> it.</p>
<p>Mono is already extending .NET (see <a href="http://tirania.org/blog/archive/2008/Nov-03.html">SIMD</a> and <a href="http://tirania.org/blog/archive/2009/Apr-09.html">continuations</a>). Maybe it makes sense to add some way to bypass garbage collector?</p>
<p><strong>#2: Distribution Size</strong></p>
<p>Using C#/.NET in a game requires having .NET runtime. None of the interesting platforms are guaranteed to have it, and even on Windows you can&#8217;t count on it being present. Mono is great here in a sense that it can be used on many more platforms than Microsoft&#8217;s own .NET. It&#8217;s also great on distribution size, but only if you compare it to Microsoft&#8217;s .NET.</p>
<p>In Unity Web Player, we package Mono DLL + mscorlib assembly into something like 1.5 megabytes (after LZMA compression). Which is great compared to 20+ megabytes of .NET runtime, but not that great it you compare it so, say, <a href="http://www.lua.org/">Lua</a> runtime (which is less than 100 kilobytes).</p>
<p>On some platforms (iPhone, Xbox 360, PS3, &#8230;) it&#8217;s not possible to generate code at runtime, so Mono&#8217;s JIT does not work. All code that&#8217;s written in C# has to be precompiled to machine code ahead of time (AOT compilation). This is not a problem per se, but because .NET framework was never designed with small size and few dependencies in mind, <em>doing anything</em> will ultimately pull in a lot of code.</p>
<p>We joke that doing anything in C# will result in an XML parser being included <em>somewhere</em>. This is not that far from the truth; e.g. calling <code>float.ToString()</code> will pull in whole internationalization system, which <em>probably</em> somewhere needs to read some global XML configuration file to figure out whether daylight savings time is active when Eastern European Brazilian Chinese calendar is used.</p>
<p><em>Size fix #1: custom core .NET libraries?</em></p>
<p>For game uses, most of &#8220;fat&#8221; stuff in .NET runtime is not really needed. <code>float.ToString()</code> could just always use period as a decimal separator. Core libraries could consist just of essential collections (list, array, hash table) and maybe a String class, with just essential methods. Maybe it&#8217;s worth sacrificing some of the generality of .NET if that could shave off a couple of megabytes from your iPhone game size?</p>
<p>Of course this is very much doable; &#8220;all that is needed&#8221; &#8482; is writing custom mscorlib+friends, and telling C# compiler to not ever reference <em>any</em> of the &#8220;real&#8221; libraries.</p>
<p><em>Size fix #2: make Mono runtime smaller</em></p>
<p>Uncompressed Mono DLL in our Windows build is 1.5 megabytes. We have turned off all the easy stuff (profiler, debugger, logging, COM, AOT etc.). But <em>probably</em> some more could be stripped away. Do our games really need multiple AppDomains? Some fancy marshalling? I don&#8217;t know, it just <em>feels</em> that 1.5MB is a lot.</p>
<p><strong>#3: Porting to New Platforms</strong></p>
<p>You know this classic: &#8220;There&#8217;s no portable code. There&#8217;s only code that&#8217;s been ported.&#8221;</p>
<p>Most existing gaming platforms are quite weird. Most upcoming smartphone platforms also are quite weird, each in their own interesting way. Porting a large project like Mono is not easy, especially since parts of it (JIT or AOT engine) highly depend on the platform.</p>
<p>For Unity iPhone, unexpected discovery that it&#8217;s not possible to JIT on iPhone made the initial release be delayed by something like 4 months. It did not help that in early iPhone SDK builds JIT was actually possible, and Apple decided to disable runtime generated code later. Making Mono actually work there required significant work both from Mono team and from Unity. We still have one guy working almost exclusively on Mono+iPhone issues!</p>
<p>Of course, <em>maybe</em> all the Mono iPhone work made porting to new platforms easier as a byproduct. But so far we don&#8217;t have Mono ported to any other platform, up to production quality. So judging from experience, we now always assume Mono port will be a pain, just because &#8220;some nasty surprises will come up&#8221; (and they always do).</p>
<p><strong>#4: Small Stuff</strong></p>
<p>There is a ton of small bits where extending .NET would benefit gaming scenarios. For example:</p>
<p>Suppose there is some array on the native engine side; for example vertex positions in a mesh (3xFloat for each vertex). Is it possible to make that piece of memory be represented as a native struct array for .NET side? So that it would not involve any extra memory copies, but N vertices somewhere in memory would look just like Vector3[N] for C#?</p>
<p>On a similar note, having &#8220;strided arrays&#8221; would be useful. For example, mesh data is often interleaved, so for each vertex there is a position, normal, UVs and so on. It would be cool if in C# position array would still look like Vector3[N], but internally the distance between each element would be larger than 12 bytes required for Vector3.</p>
<p><strong>Where do we go from here?</strong></p>
<p>The above are just random ideas, and I&#8217;m not complaining about Mono. It is great! It&#8217;s just not perfect. Mono being open source is a very good thing, which means pretty much any interested party can improve it as needed. So rock on.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/11/14/improving-cmono-for-games/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Shaders must die</title>
		<link>http://aras-p.info/blog/2009/05/05/shaders-must-die/</link>
		<comments>http://aras-p.info/blog/2009/05/05/shaders-must-die/#comments</comments>
		<pubDate>Tue, 05 May 2009 12:59:48 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[gpu]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[rendering]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=324</guid>
		<description><![CDATA[It came in as a simple thought, and now I can&#8217;t shake it off. So I say: Ok, now that the controversial bits are done, let&#8217;s continue. Most of this can be (and probably is) wrong, and I haven&#8217;t given it enough thought yet. But here&#8217;s my thinking about shaders of &#8220;regular scene objects&#8221;. All [...]]]></description>
			<content:encoded><![CDATA[<p>It came in as a simple <a href="http://twitter.com/aras_p/status/1651784380">thought</a>, and now I can&#8217;t shake it off. So I say:<br />
<a href="http://aras-p.info/blog/wp-content/uploads/2009/05/shadersmustdie.jpg"><img src="http://aras-p.info/blog/wp-content/uploads/2009/05/shadersmustdie.jpg" alt="Shaders Must Die" title="Shaders Must Die" width="550" height="550" class="alignnone size-full wp-image-325" /></a></p>
<p>Ok, now that the controversial bits are done, let&#8217;s continue.</p>
<p><span id="more-324"></span><br />
Most of this can be (and probably is) wrong, and I haven&#8217;t given it enough thought yet. But here&#8217;s my thinking about shaders of &#8220;regular scene objects&#8221;. All of below is about things that need to interact with lighting; I&#8217;m not talking about shaders for postprocessing, one-off uses, special effects, GPGPU or kitchen sinks.</p>
<p><strong>Operating on vertex/pixel shader level is a wrong abstraction level</strong></p>
<p>Instead, it should be separated out into &#8220;<em>surface shader</em>&#8221; (albedo, normal, specularity, &#8230;), &#8220;<em>lighting model</em>&#8221; (Lambertian, Blinn Phong, &#8230;) and &#8220;<em>light shader</em>&#8221; (attenuation, cookies, shadows).</p>
<ul>
<li>Probably 90% of the cases would only touch the surface shader (mostly mix textures/colors in various ways), and choose from some precooked lighting models.</li>
<li>9% of the cases would tweak the lighting model. Most of the things would settle for &#8220;standard&#8221; (Blinn-Phong or similar), with some stuff using skin or anisotropic or &#8230;</li>
<li>The &#8220;light shader&#8221; only needs to be touched once in a blue moon by ninjas. Once the shadowing and attenuation systems are implemented, there&#8217;s almost no reason for shader authors to see all the dirty bits.</li>
</ul>
<p>Yes, current hardware operates on vertex/geometry/pixel shaders, which is a logical thing to do for hardware. After all, these are the primitives it works on when rendering. But those primitives are <em>not</em> the things you work on when authoring how a surface should look or how it should react to a light.</p>
<p><strong>Simple code; no redundant info; sensible defaults</strong></p>
<p>In the ideal world, here&#8217;s a simple surface shader (the syntax is deliberately stupid):</p>
<blockquote><p>
Haz Texture;<br />
Albedo = sample Texture;
</p></blockquote>
<p>Or with bump mapping added:</p>
<blockquote><p>
Haz Texture;<br />
Haz NormalMap;<br />
Albedo = sample Texture;<br />
Normal = sample_normal NormalMap;
</p></blockquote>
<p>And this should be <em>all</em> the info you have to provide. This would choose the lighting model based on used things (in this case, Lambertian). It would <em>somehow</em> just work with all kinds of lights, shadows, ambient occlusion and whatnot.</p>
<p>Compare to how much has to be written to implement a simple surface in your current shader technology, so that it would work &#8220;with everything&#8221;.</p>
<p>From the above shader, proper hardware shaders can be generated for DX9, DX11, DX1337, OpenGL, next-gen and next-next-gen consoles, mobile platforms with capable hardware, etc.</p>
<p>It can be used in accumulative forward rendering, forward rendering with multiple lights per pass, hybrid (light pre-pass / prelight) rendering, deferred rendering etc. Heck, even for a raytracer if you have one at hand.</p>
<p>I want!</p>
<p>Now of course, it won&#8217;t be as nice as more complex materials have to be expressed. Some might not even be possible. But shader text complexity should grow with material complexity; and all information that is redundant, implied, inferred or useless should be eliminated. <em>There&#8217;s no good reason to stick to conventions and limits of current hardware just because it operates like that</em>.</p>
<p>Shaders must die!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/05/05/shaders-must-die/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Another Vista review (after 6 months of usage)</title>
		<link>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/</link>
		<comments>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:16:37 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=294</guid>
		<description><![CDATA[Ok, I don&#8217;t exactly like Windows Vista. But I just spent 6 months using Vista as my primary OS at work&#8230; because everyone else was using XP, and someone had to make sure everything works on Vista as well. So it was me. In summary, Vista is not that bad. Once you get used to [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I <a href="http://aras-p.info/blog/2008/06/03/the-problem-with-vista/">don&#8217;t exactly like Windows Vista</a>. But I just spent 6 months using Vista as my primary OS at work&#8230; because everyone else was using XP, and <em>someone</em> had to make sure everything works on Vista as well. So it was me.</p>
<p>In summary, Vista is not <em>that bad</em>.</p>
<p>Once you get used to changes in Explorer, different skin and so on &#8211; it&#8217;s actually usable. I think they have made some real improvements in the underlying technology, too bad they managed to &#8220;compensate&#8221; for all of that by inconsistencies and lack of polish in user interface.</p>
<p>At this point it&#8217;s minor quirks in UI that annoy me, but apart from that, Vista is okay. Look:</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-iconoverlay.png" alt="Icon overlay blending" title="Icon overlay blending" width="144" height="152" class="alignnone size-full wp-image-295" /><br />
Who implemented blending of icon overlays and do they still have a job? No sir, that shield icon is <em>not</em> properly blended here!</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-burn.png" alt="Burn icon" title="Burn icon" width="323" height="132" class="alignnone size-full wp-image-296" /><br />
Who thought it&#8217;s a good idea to make the Burn icon bright red? In 6 months, I <em>never</em> used it. Why is it the brightest thing in the whole Explorer window?</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-upfolder.png" alt="Up one folder" title="Up one folder" width="366" height="143" class="alignnone size-full wp-image-297" /><br />
Try going one folder up without resorting to this drop down menu. Utilities is the <em>current</em> folder here. <del datetime="2009-03-18T12:52:27+00:00">And no, there&#8217;s no keyboard shortcut for &#8220;go up&#8221; either (there was in XP, which was perfect)</del>.</p>
<p><img src="http://aras-p.info/blog/wp-content/uploads/2009/03/vista-shutdown.png" alt="Shutdown awesome" title="Shutdown awesome" width="283" height="158" class="alignnone size-full wp-image-298" /><br />
And of course, the awesome shutdown menu. The two buttons &#8211; <em>never</em> used them. What I always use is &#8220;Shut Down&#8221; from the menu. And let&#8217;s not even talk about all the choices in the menu (no, more choices is not always better).</p>
<p>So yeah. It&#8217;s not stellar, it has tons of small annoyances (and some large ones &#8211; try developing web plugins with UAC on&#8230;), but it&#8217;s usable. I might have gotten used to it by now, actually.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/03/18/another-vista-review-after-6-months-of-usage/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How view on C++ changes over time</title>
		<link>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/</link>
		<comments>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 17:23:40 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=287</guid>
		<description><![CDATA[It&#8217;s funny how one&#8217;s view on things change over time. Back in 2002, I wrote something that would be roughly translated like &#8220;C++ amazes me more and more&#8221;. In a positive sense! And I was talking about what is Boost.Spirit now. A reply on local game development forums I wrote today (again, rough translation): &#8220;C++ [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s funny how one&#8217;s view on things change over time.</p>
<p>Back in 2002, I <a href="http://aras-p.info/relyzai00.html">wrote</a> something that would be roughly translated like &#8220;C++ amazes me more and more&#8221;. In a positive sense! And I was talking about what is <a href="http://spirit.sourceforge.net/">Boost.Spirit</a> now.</p>
<p>A <a href="http://www.gamedev.lt/viewtopic.php?p=19644#p19644">reply</a> on local game development forums I wrote today (again, rough translation): &#8220;C++ is very hard and quite a horrible language, maybe you should not use it unless there are no alternatives&#8221;.</p>
<p>That&#8217;s quite a change in attitude we have here!</p>
<p>I feel like much of C++ horrors are a consequence of &#8220;it just somehow happened&#8221; (the whole template metaprogramming thing) or as a backwards compatibility with C requirement. Or maybe not, but I do agree with what <a href="https://mollyrocket.com/forums/viewtopic.php?p=1955#1955">ryg says here</a>. Let&#8217;s play the internet memes:<br />
<img src="http://aras-p.info/blog/wp-content/uploads/2009/03/cppaccident.jpg" alt="C++ Accident" title="cppaccident" width="513" height="437" class="alignnone size-full wp-image-291" /></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2009/03/01/how-view-on-c-changes-over-time/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Achievement of the week: MakeVistaDWMHappyDance</title>
		<link>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/</link>
		<comments>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 16:16:05 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=247</guid>
		<description><![CDATA[This was the function that I added: void GUIView::MakeVistaDWMHappyDance() { // Looks like Vista has some bug in DWM. Whenever we maximize or dock // a view, we must do something magic, otherwise // white stuff appears in place of the view. // See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4208117&#038;SiteID=1 bool earlierThanVista = systeminfo::GetOperatingSystemNumeric() &#60; 600; if( earlierThanVista ) return; [...]]]></description>
			<content:encoded><![CDATA[<p>This was the function that I added:</p>
<blockquote><pre>void GUIView::<strong>MakeVistaDWMHappyDance</strong>()
{
    // Looks like Vista has some bug in DWM. Whenever we maximize or dock
    // a view, we must do something magic, otherwise
    // white stuff appears in place of the view.
    // See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4208117&#038;SiteID=1

    bool earlierThanVista = systeminfo::GetOperatingSystemNumeric() &lt; 600;
    if( earlierThanVista )
        return;

    // What seems to work is drawing one pixel via GDI.
    // We draw it at (1,1) with usual background color.
    int grayColor = 0.61f * 255.0f;
    PAINTSTRUCT ps;
    BeginPaint(m_View, &#038;ps);
    SetPixel(ps.hdc, 1, 1, RGB(grayColor,grayColor,grayColor));
    EndPaint(m_View, &#038;ps);
}</pre>
</blockquote>
<p>I know. Reading from screen when Aero is on is slow, bad and wrong. But then, what do you do? It&#8217;s better than users staring an all-white window just because Vista decided to draw it white, no matter what you think you&#8217;re drawing into it.</p>
<p>&#8230;still, <code>MakeVistaDWMHappyDance</code> is not nearly as cool as </p>
<blockquote><p>internal interface ICanHazCustomMenu { &#8230; }</p></blockquote>
<p> that Nicholas added a while ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/12/11/achievement-of-the-week-makevistadwmhappydance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cool tech vs. boring details</title>
		<link>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/</link>
		<comments>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 19:24:37 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=243</guid>
		<description><![CDATA[Some of the stuff I&#8217;ve been working on last week: Fixed import progress bar for movies with no audio Fixed first context menu click not working on Windows Eye dropper backend on Windows Export Package actually works on Windows Compare Binary works on Windows Add checkbox to project wizard to always open it on startup [...]]]></description>
			<content:encoded><![CDATA[<p>Some of the stuff I&#8217;ve been working on last week:</p>
<ul>
<li>Fixed import progress bar for movies with no audio</li>
<li>Fixed first context menu click not working on Windows</li>
<li>Eye dropper backend on Windows</li>
<li>Export Package actually works on Windows</li>
<li>Compare Binary works on Windows</li>
<li>Add checkbox to project wizard to always open it on startup</li>
<li>F1 in bundled text editor goes to scripting docs for current word</li>
<li>Fixed q/w/e/r keys in password fields and text areas toggling active Tool on Windows</li>
<li>Fixed panes not repainting on Windows after some change is done via context menu on them</li>
<li>&#8230;and so on.</li>
</ul>
<p><em>Boring tiny little details.</em></p>
<p>This probably best summarizes where lion&#8217;s share of time goes when developing anything. I&#8217;m not working on some cool spherical harmonics lightmap compression. Or on cunning ways to encode shadow map information for better filtering. Or on using CUDA to compute something interesting.</p>
<p>In other words, I&#8217;m not working on cool technology. Instead I&#8217;m adding missing menu items. Fixing obscure corner cases. Fighting inconsistencies in operating system APIs. Spotting misplaced pixels. Adding missing keyboard shortcuts.</p>
<p><em>Nothing interesting to blog about!</em></p>
<p>But still, methinks the difference between software that is merely &#8220;good&#8221; and software that is &#8220;great&#8221; is in the details. And <em>only</em> in the details.</p>
<p>I&#8217;ll just take care of tons of more details. Maybe it will result in something good.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/11/22/cool-tech-vs-boring-details/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Crunchtime!</title>
		<link>http://aras-p.info/blog/2008/11/10/crunchtime/</link>
		<comments>http://aras-p.info/blog/2008/11/10/crunchtime/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 13:09:14 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=239</guid>
		<description><![CDATA[A few weeks ago it was all calm in the source control. Now it&#8217;s crunchtime! I&#8217;m the master of svn deception. I do tons of useless commits just so that the stats look good. Yeah! &#8230;ok, back to work.]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://aras-p.info/blog/2008/10/29/unite-2008/">few weeks ago</a> it was all calm in the source control. Now it&#8217;s crunchtime!</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2008/11/crunch.png"><img src="http://aras-p.info/blog/wp-content/uploads/2008/11/crunch.png" alt="" title="Crunchtime!" class="alignnone size-full wp-image-240" /></a></p>
<p>I&#8217;m the master of svn deception. I do tons of useless commits just so that the stats look good. Yeah!</p>
<p>&#8230;ok, back to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/11/10/crunchtime/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The awesome support we do</title>
		<link>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/</link>
		<comments>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 07:00:47 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=235</guid>
		<description><![CDATA[Yesterday&#8217;s experience catching up with Unity forums, as I remember it: Take a quick look at zillions of new posts. Answer about five questions with &#8220;what&#8217;s the value of your camera&#8217;s near plane?&#8221;. There should be some way to automate all of this. For every 20th question, reply with &#8220;increase your near plane!&#8221;, or something.]]></description>
			<content:encoded><![CDATA[<p>Yesterday&#8217;s experience catching up with Unity forums, as I remember it:</p>
<p>Take a quick look at zillions of new posts.</p>
<p>Answer about five questions with &#8220;what&#8217;s the value of your camera&#8217;s near plane?&#8221;.</p>
<p>There should be some way to automate all of this. For every 20th question, reply with &#8220;increase your near plane!&#8221;, or something.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/10/30/the-awesome-support-we-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implicit to-pointer operators must die!</title>
		<link>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/</link>
		<comments>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 13:15:26 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=223</guid>
		<description><![CDATA[For the sake of the nation, this operator must die! Seriously. Suppose there is some class, let&#8217;s say ColorRGBAf. That has four floats inside. Now, someone at some point decided to add this operator to it: operator float* () { /**/ } operator const float* () const { /**/ } Probably because it&#8217;s easier to [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>For the sake of the nation,<br />
this operator must die!</p></blockquote>
<p>Seriously. Suppose there is some class, let&#8217;s say <code>ColorRGBAf</code>. That has four floats inside. Now, someone at some point decided to add this operator to it:</p>
<blockquote><p>operator float* () { /**/ }<br />
operator const float* () const { /**/ }</p></blockquote>
<p>Probably because it&#8217;s easier to pass color to OpenGL this way, or something like that.</p>
<p>This is evil. Like, really <strong>evil</strong>. Especially if that class did not have comparison operators defined, and some totally unrelated code four years later does:</p>
<blockquote><p>if (color != oldColor) { /* &#8230; */ }</p></blockquote>
<p>Ouch! Sounds like someone will spend four hours debugging something that looks like an event routing issue that <em>only</em> happens on Windows and <em>only</em> with optimizations on <em>(yes, I just did that&#8230;)</em>.</p>
<p>What happens here? The compiler takes pointers to two colors and compares <em>the pointers</em>. If for some reason both colors are temporary objects, then it can even happen that <em>both</em> get folded into the same variable/register/whatnot. The pointers are the same. Ouch!</p>
<p>Implicit &#8220;nice&#8221; operators are just disguised evil. Remove that operator, add something like <code>GetPointer()</code> to class if someone really wants to use that, and better even make the comparison operators private and without implementations. Yes. Much better.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/10/09/implicit-to-pointer-operators-must-die/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OpenGL 3: a big step in no direction at all?</title>
		<link>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/</link>
		<comments>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 09:28:03 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=195</guid>
		<description><![CDATA[Well, the post title pretty much summarizes my take on it, doesn&#8217;t it? I guess I could just stop typing now&#8230; but I won&#8217;t! So after some promises, delays and a period of deadly silence, OpenGL 3.0 was released. Response to it was &#8220;interesting&#8220;, to say at least. Some part of that response is related [...]]]></description>
			<content:encoded><![CDATA[<p>Well, the post title pretty much summarizes my take on it, doesn&#8217;t it? I guess I could just stop typing now&#8230; but I won&#8217;t!</p>
<p>So after some promises, delays and a period of deadly silence, OpenGL 3.0 was <a href="http://www.khronos.org/news/press/releases/khronos_releases_opengl_30_specifications_to_support_latest_generations_of/">released</a>.</p>
<p>Response to it was &#8220;<a href="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&#038;Number=243193">interesting</a>&#8220;, to say at least. Some part of that response is related to seriously mishandled communication on Khronos part. Some part is because GL 3.0 is not what it was promised to be. Let&#8217;s just ignore the communication issue, it does not affect OpenGL <em>itself</em> in a direct way (it affects the developer community though).</p>
<p><em>By the way, I borrowed part of the post title from a <a href="http://fireuser.com/blog/opengl_30_a_big_step_in_the_right_direction/">blog post</a> linked from opengl.org. In general, I do not agree with that blog post, but it&#8217;s a valid point of view. Unlike some other <a href="http://zerias.blogspot.com/2008/08/why-fud-against-opengl-30.html">blog posts</a> linked from opengl.org that are just pure garbage&#8230;<br />
</em></p>
<p>I am not sure what are the goals of OpenGL at this point. OpenGL&#8217;s current position, as far as games are concerned, seems to be roughly this:</p>
<blockquote><p>Be the graphics API on various platforms where no alternatives are available.</p></blockquote>
<p>Why? Because Windows has got D3D, which is far more stable, comes with useful tools, more often updated and actually works for variety of users (I&#8217;ll get to this point in a second). Mobile platforms have OpenGL ES, which is decent. All consoles have their own APIs (some of them similar to D3D, <em>none</em> of them similar to GL). So that leaves OpenGL as the choice on OS X, Linux and such. Not because it&#8217;s better. Because it&#8217;s the only choice.</p>
<p><em>&#8220;Oh, but look, <a href="http://www.idsoftware.com/">id</a> uses OpenGL! Two other games use OpenGL as well!&#8221;</em> Well, good for them. But they are in a different league than &#8220;the rest of us&#8221;. For <em>some games</em>, driver writers will do whatever it takes to get those games running correct &#038; fast. Surprise surprise, id games fall into this category. For the rest of us &#8211; no such luxury. Hey, try talking to your friendly IHV, the most likely answer is <em>&#8220;yeah, but are really busy with some high profile games right now, ping us back in two months&#8221;</em>. After two months, repeat.</p>
<p>So the rest comes from somone who is <em>not</em> working on the high-profile games that IHVs specially tune drivers to.</p>
<p>If OpenGL&#8217;s goals are to stay in this current position, then GL 3.0 is okay. It adds some new features, brings some extensions into core, hey, it even says &#8220;it&#8217;s quite likely that maybe perhaps someday some of the old cruft in the API will be removed, if we feel like it&#8221;. No problem with that.</p>
<p>However, OpenGL is advertised as something different, as if it wants to:</p>
<blockquote><p>Be <strong>the</strong> graphics API on <strong>various platforms</strong>.</p></blockquote>
<p>Which is quite different from it&#8217;s current position. I&#8217;m not sure if that&#8217;s the goal of OpenGL. Myself, I don&#8217;t care about the mythical cross-platform API that would <em>actually work</em> on those different platforms. API is a tool to do stuff; if different platforms have different APIs &#8211; no problem with that.</p>
<p>However, if OpenGL <em>wants</em> to achieve this advertised goal, it has to do several things. First and foremost:</p>
<p><strong>Actually work</strong></p>
<p>Stable drivers and runtime. In it&#8217;s current state, GL is too complex to implement good quality drivers/runtime. Complexity can be reduced in several ways:</p>
<ul>
<li>Cleanup the API. This was what GL 3.0 was supposed to be. Actual 3.0 did not do any of that, instead it just postponed the cleanup &#8220;until we feel like it&#8221;.</li>
<li>Share some of the hard work. Why does everyone and their dog have to write GLSL preprocessor, lexer, parser and basic optimizer themselves? Define precompiled shader format, write frontend once, make it open. This would also be actually useful to reduce load times.</li>
</ul>
<p>GL 3.0 could have done both of the above, instead it did none. It could have cleaned up the API, and provide one platform independent GL 1.x/2.x library that calls into actual 3.0 runtime. All the fixed function, immediate mode, display lists, whatever would be in one nice library. Even existing apps could continue to function transparently this way (with the benefit of actually simpler = more stable drivers).</p>
<p><strong>Support platforms/hardware/features user needs</strong></p>
<p>This is of course dependent on the user in question. For someone like <a href="http://unity3d.com/">us</a>, we still have to support 10 year old hardware.</p>
<p>D3D9 does a fine job for that (provided you have drivers installed, and DX9 runtime installed &#8211; which comes included in XP SP2 and upwards). OpenGL 2.1 and earlier would do a fine job for that, provided it would &#8220;actually work&#8221; (see above).</p>
<p>If GL 3.0 would be as was originally promised &#8211; almost new API, shader model 2.0+ hardware, it would be sort of fine. In our case, that would mean writing and supporting two renderers &#8211; &#8220;old GL&#8221; and &#8220;new GL&#8221;, where old one would be used on old hardware or old platforms where &#8220;new GL&#8221; is not available. If the new runtime were much leaner, much more stable and generally nicer, this would not be a big problem.</p>
<p>With actual GL 3.0, in theory one does not have to write two renderers. Minimum hardware level for GL 3.0 is shader model 4+ though. So to support both old hardware/platforms and new hardware/platforms, quite a lot of duplication has to be done. Especially if you intend to go towards proposed &#8220;future GL path&#8221;, i.e. start dropping deprecated functionality from the codebase. At which point you&#8217;ll probably write two separate renderers already. So we&#8217;re back to where original GL 3.0 would have been, just without any extra niceness/stability/leanness right now.</p>
<p>Oh, and look at <a href="http://www.khronos.org/library/detail/2008_siggraph_opengl_bof_slides/">vendor announcements</a> from 2008 OpenGL BOF. NVIDIA: we have almost full drivers now. AMD: we&#8217;re committed to having drivers. Intel: look for GL 3.0 on future platforms. In other words, looks like current Intel&#8217;s cards won&#8217;t ever have GL 3.0 drivers. And in our target market, Intel has the majority of cards.</p>
<p>That sounds very much like &#8220;just ignore whole GL 3.0 thing&#8221; plan to me.</p>
<p><strong>Be nice</strong></p>
<p>This is a point of far lesser importance than &#8220;actually work&#8221; and &#8220;support what is needed&#8221; ones. Having good tools (PIX, &#8230;), documentation, code examples etc. is nice. But not much more; being nicest API in the world does not do much if it does not actually work or does not support what you need. Even in this area, actual GL 3.0 is <em>not</em> nice &#8211; it&#8217;s full of redundancies and crap that goes 15 years back in history.</p>
<p><strong>Summing it up</strong></p>
<p>To me, GL 3.0 looks like a blunder. Instead of fixing the core problems, they just postponed that. Well, <em>Keep up the good work!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/08/20/opengl-3-a-big-step-in-no-direction-at-all/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Invincible shutdown buttons!</title>
		<link>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/</link>
		<comments>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 06:29:07 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=184</guid>
		<description><![CDATA[I booted into Vista yesterday to test something. It offered a bunch of updates to install. After they were installed, I got this: I am not sure what shutdown buttons do when they look like this. I guess they are invincible, or something. Ha, I&#8217;m your log off button! You can&#8217;t kill me! Yes, one [...]]]></description>
			<content:encoded><![CDATA[<p>I booted into Vista yesterday to test something. It offered a bunch of updates to install. After they were installed, I got this:</p>
<p><a href='http://aras-p.info/blog/wp-content/uploads/2008/07/invincibleshutdown.jpg'><img src="http://aras-p.info/blog/wp-content/uploads/2008/07/invincibleshutdown.jpg" alt="Invincible buttons" title="invincibleshutdown" class="alignnone size-full wp-image-185" /></a></p>
<p>I am not sure what shutdown buttons do when they look like this. I guess they are invincible, or something. <em>Ha, I&#8217;m your log off button! You can&#8217;t kill me!</em></p>
<p>Yes, one of the updates installed was the ATI driver update, so I <em>guess</em> there&#8217;s some glitch <em>somewhere</em> in the driver update that makes <em>some buttons</em> be displayed like this&#8230; But hey, this is not some random driver that I found on the net, it&#8217;s the one that is officially suggested by Vista&#8217;s update!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/07/09/invincible-shutdown-buttons/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The problem with Vista</title>
		<link>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/</link>
		<comments>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 16:25:35 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=174</guid>
		<description><![CDATA[Jeff Atwood notes the lack of polish in Windows Vista UI. Long Zheng has started Windows UI Taskforce. I agree &#8211; Vista&#8217;s UI has tons of polish problems. You know, little things that would seem unimportant, but screams something like &#8220;I was made in a hurry by people who don&#8217;t really love me&#8221;. Aliased shield [...]]]></description>
			<content:encoded><![CDATA[<p>Jeff Atwood <a href="http://www.codinghorror.com/blog/archives/001126.html">notes the lack of polish</a> in Windows Vista UI. Long Zheng has started <a href="http://www.istartedsomething.com/20080531/windows-ui-taskforce-your-help-wanted/">Windows UI Taskforce</a>. I agree &#8211; Vista&#8217;s UI has <em>tons</em> of polish problems. </p>
<p>You know, little things that would seem unimportant, but screams something like &#8220;I was made in a hurry by people who don&#8217;t really love me&#8221;. Aliased shield icon overlays? Check. Horrible screen flickering when logging in or UAC prompt pops up? Check. The infamous <a href="http://moishelettvin.blogspot.com/2006/11/windows-shutdown-crapfest.html">Shut Down</a> menu? Check. Awful file copy progress dialogs? Check. Explorer window title bar sometimes displaying green progress bar inside of it for some reason I can never understand? Check. General lack of unified style for UI? Check. The list goes on.</p>
<p>But still, I wonder whether lack of polish is the real problem with Vista. From my point of view, lack of direction or lack of vision seems to be a problem of similar size, if not larger. What <em>is</em> the vision for Vista?</p>
<p>&#8220;Security!&#8221; is not a vision. However hard it is to make something secure, &#8220;more security&#8221; is an improvement in one area, and not a vision on what a product should be. And second, &#8220;security&#8221; does not explain everything else about Vista. At start, it looked like some architecture astronauts had some fancy visions, like &#8220;all your filesystem is a database now!&#8221;&#8230; Well, that did not end up in Vista, and it is something that users genuinely don&#8217;t care about.</p>
<p>I might sound like an Apple fanboy (and indeed, OS X grows on you after a while), but when upgrading from OS X 10.4 (Tiger) to 10.5 (Leopard) I had a pretty clear list of what will be more useful to me:</p>
<ul>
<li>New version <em>feels</em> faster (on the same machine). I am not sure if it is actually faster; or it&#8217;s only a perceived improvement. Maybe they optimized something, maybe they multithreaded something, I don&#8217;t really care. It feels faster and smoother. That&#8217;s good.</li>
<li><a href="http://en.wikipedia.org/wiki/Quick_Look">Quick Look</a> is amazing. A seemingly simple feature &#8211; press Space over a file to preview it. With added polish, like when pressing space over multiple images selected, you can go into slideshow mode. Simple, yet highly effective.</li>
<li><a href="http://en.wikipedia.org/wiki/Spotlight_(software)">Spotlight</a> (desktop search) that is fast.</li>
<li>&#8230;and so on.</li>
</ul>
<p>Those are things I, as a user, care about. I want computer to feel faster. I want to instantly preview files. I want to search for something fast.</p>
<p>A filesystem that <a href="http://en.wikipedia.org/wiki/WinFS">is a database</a>? I can almost see the regular user salivating over that&#8230; <em>Yeah right.</em> Users don&#8217;t want a <em>platform</em>, users want <em>useful features</em>.</p>
<p>And this is where Vista fails &#8211; it does not have obvious new useful features or improvements. Aside from Direct3D 10 &#8211; which I am not using yet &#8211; all so called &#8220;improvements&#8221; just feel like gimmicks.</p>
<ul>
<li>It feels slower (I don&#8217;t care whether it actually <em>is faster but just feels sluggish</em>). And yes, it feels slower on a quad-core CPU with 4 gigs of RAM and a fast graphics card, so no &#8220;Vista runs circles around XP on a new box&#8221; please.</li>
<li>The reorganized menus, title bars and layout of Explorer just scream &#8220;I totally don&#8217;t understand what users need&#8221; at you. Previews are too small to be useable, organization of menus and buttons is horrible, and the constantly fading-in-and-fading-out user interface elements (folders tree view) are just distracting. I dig the new <a href="http://en.wikipedia.org/wiki/Office_2007#User_interface">Office 2007 UI</a> and I can see some understanding of users and vision behind it (see <a href="http://blogs.msdn.com/jensenh/archive/2008/03/12/the-story-of-the-ribbon.aspx">Jensen Harris</a>), but Vista&#8217;s UI feels like it was designed by a bunch of people who never talked to each other. And it&#8217;s not just lack of polish, the &#8220;design&#8221; of it is wrong.</li>
<li>The <a href="http://en.wikipedia.org/wiki/Windows_Sidebar">Sidebar</a>? Again, an attempt at doing something that seemed good, but without any understanding. Yes, I know that Apple might have taken the idea and implemented it right, but that does not leave Sidebar as being useful.</li>
<li>The new skin? Oh come on. How many users did upgrade because window close buttons now glow in red when you hover over them?</li>
<li>Was there anything else new in Vista? I didn&#8217;t notice anything.</li>
</ul>
<p>So this pretty much sums up my view on Vista. Zero new useful things, many annoyances. Microsoft, here&#8217;s you chance to execute it better next time around.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/06/03/the-problem-with-vista/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Argh MFC!</title>
		<link>http://aras-p.info/blog/2008/05/20/argh-mfc/</link>
		<comments>http://aras-p.info/blog/2008/05/20/argh-mfc/#comments</comments>
		<pubDate>Tue, 20 May 2008 07:02:32 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=172</guid>
		<description><![CDATA[When introductory documentation for something has this, you know it won&#8217;t be pretty: CAsyncMonikerFile is derived from CMonikerFile, which in turn is derived from COleStreamFile. A COleStreamFile object represents a stream of data; a CMonikerFile object uses an IMoniker to obtain the data, and a CAsyncMonikerFile object does so asynchronously. So yeah, I am dealing [...]]]></description>
			<content:encoded><![CDATA[<p>When introductory documentation for something <a href="http://msdn.microsoft.com/en-us/library/35a0c067.aspx">has this</a>, you know it won&#8217;t be pretty:</p>
<blockquote><p>CAsyncMonikerFile is derived from CMonikerFile, which in turn is derived from COleStreamFile. A COleStreamFile object represents a stream of data; a CMonikerFile object uses an IMoniker to obtain the data, and a CAsyncMonikerFile object does so asynchronously.</p></blockquote>
<p>So yeah, I am dealing with downloading something from the internet inside an ActiveX control that is written in MFC. A seemingly simple task &#8211; I give you an URL, you give me back the bytes. But no! That would not be a proper architecture, so instead it has asynchronous monikers which are based on monikers which are based on stream files which use some interfaces and whatnot. And for ActiveX controls the docs suggest using CDataPathProperty or CCachedDataPathProperty, which are abstractions build on top of the above crap. And I don&#8217;t even know <em>what</em> &#8220;a moniker&#8221; is!</p>
<p>Of course all this complexity fails spectacularly in some quite common situations. For example, try downloading something when the web server serves gzip compressed html output. Good luck trying to figure out why everything seemingly works, you are notified of downloading progress, but never get the actual downloaded bytes.</p>
<p>Turns out the solution is to change downloading behaviour of the above pile of abstractions to <a href="http://groups.google.be/group/microsoft.public.inetsdk.programming.urlmonikers/browse_thread/thread/45315a0d0860d61a/cfa2bbabad8ff438?hl=en">use &#8220;pull data&#8221; model</a>, instead of default &#8220;push data&#8221; model. The default behaviour just seems to be broken (though it is not broken in that pile of abstractions, instead it is broken somewhere deeper in Windows code). Is this mentioned <em>anywhere</em> in the docs? Of course not!</p>
<p>This is pretty much how a code comment looks like for this:</p>
<blockquote><p>We don&#8217;t use CCachedDataPathProperty because it&#8217;s awfully slow, doing data reallocations for each 1KB received. For 8MB file it&#8217;s 8000 reallocations and 32 GB (!) of data copied for no good reason!</p>
<p>While we&#8217;re at it, we don&#8217;t use CDataPathProperty either, because it&#8217;s a useless wrapper over CAsyncMonikerFile.</p>
<p>Oh, and we don&#8217;t use CAsyncMonikerFile either, because it has bugs in VS2003&#8242; MFC where it never notifies the container that it is done with download, making IE still display &#8220;X items remaining&#8221; indefinitely. Some smart coder was converting information message and returning &#8220;out of memory&#8221; error if result was NULL, even if input message was NULL (which it often was). So we use our own &#8220;fixed&#8221; version of CAsyncMonikerFile instead.
</p></blockquote>
<p>Oh MFC, how we love thee.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/05/20/argh-mfc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>On job titles and design patterns</title>
		<link>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/</link>
		<comments>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/#comments</comments>
		<pubDate>Fri, 09 May 2008 11:25:20 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=168</guid>
		<description><![CDATA[I just changed my job title to say &#8220;Code Chef&#8220;. I like it, and it represents my current understanding of programming pretty well. I cook code. That&#8217;s my job. Some N years ago I would have liked a title with &#8220;Architect&#8221; or &#8220;Analyst&#8221; or something like that. I would have called myself &#8220;developer&#8221; instead of [...]]]></description>
			<content:encoded><![CDATA[<p>I just changed my job title to say &#8220;<a href="http://www.linkedin.com/in/nearaz">Code Chef</a>&#8220;. I like it, and it represents my current understanding of programming pretty well. I cook code. That&#8217;s my job.</p>
<p>Some N years ago I would have liked a title with &#8220;Architect&#8221; or &#8220;Analyst&#8221; or something like that. I would have called myself &#8220;developer&#8221; instead of &#8220;programmer&#8221; because hey, a developer thinks up things, whereas a programmer is a mere &#8220;code monkey&#8221;. More on code monkeys below.</p>
<p>But wait! Back then I also believed that knowing and using <a href="http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29">Design Patterns</a> is essential for a programmer! In one place when I was interviewing new hires, design pattern knowledge was something I would look for&#8230; <em>how stupid!</em> Nowadays my view of patterns is more along the lines of &#8220;yeah, whatever&#8221;. I don&#8217;t exactly think of them as <a href="http://realtimecollisiondetection.net/blog?p=44">things from hell</a>, but they could have caused more harm than good already.</p>
<p>Back to job titles. Code monkey is actually the key employee. A software product is largely defined by the code, heck, it <em>is</em> code. Sure, it also has the user interface, the fancy icons, the documentation, the website, the support, the roadmap and whatnot, but the code <em>is</em> the product, whereas everything else is more or less addons (possibly excluding UI&#8230; UI also defines the product).</p>
<p>Code design? Design patterns? Who cares about that.</p>
<p>It&#8217;s the final result that matters. <a href="http://meshula.net/wordpress?p=168">Futurist programming</a> for the win.</p>
<p><em>On the other hand, <a href="http://realtimecollisiondetection.net/blog/?p=44#comment-662">Memento Observer</a> is probably very cool.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/05/09/on-job-titles-and-design-patterns/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My experience with Crysis so far</title>
		<link>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/</link>
		<comments>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 13:37:10 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/</guid>
		<description><![CDATA[So I decided to check out Crysis myself. A demo for a non-gamer like me would be perfect, I thought. It&#8217;s probably three frames per second. In the menu! I did not see the game itself yet, got bored while waiting for the after-menu-but-before-game intro movie to end (it&#8217;s not skippable, and it also ran [...]]]></description>
			<content:encoded><![CDATA[<p>So I decided to check out <a href="http://en.wikipedia.org/wiki/Crysis">Crysis</a> myself. A demo for a non-gamer like me would be perfect, I thought.</p>
<p>It&#8217;s probably three frames per second. <em>In the menu</em>!</p>
<p>I did not see the game itself yet, got bored while waiting for the after-menu-but-before-game intro movie to end (it&#8217;s not skippable, <em>and</em> it also ran at about three FPS). This is after watching half a dozen obligatory before-menu intro movies at 3 FPS with stuttering sound (&#8220;nvidia,vidia,vidia,vidia&#8230; the way it&#8217;s meant,meant,meant,meant&#8230;&#8221; &#8211; <a href="http://www.nzone.com/object/nzone_twimtbp_gameslist.html">TWIMTBP</a>).</p>
<p>All of this on a half-decent PC, I think &#8211; Intel Core 2 Quad, 4GB RAM, Radeon 3850, Windows XP, latest drivers, none of extra stuff running; the PC is able to run other 3D stuff just fine. I&#8217;m sure the developers and EA&#8217;s testing labs have tested everything extensively, but sometimes something completely random apparently can make things be <em>oh so slow</em>. Oh well. Get back to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/02/15/my-experience-with-crysis-so-far/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Holy FPU precision, Batman!</title>
		<link>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/</link>
		<comments>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 09:46:38 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[d3d]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/</guid>
		<description><![CDATA[(cross-posted from blogs.unity3d.com) One of our customers found an interesting bug the other day: embedding Unity Web Player into a web page makes some javascript animation libraries not work correctly. For example, script.aculo.us or Dojo Toolkit would stop doing some of their tasks. But only on Windows, and only on some browsers (Firefox and Safari). [...]]]></description>
			<content:encoded><![CDATA[<p><em>(cross-posted from <a href="http://blogs.unity3d.com/2008/01/22/holy-fpu-precision-batman/">blogs.unity3d.com</a>)</em></p>
<p>One of our customers found an interesting bug the other day: embedding Unity Web Player into a web page makes some javascript animation libraries not work correctly. For example, <a href="http://script.aculo.us/">script.aculo.us</a> or <a href="http://dojotoolkit.org/">Dojo Toolkit</a> would stop doing some of their tasks. But only on Windows, and only on some browsers (Firefox and Safari).</p>
<p>Wait a moment&#8230; Unity plugin makes nice wobbling web page elements not wobble anymore!? Sounds like an <em>interesting</em> issue&#8230;</p>
<p>So I prepared for a debug session and tried the usual &#8220;divide by two until you locate the problem&#8221; approach.</p>
<ul>
<li>Unity Web Player is composed of two parts: a small browser plugin, and the actual &#8220;engine&#8221; (let&#8217;s call it &#8220;runtime&#8221;). First I change the plugin so that it only loads the data, but never loads or starts the runtime. Everything works. So the problem is not in the plugin. <em>Good</em>.</li>
<li>Load the runtime and do basic initialization (create child window, load Mono, &#8230;), but never actually start playing the content &#8211; everything works.</li>
<li>Load the runtime and <em>fully</em> initialize everything, but never actually start playing the content &#8211; the bug appears! By now I know that the problem is <em>somewhere</em> in the initialization.</li>
</ul>
<p>Initialization reads some settings from the data file, creates some &#8220;manager objects&#8221; for the runtime,     initializes graphics device, loads first game &#8220;level&#8221; and then the game can play.</p>
<p>What of the above could cause <em>something</em> inside browser&#8217;s JavaScript engine stop working? And do that only on Windows, and only on some browsers? My first guess was the most platform-specific part: intialization of the graphics device, which on Windows usually happens to be Direct3D.</p>
<p>So I continued:</p>
<ul>
<li>Try using OpenGL instead of Direct3D &#8211; everything works. By now it&#8217;s confirmed that initializing Direct3D causes something else in the browser not work.</li>
<li>&#8220;A-ha!&#8221; moment: tell Direct3D to not change floating point precision (via a <a href="http://msdn2.microsoft.com/en-us/library/bb172527(VS.85).aspx">create flag</a>). Voilà, everything works!</li>
</ul>
<p>I don&#8217;t know how I <em>actually</em> came up with the idea of testing floating point precision flag. Maybe I remembered some related problems we had a while ago, where Direct3D would cause timing calculations be &#8220;off&#8221;, if the user&#8217;s machine was not rebooted for a couple of weeks or more. That time around we properly changed our timing code to use 64 bit integers, but left Direct3D precision setting intact.</p>
<blockquote><p>
Side note: Intel x86 floating point unit (FPU) can operate in various <a href="http://www.stereopsis.com/FPU.html">precision modes</a>, usually 32, 64 or 80 bit. By default Direct3D 9 sets FPU precision to 32 bit (i.e. single precision). Telling D3D to not change FPU settings <em>could</em> lower performance somewhat, but in my tests it did not have any noticeable impact.
</p></blockquote>
<p>So there it was. A debugging session, one line of change in the code, and fancy javascript webpage animations work on Windows in Firefox and Safari. This is coming out in Unity 2.0.2 update soon.</p>
<p>The moral? Something in one place can affect seemingly <em>completely</em> unrelated things in another place!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2008/01/22/holy-fpu-precision-batman/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can you set OpenGL states independently?</title>
		<link>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/</link>
		<comments>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 20:50:11 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/</guid>
		<description><![CDATA[Most of the time, yes, you can just set the needed states! You can set alpha blending on and turn light #0 off, and often nothing bad will happen. Blending will be on, and light #0 will be off. Fine. Until you hit a graphics card (quite new &#8211; from 2006, it can even do [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the time, yes, you can just set the needed states! You can set alpha blending on and turn light #0 off, and often nothing bad will happen. Blending will be on, and light #0 will be off. Fine.</p>
<p>Until you hit a graphics card (quite new &#8211; from 2006, it can even do pixel shader 2.0) that completely hangs up the machine in one of your unit tests. In fact, in the first unit test, that does almost nothing. Debugging that thing is <em>total awesomeness</em> &#8211; try something out, and the machine either hangs up or it does not. Reboot, repeat.</p>
<p>After something like 30 hang-ups I found the cause: <em>you are damned</em> if you set GL_SEPARATE_SPECULAR_COLOR and GL_COLOR_SUM to different values (i.e. use separate specular but don&#8217;t turn on color sum). Because, you know, some code was there that did not see a point in changing light mode color control when no lighting was on. So yeah, always set those two in sync. Just to please this card&#8217;s drivers.</p>
<p>It&#8217;s hard for me to have any faith in driver developers. I know that their job is hard, walking the fine line between correctness and getting decent benchmark scores&#8230; But still &#8211; hanging up the machine when two OpenGL 1.2 states are set to different values? Would you trust those people to write <a href="http://www.opengl.org/documentation/glsl">full fledged compilers</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/07/25/can-you-set-opengl-states-independently/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL pbuffers suck!</title>
		<link>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/</link>
		<comments>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 16:22:03 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/</guid>
		<description><![CDATA[Aaargh! Well, the blog title is about as much as I wanted to say on this topic. &#8230;this is just me venting out, during the process of chasing a video memory leak for 4 days already. It involves p-buffers, depth textures, shared OpenGL contexts and other delicious things. Still didn&#8217;t find the cause, but I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>Aaargh! Well, the blog title is about as much as I wanted to say on this topic.</p>
<p>&#8230;this is just me venting out, during the process of chasing a video memory leak for 4 days already. It involves p-buffers, depth textures, shared OpenGL contexts and other delicious things. Still didn&#8217;t find the cause, but I&#8217;m getting close.</p>
<p>Pbuffer my a**.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/06/04/opengl-pbuffers-suck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>It&#8217;s harder than &#8220;just use shaders&#8221;!</title>
		<link>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/</link>
		<comments>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/#comments</comments>
		<pubDate>Mon, 07 May 2007 15:17:58 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/</guid>
		<description><![CDATA[I&#8217;m always puzzled why people think that some interesting effect is &#8220;shaders&#8221;. The most recent example I saw is this message on Dir3d mailing list &#8211; it&#8217;s about NVIDIA&#8217;s skin rendering demo (*). The most interesting effects are in fact not achieved by the use of shaders &#8211; rather it&#8217;s the complex interplay of render-to-textures, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always puzzled why people think that some interesting effect is &#8220;shaders&#8221;. The most recent example I saw is <a href="http://nuttybar.drama.uga.edu/pipermail/dir3d-l/2007-May/013005.html">this message</a> on Dir3d mailing list &#8211; it&#8217;s about NVIDIA&#8217;s skin rendering demo (*).</p>
<p>The most interesting effects are in fact not achieved by the use of shaders &#8211; rather it&#8217;s the complex interplay of render-to-textures, postprocessing them, using them somewhere else, postprocessing that, using them somewhere else again, combine the intermediate results in various interesting ways, and finally get something that represents the colors on the screen.</p>
<p>So the effect is much more than the shaders; it&#8217;s more like &#8220;an orchestration of different stuff&#8221;. It&#8217;s the shaders, textures, models (often with custom data that is required for the effect to work), specially precomputed textures (more custom data for the effect), multiple render textures to store intermediate results, and finally some sort of &#8220;script&#8221; that controls the whole process.</p>
<p>Shaders are (relatively) small, isolated thingies that operate on small, isolated pieces of data. So they are only a small part of the whole picture, and in fact often they are the easiest part. Both to the effect author, and even for the &#8220;engine&#8221; to support.</p>
<p>Adding &#8220;shader support&#8221; to the engine/toolset is a piece of cake. The hard parts are:</p>
<ul>
<li>How shaders integrate with the lighting? Once you start doing shaders, you lose <em>all</em> lighting that used to be computed for you.</li>
<li>How shaders integrate with various data the mesh may have or it might not? For example, to support per-vertex colors you either have to write a single (sub-optimal) shader that always assumes vertex colors are present, or write multiple shaders: when vertex colors are present, and when they are not.</li>
<li>How shaders integrate with &#8230; lots of other things that were taken for granted in fixed function world. Scaled meshes. Various fog types. Texture transforms. The list goes on.</li>
<li>How do you expose the rest of the &#8220;stuff&#8221; that makes interesting effects possible? Shaders alone are nothing. You need render-to-texture with various interesting formats. You need to store custom data in the meshes. You need to store custom data in the textures, in various interesting formats. You need custom cameras to render intermediate results into render textures. You need a way to replace object shaders with some other shaders so that these objects <em>can</em> render these intermediate results. The list goes on.</li>
<li>Hardware support. Once you enter shader world, you get a totally new set of inconsistencies between operating systems, graphics APIs, hardware vendors, graphics card models and driver versions. And a new bag of driver bugs of course.</li>
</ul>
<p>So shaders do present three big challenges.</p>
<p>1) Shader explosion. How do you do lighting? Do you say &#8220;there shall only ever be a single directional light&#8221; (that is what most tech-demos do)? Do you try to support the general case and write some dozen shader combinations? How do you handle all other cases that were &#8220;just handled&#8221; by fixed function pipeline? Vertex formats, fog, texture transforms, etc. Congratulations, multiply your shader count by 10 or so. <em>Or</em> don&#8217;t multiply the shader count, but use static/dynamic branching <em>if</em> you have hardware support for it.</p>
<p>2) Platform differences. How you write shaders in the general case, when some things don&#8217;t work on AMD cards, some other things don&#8217;t work on NVIDIA cards, yet some other things don&#8217;t work in OpenGL, some other things don&#8217;t work in Direct3D, and something entirely else does not work on Mac OS X (with different things not working on PPC vs Intel, yay)? Congratulations again, multiply your already large shader count by 10 or so.</p>
<p>3) Shaders are just a small part of the equation. You need the whole infrastructure around them to <em>actually</em> enable those interesting effects.</p>
<p>To return to the original message about the skin rendering demo: no, &#8220;just shaders&#8221; won&#8217;t enable that. You need render textures in several formats (color &amp; depth) at least. And some dozen shaders to do the effect for a single light type, for a single mesh configuration, and for a single hardware platform. Multiply the shader count by, hmm&#8230;, hundred or so to cover the general case.</p>
<p>Real life is harder than a tech demo. Real life is more than just the shaders.</p>
<p>(*) I&#8217;m taking the message out of the context on purpose. Nothing is wrong with noisecrime&#8217;s message, I just want to point out that <em>just</em> exposing shaders does not get you very far.</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/05/07/its-harder-than-just-use-shaders/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Who writes software nowadays?</title>
		<link>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/</link>
		<comments>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 09:48:14 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/</guid>
		<description><![CDATA[Ok, I got an USB memory stick (PQI something). Now it has two partitions on it by default, one of them to store some sort of &#8220;USB Notebook&#8221; data. I am pretty sure I really don&#8217;t need that, so I was looking around for a way to merge those partitions. I ran this &#8220;USB Notebook&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I got an USB memory stick (PQI something). Now it has two partitions on it by default, one of them to store some sort of &#8220;USB Notebook&#8221; data. I am pretty sure I really don&#8217;t need that, so I was looking around for a way to merge those partitions. I ran this &#8220;USB Notebook&#8221; application in a hope that setup wizard will let me choose &#8220;no thanks, I don&#8217;t need this stuff&#8221;. Of course, it does not have such an option.</p>
<p>Pressing Cancel somewhere in there results in this dialog:</p>
<p><a href="http://aras-p.info/blog/wp-content/uploads/2007/04/allyourbase.png" title="Oooh the error message"><img src="http://aras-p.info/blog/wp-content/uploads/2007/04/allyourbase.png" alt="Oooh the error message" /></a></p>
<p>Pretty cool, I must say. Some advice I&#8217;d like to give for the application developers, if I may:</p>
<ul>
<li>Instead of trying to copy Aqua&#8217;s GUI, make the application actually do useful things. &#8220;I don&#8217;t need your stuff, please give me a single partition&#8221; is a pretty common use case. And please don&#8217;t make error messages like that be the topmost windows (now it stays on top even when I switch to another app).</li>
<li>Either get someone to write English messages, or leave the message as is and change the caption to &#8220;All your base are belong to us&#8221;. For such an exciting error message I&#8217;d also change the button text to &#8220;YES!!!&#8221;. Let the user enjoy your software!</li>
</ul>
<p>From the software manual: <em>&#8220;Thanks a lot to you that are use our company&#8217;s product&#8221;</em>. Gee, thank you that you are use your software on me!</p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/04/03/who-writes-software-nowadays/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ARB_vertex_buffer_object is stupid</title>
		<link>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/</link>
		<comments>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 21:51:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=105</guid>
		<description><![CDATA[OpenGL vertex buffer functionality, I mock thee too! Why couldn&#8217;t they make the specification simple&#038;clear, and then why can&#8217;t the implementations work as expected? It started out like this: converting some existing code that generates geometry on the fly. It used to generate that into in-memory arrays and then Just Draw Them. Probably not the [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">OpenGL vertex buffer functionality, I <a href="http://www.stevestreeting.com/?p=489">mock thee</a> too! Why couldn&#8217;t they make the <a href="http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt">specification</a> simple&#038;clear, and then why can&#8217;t the implementations work as expected?</p>
<p>It started out like this: converting some existing code that generates geometry on the fly. It used to generate that into in-memory arrays and then Just Draw Them. Probably not the most optimal solution, but that&#8217;s fine. Of course we can optimize that, right?</p>
<p>So with all my knowledge how things used to work in D3D I start &#8220;I&#8217;ll just do the same in OpenGL&#8221; adventure. Create a single big dynamic vertex buffer, a single big dynamic element buffer; update small portions of it with glBufferSubData, &#8220;discard&#8221; it (=glBufferData with null pointer) when the end is reached, rinse &#038; repeat.</p>
<p>Now, let&#8217;s for a moment ignore the fact that updating portions of index buffer does not actually work on Mac OS X&#8230; Everything else is fine and it actually works! Except for&#8230; it&#8217;s quite a lot <span style="font-style: italic;">slower</span> than just doing the old &#8220;render from memory&#8221; thing. Ok, must be some OS X specific thing&#8230; Nope, on a Windows box with GeForce 6800GT it is still slower.</p>
<p>Now, there are three things that could have gone wrong: 1) I did something stupid (quite likely), 2) VBOs for dynamically updated chunks of geometry suck (could be&#8230; they don&#8217;t have a way to update just one chunk without one extra memory copy at least), 3) both me and VBOs are stupid. If I was me I&#8217;d bet on the third option.</p>
<p>What I don&#8217;t get is: D3D has had a buffer model that is simple to understand and actually works for, like, 6 years now! Why ARB_vertex_buffer_object guys couldn&#8217;t <span style="font-style: italic;">just copy</span> that? The world would be a better place! No, instead they make a way to map only <span style="font-style: italic;">whole </span>buffer; updating chunks is extra memory copy; there are confusing usage parameters (when should I use STREAM and when DYNAMIC?); performance costs are unclear (when is <a href="http://www.stevestreeting.com/?p=491">glBufferSubData faster than glMapBuffer</a>?) etc. And in the end when an OpenGL noob like me tries to actually make them work &#8211; he can&#8217;t! It&#8217;s slow!
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2007/03/22/arb_vertex_buffer_object-is-stupid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A steam of random things</title>
		<link>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/</link>
		<comments>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 21:24:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[demos]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=96</guid>
		<description><![CDATA[Awards: Hey, we&#8216;ve got a &#8220;runner up&#8221; award in Apple Design Awards 2006, Best Use of Graphics category! Yeah, a runner up is more like &#8220;the first of the losers&#8221;, but oh well. Got beaten by modo 201, which probably is a fair trade. It&#8217;s just that we thought we&#8217;d be in Best Developer Tool [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;"><span style="font-weight: bold;">Awards:</span> Hey, <a href="http://unity3d.com">we</a>&#8216;ve got a &#8220;runner up&#8221; award in <a href="http://developer.apple.com/ada/">Apple Design Awards 2006</a>, Best Use of Graphics category! Yeah, a runner up is more like &#8220;the first of the losers&#8221;, but oh well. Got beaten by <span style="font-style: italic;">modo 201</span>, which probably is a fair trade. It&#8217;s just that we thought we&#8217;d be in <span style="font-style: italic;">Best Developer Tool</span> category, but that is apparently for text editors and scripting languages :)</p>
<p><span style="font-weight: bold;">Demos: </span>In the other news, fellow <a href="http://nesnausk.org/members.php">ReJ</a> with TBL just won Assembly 2006 demo competition with an <a href="http://www.pouet.net/prod.php?which=25778">Amiga demo</a>, putting all PC demos faces&#8217; to dust. Check it out. Art direction over hardware capabilities, one more time.</p>
<p><span style="font-weight: bold;">Drivers:</span> why oh why the graphics drivers must be so bad? The other day I was thinking why can&#8217;t they auto-update themselves (with an option to turn it off for corporate users etc.). Now you&#8217;ve got a (not so recent!) driver that is able to parse vertex programs wrong, and a user who does not have a clue that he should update it. It&#8217;s bad enough to have a bug in the first place, but auto-update at least would fix&#8230;</p>
<p>Or you have a driver that says <span style="font-style: italic;">&#8220;I&#8217;m OpenGL 1.2!&#8221;</span> but the 3D texture functions are null. <span style="font-style: italic;">And</span> it&#8217;s the most recent driver for a particular graphics card that you can buy today! <span style="font-style: italic;">And</span> it&#8217;s not even a hard problem! What the developers are thinking &#8211; they go over the required GL 1.2 functionality, see that some is actually missing and decide <span style="font-style: italic;">&#8220;ah, screw it, we&#8217;ll say it&#8217;s 1.2 anyways&#8221;</span>?!</p>
<p>I just don&#8217;t get it. I could use some enlightenment on this.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2006/08/14/a-steam-of-random-things/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Threading woes</title>
		<link>http://aras-p.info/blog/2006/03/27/threading-woes/</link>
		<comments>http://aras-p.info/blog/2006/03/27/threading-woes/#comments</comments>
		<pubDate>Mon, 27 Mar 2006 08:20:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=89</guid>
		<description><![CDATA[Getting multithreaded code right is just so damn hard. Reasoning about it&#8217;s behavior or correctness is even harder! We&#8217;ll be doomed until we get something of much higher level than threads and locks. Why I&#8217;m writing this? Because my head hurts from trying to make the renderer run in one thread, and the containing application [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">Getting multithreaded code right is just so damn hard. Reasoning about it&#8217;s behavior or correctness is even harder! We&#8217;ll be doomed until we get something of much higher level than threads and locks.</p>
<p>Why I&#8217;m writing this? Because my head hurts from trying to make the renderer run in one thread, and the containing application in the other. With added spice that most (win32) GUI stuff must happen in one thread, OpenGL contexts can only be active in a single thread, simple functions must be split into complex chains of inter-threading calls, etc. etc. The result is a mess that nobody can understand.</p>
<p>I hope I&#8217;m not missing something obvious (well, aside from the suggestion &#8220;just don&#8217;t use threads&#8221;).
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2006/03/27/threading-woes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>InteraMotion closes offices</title>
		<link>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/</link>
		<comments>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/#comments</comments>
		<pubDate>Wed, 14 Sep 2005 16:57:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=65</guid>
		<description><![CDATA[The company I was working at for some three years, closed it&#8217;s offices in Kaunas recently. Well, it was almost a year when both intera and motion parts of the name didn&#8217;t already make any sense&#8230; At start we were doing computer vision, various game/graphics/entertainment stuff, but in the last year all development was about [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">The company I was <a href="http://aras-p.info/cv.html">working at</a> for some three years, closed it&#8217;s offices in Kaunas recently. Well, it was almost a year when both <span style="font-style: italic;">intera</span> and <span style="font-style: italic;">motion</span> parts of the name didn&#8217;t already make any sense&#8230; At start we were doing computer vision, various game/graphics/entertainment stuff, but in the last year all development was about some computer networks management system. A couple of programmers will stay for some time to support existing systems, but afaik any new development is suspended.</p>
<p>I feel kinda sad, even if I blame the management for the failures mostly <span style="font-style: italic;">(we programmers never blame ourselves, you know :))</span>. Yes, I/we could have worked harder, done better etc., but all the way I (and probably &#8216;we&#8217;) felt that the ambitions were too unrealistic<sup>*</sup>, the business plans were too non-existant, the management was just a bit too poor, and some forward-thinking was &#8216;just a bit missing&#8217;.</p>
<p>I guess that&#8217;s just my attempt to transfer blame to someone else :)</p>
<p>That said, it&#8217;s still sad. Oh well, just keep going on.</p>
<p><span style="color: rgb(102, 102, 102);font-size:85%;" >* Ambitions: &#8220;by that time Sony, Nintendo and Konami will be years behind us&#8221; doesn&#8217;t sound very realistic, does it? :)</span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/09/14/interamotion-closes-offices/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Doing something</title>
		<link>http://aras-p.info/blog/2005/08/30/doing-something/</link>
		<comments>http://aras-p.info/blog/2005/08/30/doing-something/#comments</comments>
		<pubDate>Tue, 30 Aug 2005 13:09:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[demos]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=62</guid>
		<description><![CDATA[After taking a break, I already want to do something programming-related in my free time. What should I? The standard thing: do a demo. I have some ideas for that, but for various reasons I&#8217;m not in the mood right now to start a big/long project. Read some books. I&#8217;m doing this a bit. Learn [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">After taking a break, I already want to do something programming-related in my free time. What should I?
</div>
<ul style="text-align: justify;">
<li>The standard thing: do a demo. I have some ideas for that, but for various reasons I&#8217;m not in the mood right now to start a big/long project.</li>
<li>Read some books. I&#8217;m doing this a bit.
 </li>
<li>Learn something. Do something with <a href="http://www.wxwidgets.org/">wxWidgets</a> or some <a href="http://www.lua.org/">Lua</a>-only programming, but didn&#8217;t start anything yet.</li>
<li>I already <span style="font-style: italic;">should </span>do something related to the next version of <a href="http://aras-p.info/projHoshimi.html">Project Hoshimi</a> for Imagine Cup 2006. I&#8217;m trying to!
  </li>
</ul>
<div style="text-align: justify;">On the unrelated note, I&#8217;m doing a <a href="http://aras-p.info/blog/2005/08/23/software-of-the-week/">Oracle</a> and XSLT related project at work. While Oracle stuff I&#8217;m dealing with really sucks, XSLT isn&#8217;t bad at all. Sure, it&#8217;s not &#8220;programming&#8221; that I&#8217;d love very much, but the whole concept is very powerful.</p>
<p>Maybe XML isn&#8217;t such a bad thing afterall, especially once you start doing funky things with XSLT and XPath. <span style="font-style: italic;">I still love the quote &#8220;XML is a giant step in no direction at all&#8221; though :)</span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/08/30/doing-something/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software of the week</title>
		<link>http://aras-p.info/blog/2005/08/23/software-of-the-week/</link>
		<comments>http://aras-p.info/blog/2005/08/23/software-of-the-week/#comments</comments>
		<pubDate>Tue, 23 Aug 2005 15:45:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=61</guid>
		<description><![CDATA[It&#8217;s never too early for Software Of The Week awards, even if it&#8217;s only Tuesday. Ladies and gentlement, Aras&#8217; picks are: Software That Rocks award goes to TortoiseSVN and PmWiki. Both are slick, sexy and do not try to annoy you. They actually work (that&#8217;s already something!), they do not crash whenever I do just-a-bit-non-usual [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">It&#8217;s never too early for <span style="font-style: italic;">Software Of The Week</span> awards, even if it&#8217;s only Tuesday. Ladies and gentlement, Aras&#8217; picks are:</p>
<ul>
<li><span style="font-weight: bold;">Software That Rocks</span> award goes to <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> and <a href="http://www.pmwiki.org/">PmWiki</a>. Both are slick, sexy and do not try to annoy you. They actually work (that&#8217;s already something!), they do not crash whenever I do just-a-bit-non-usual action, they do not corrupt my files behind my back.</li>
<li><span style="font-weight: bold;">Software That Sucks</span> award this week goes to Oracle <a href="http://www.oracle.com/technology/products/reports/index.html">Reports</a> and <a href="http://www.oracle.com/technology/products/designer/index.html">Designer</a> 10g. Sorry dear Oracle, but the best description I have for those is <span style="font-style: italic;">&#8220;Ugh&#8221;</span>. For a longer description, just invert everything that&#8217;s written in the first point.</li>
</ul>
<p> See you later!
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/08/23/software-of-the-week/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Code dependencies</title>
		<link>http://aras-p.info/blog/2005/02/26/code-dependencies/</link>
		<comments>http://aras-p.info/blog/2005/02/26/code-dependencies/#comments</comments>
		<pubDate>Sat, 26 Feb 2005 14:17:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=16</guid>
		<description><![CDATA[They suck! Well, this probably isn&#8217;t fresh news to anyone, but right now I&#8217;m working with code where basically everything includes everything else. The code is template-heavy so that makes things even worse. Try changing that file without 20 minute rebuild later &#8211; good luck! Yeah, I know, the code is a product of 2 [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: justify;">They <span style="font-weight: bold;">suck</span>! Well, this probably isn&#8217;t fresh news to anyone, but right now I&#8217;m working with code where basically everything includes everything else. The code is template-heavy so that makes things even worse. Try changing that file without 20 minute rebuild later &#8211; good luck!</p>
<p>Yeah, I know, the code is a product of 2 years of wandering in the darkness :) &#8211; prototyping, adding something and removing something, and when you constantly have to actually produce &#8220;working demos&#8221; in short timeframes, it ain&#8217;t easy to actually sit down and refactor whole thing. Oh well, the reality&#8230;</p>
<p>Still, code with lots of dependencies does suck of course.</p>
<p>On the other hand, I&#8217;m pretty happy with the module I&#8217;m writing. All the outside just needs one header file that&#8217;s right now <span style="font-weight: bold;">76 lines</span> long and that includes <span style="font-style: italic;">only</span> very basic &#8220;resource id&#8221; header file. The insides of my module also need some of the outside functionality; I&#8217;ve written some &#8220;outside interface&#8221; for that &#8211; a header file with something like 50 lines and also absolutely no includes.</p>
<p>That&#8217;s what I consider to be a low-dependency interface. That&#8217;s good. That doesn&#8217;t suck :)</p>
<p><span style="font-style: italic;">[EDIT]</span> The code I was referring to isn&#8217;t so bad (e.g. it really doesn&#8217;t &#8220;includes everything else&#8221;, but &#8220;includes quite large amount of stuff&#8221;). I&#8217;m just somewhat frustrated at the moment, and anything that&#8217;s not very ideal in the codebase irritates me.
</div>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/02/26/code-dependencies/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A bunch of hacks</title>
		<link>http://aras-p.info/blog/2005/02/10/a-bunch-of-hacks/</link>
		<comments>http://aras-p.info/blog/2005/02/10/a-bunch-of-hacks/#comments</comments>
		<pubDate>Thu, 10 Feb 2005 20:24:00 +0000</pubDate>
		<dc:creator>Aras Pranckevičius</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://aras-p.info/blog/?p=10</guid>
		<description><![CDATA[And I though my own freetime projects were coded like a bunch of hacks, with no clear structure, with lots of code duplication etc&#8230; These are nothing compared to the code I now work with!]]></description>
			<content:encoded><![CDATA[<p>And I though my own <a href="http://aras-p.info/proj.html">freetime projects</a> were coded like a bunch of hacks, with no clear structure, with lots of code duplication etc&#8230; These are nothing compared to the code I now work with!<span style="font-weight: bold;"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://aras-p.info/blog/2005/02/10/a-bunch-of-hacks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
