<?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>Wesley&#039;s Techblog</title>
	<atom:link href="http://wesley.vidiqatch.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://wesley.vidiqatch.org</link>
	<description>This blog does not need a smart-ass tagline</description>
	<lastBuildDate>Wed, 09 Sep 2009 21:36:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>QPasm 1.1 RC1</title>
		<link>http://wesley.vidiqatch.org/09-09-2009/qpasm-1-1-rc1/</link>
		<comments>http://wesley.vidiqatch.org/09-09-2009/qpasm-1-1-rc1/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 21:11:27 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=537</guid>
		<description><![CDATA[The last few days I&#8217;ve been improving the small pseudo-assembler interpreter/IDE that I had created. I am quite happy with the result.

The new version of QPasm has the following new features:

Code editor with intelligent syntax highlighting, line numbering, visual breakpoints and undo/redo functionality
Debugging features: breakpoints, manual step, timed step, pausing
On-the-fly editing of data in the [...]]]></description>
			<content:encoded><![CDATA[<p>The last few days I&#8217;ve been improving the small pseudo-assembler interpreter/IDE that I had created. I am quite happy with the result.</p>
<p><a href="http://wesley.vidiqatch.org/images/qpasm_1.1_rc1.png"><img class="alignnone" title="QPasm 1.1 RC1" src="http://wesley.vidiqatch.org/images/qpasm_1.1_rc1.png" alt="" width="625" height="394" /></a></p>
<p>The new version of QPasm has the following <strong>new</strong> features:</p>
<ul>
<li>Code editor with intelligent syntax highlighting, line numbering, visual breakpoints and undo/redo functionality</li>
<li>Debugging features: breakpoints, manual step, timed step, pausing</li>
<li>On-the-fly editing of data in the register or the memory</li>
<li>On-the-fly symbol resolving: labels can be used in assembler apps, and when modifying memory when the program is running the labels are resolved automatically</li>
<li>Integrates well with light and dark system themes. Highlighter chooses its color theme based on the darkness of the theme automatically, but colors and fonts can be configured manually as well</li>
<li>Layout, font and color settings are stored locally in a portable config.ini file</li>
<li>Input format is very flexible: white space may occur before, after and between instructions, instructions are case insensitive, comments are supported anywhere</li>
<li>Pseudo-assembler apps which are run using the run-function run in a separate thread which has a system preventing the GUI from freezing by limiting the amount of simultaneous signals to the GUI. Assembler apps which cause an endless loop cannot freeze the GUI</li>
</ul>
<p>More information, binaries and source code are available at <a href="http://code.google.com/p/qpasm/">http://code.google.com/p/qpasm/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/09-09-2009/qpasm-1-1-rc1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Small pseudo-assembler interpreter</title>
		<link>http://wesley.vidiqatch.org/30-08-2009/small-pseudo-assembler-interpreter/</link>
		<comments>http://wesley.vidiqatch.org/30-08-2009/small-pseudo-assembler-interpreter/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 14:02:56 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=527</guid>
		<description><![CDATA[I had to develop a pseudo-assembler interpreter for the course Microprocessing.
Since it was just lying around on my hard drive I figured I could just as well put it on-line. It contains a few things that might be interesting to developers:

Using a C library in C++/Qt applications and translating C function callbacks into Qt signals
Implementation [...]]]></description>
			<content:encoded><![CDATA[<p>I had to develop a <strong>pseudo-assembler interpreter</strong> for the course <em><strong>Microprocessing</strong></em>.</p>
<p>Since it was just lying around on my hard drive I figured I could just as well put it on-line. It contains a few things that might be interesting to developers:</p>
<ul>
<li>Using a C library in C++/Qt applications and translating C function callbacks into Qt signals</li>
<li>Implementation of virtual static and virtual dynamic memory</li>
<li>Converting between virtual signed and unsigned values (system independent)</li>
<li>Saving data and instructions in same virtual memory (Von Neumann architecture)</li>
</ul>
<p style="text-align: center;"><a href="http://wesley.vidiqatch.org/files/qpasm/qpasm_1.0_screen.png"><img class="aligncenter" title="QPasm 1.0" src="http://wesley.vidiqatch.org/files/qpasm/qpasm_1.0_screen.png" alt="" width="614" height="340" /></a></p>
<p>More information (and source code) is available here: <a href="http://wesley.vidiqatch.org/files/qpasm/">http://wesley.vidiqatch.org/files/qpasm/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/30-08-2009/small-pseudo-assembler-interpreter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Back in the Dutch Ubuntu LoCoTeam</title>
		<link>http://wesley.vidiqatch.org/20-08-2009/back-in-the-dutch-ubuntu-locoteam/</link>
		<comments>http://wesley.vidiqatch.org/20-08-2009/back-in-the-dutch-ubuntu-locoteam/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 00:48:53 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=518</guid>
		<description><![CDATA[
Back In 2006 I was active for nearly two years in the Dutch Ubuntu LoCoTeam as site/forum administrator and release party organiser. Due to time constraints (among many other factors) my participation as LoCoTeam member steadily declined. But yesterday I became moderator of the official Dutch Ubuntu forums again. So far the community response (by [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" title="Ubuntu-NL" src="http://hardy.releaseparty.eu/images/ubuntu-nl_logo.jpg" alt="" width="300" height="69" /></p>
<p>Back In 2006 I was active for nearly two years in the Dutch Ubuntu LoCoTeam as site/forum administrator and release party organiser. Due to time constraints (among many other factors) my participation as LoCoTeam member steadily declined. But yesterday I became moderator of the official <a href="http://forum.ubuntu-nl.org/">Dutch Ubuntu forums</a> again. So far the community response (by e-mail) has been wonderful. It feels kind of good to know that a lot of people thought you did a great job back then and that they are happy with your return <img src='http://wesley.vidiqatch.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I hope I can make enough time to actively help out the LoCoTeam &#8211; because there&#8217;s a lot of other stuff to do as well &#8211; and I can only do my best. The reason for my renewed participation is that I want to make a difference instead of complaining about some of the problems I was seeing. Of course some problems are to be expected: Ubuntu-NL has <strong>grown considerably</strong>. When I think back of my first days as forum administrator (about 2 years ago) I could easily read all posts myself. There were about <strong>600</strong> registered forum users in total, but today there are over <strong>17.000</strong>!</p>
<p>Oh well. I hope I can make a difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/20-08-2009/back-in-the-dutch-ubuntu-locoteam/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Overriding dynamic library calls (function interposition)</title>
		<link>http://wesley.vidiqatch.org/18-08-2009/overriding-dynamic-library-calls-function-interposition/</link>
		<comments>http://wesley.vidiqatch.org/18-08-2009/overriding-dynamic-library-calls-function-interposition/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 07:32:57 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=497</guid>
		<description><![CDATA[About function interposition
I was wondering how I could override dynamic library calls in Linux, and I came across this technique known as function interposition. It is a powerful technique that allows you to override dynamic library calls. It might sound dull, but it can be very, very useful. There are some memory trace tools that [...]]]></description>
			<content:encoded><![CDATA[<h4>About function interposition</h4>
<p>I was wondering how I could <em>override dynamic library calls</em> in Linux, and I came across this technique known as <strong>function interposition</strong>. It is a powerful technique that allows you to override dynamic library calls. It might sound dull, but it can be very, very useful. There are some memory trace tools that make use of this technique to work, but perhaps a cooler example is the <a href="http://nullkey.ath.cx/projects/glc/">OpenGL capture system</a> which was created by <a href="nullkey.ath.cx">nullkey</a>: it can capture OpenGL frames by overriding certain OpenGL functions. Another example are cheat tools (wallhacks, aimbots) which also make use of this technique a lot.</p>
<h4>Some background</h4>
<p>While Googling <em>(did I spell that right?)</em> I came across <a href="http://www.jayconrod.com/cgi/view_post.py?23">this</a> recent blog article which explains the background very well. I will quote it here:</p>
<blockquote><p>First, some background. When a program that uses dynamic libraries is compiled, a list of undefined symbols is included in the binary, along with a list of libraries the program is linked with. There is no correspondence between the symbols and the libraries; the two lists just tell the loader which libraries to load and which symbols need to be resolved. At runtime, each symbol is resolved using the first library that provides it. This means that if we can get a library containing our wrapper functions to load before other libraries, the undefined symbols in the program will be resolved to our wrappers instead of the real functions.</p></blockquote>
<p>So if we create a custom shared library which overrides some of the functions of the original library, our functions will be called instead of those of the original library.</p>
<h4>How to do it</h4>
<ul>
<li>Write new functions which override existing functions</li>
<li>Compile the written code to a dynamic library that is linked to the dynamic linking interface library</li>
<li>Use the <em>LD_PRELOAD</em> environment variable when running an application to preload your custom library before all other dynamic libraries</li>
</ul>
<p><a href="http://www.jayconrod.com/cgi/view_post.py?23">The article by Jay Conrod</a> has an example which shows you the basic implementation of a simple memory allocation tracer.</p>
<p>I have also cooked up an example myself. Because I&#8217;ve been busy learning more about OpenGL, I thought that it shouldn&#8217;t be too hard to create a wallhack for one of my favourite games: <a href="http://en.wikipedia.org/wiki/Soldier_of_Fortune_II:_Double_Helix">Soldier of Fortune 2</a> running in Wine. Just for testing purposes of course! I am no cheater <img src='http://wesley.vidiqatch.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  It turned out to be relatively simple, although my first tries weren&#8217;t so very successful:</p>
<ul>
<li><a href="http://wesley.vidiqatch.org/images/hack_v1.png">Epic fail</a> &#8211; At least I know my library is used now.</li>
<li><a href="http://wesley.vidiqatch.org/images/hack_v2.png">Partial success</a> &#8211; Disabling depth testing completely was only a partial success.</li>
<li><a href="http://wesley.vidiqatch.org/images/hack_v3.png">Success</a> &#8211; A debugger can tell that players are drawn using glDrawElements(). By knowing the number of elements for each character, we can disable depth testing selectively.</li>
</ul>
<div class="wp-caption aligncenter" style="width: 568px"><a href="/images/hack_v3.png"><img title="SoF2 wallhack" src="/images/hack_v3.png" alt="Soldier of Fortune 2 wallhack example" width="558" height="430" /></a><p class="wp-caption-text">Soldier of Fortune 2 wallhack example</p></div>
<p>For those of you who are interested in the code:</p>
<div class="codecolorer-container cpp-qt default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br /></div></td><td><div class="cpp-qt codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #888888; font-style: italic;">/*<br />
&nbsp; &nbsp; Simple wallhack example for Soldier of Fortune 2 (Wine) in Linux using function interposition<br />
<br />
&nbsp; &nbsp; This code snippet was written by Wesley Stessens (wesley@ubuntu.com)<br />
&nbsp; &nbsp; It is released in the Public Domain.<br />
<br />
&nbsp; &nbsp; Compilation: gcc -Wall -ansi -pedantic -shared -ldl -fPIC glhack.c -o glhack.so<br />
&nbsp; &nbsp; Usage: LD_PRELOAD=glhack.so wine game.exe<br />
*/</span><br />
<br />
<span style="color: #006E28;">#define _GNU_SOURCE</span><br />
<span style="color: #006E28;">#include &lt;dlfcn.h&gt;</span><br />
<span style="color: #006E28;">#include &lt;stdio.h&gt;</span><br />
<span style="color: #006E28;">#include &lt;stdint.h&gt;</span><br />
<span style="color: #006E28;">#include &lt;GL/gl.h&gt;</span><br />
<br />
<span style="color: #888888; font-style: italic;">/* Override the glDrawElements function */</span><br />
GLAPI <span style="color: #0057AE;">void</span> GLAPIENTRY glDrawElements<span style="color: #006E28;">&#40;</span>GLenum mode<span style="color: #006E28;">,</span> GLsizei count<span style="color: #006E28;">,</span> GLenum type<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> GLvoid <span style="color: #006E28;">*</span>indices<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #888888; font-style: italic;">/* Store the actual function in a static function pointer */</span><br />
&nbsp; &nbsp; <span style="color: #0057AE;">static</span> <span style="color: #0057AE;">void</span> <span style="color: #006E28;">&#40;</span><span style="color: #006E28;">*</span>glDrawElements_<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#40;</span>GLenum mode<span style="color: #006E28;">,</span> GLsizei count<span style="color: #006E28;">,</span> GLenum type<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> GLvoid <span style="color: #006E28;">*</span>indices<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">=</span> NULL<span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">if</span> <span style="color: #006E28;">&#40;</span><span style="color: #006E28;">!</span>glDrawElements_<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; glDrawElements_ <span style="color: #006E28;">=</span> <span style="color: #006E28;">&#40;</span><span style="color: #0057AE;">void</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">*</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#40;</span>intptr_t<span style="color: #006E28;">&#41;</span>dlsym<span style="color: #006E28;">&#40;</span>RTLD_NEXT<span style="color: #006E28;">,</span> <span style="color: #BF0303;">&quot;glDrawElements&quot;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #2B74C7;">puts</span><span style="color: #006E28;">&#40;</span><span style="color: #BF0303;">&quot;GLHack: glDrawElements call has been overridden&quot;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <span style="color: #006E28;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888; font-style: italic;">/* Disable depth testing if the number of elements to draw is one of the following, which means a player is being drawn */</span><br />
&nbsp; &nbsp; <span style="color: #888888; font-style: italic;">/* To avoid abuse of this code by cheaters, I have changed all count constants below to VALUEX */</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">if</span> <span style="color: #006E28;">&#40;</span>count <span style="color: #006E28;">==</span> VALUE1 <span style="color: #006E28;">||</span> count <span style="color: #006E28;">==</span> VALUE2 <span style="color: #006E28;">||</span> count <span style="color: #006E28;">==</span> VALUE3 <span style="color: #006E28;">||</span> count <span style="color: #006E28;">==</span> VALUE4<span style="color: #006E28;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; glDisable<span style="color: #006E28;">&#40;</span>GL_DEPTH_TEST<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnable<span style="color: #006E28;">&#40;</span>GL_DEPTH_TEST<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; glDrawElements_<span style="color: #006E28;">&#40;</span>mode<span style="color: #006E28;">,</span> count<span style="color: #006E28;">,</span> type<span style="color: #006E28;">,</span> indices<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<span style="color: #006E28;">&#125;</span></div></td></tr></tbody></table></div>
<h4>Interesting thought about multiplayer cheats and Wine</h4>
<p>If anti-cheat tools would perform a sanity check of the OpenGL or DirectX DLL, they would only find the virtual DLL&#8217;s when a game is run in Wine, right? I&#8217;m wondering whether this sort of cheats can be made undetectable then. In a way I hope not, because cheaters are very annoying when you&#8217;re playing a game, but on the other hand, it would be an amazing technological achievement. Anyway, anti-cheat tools like <em>PunkBuster</em> don&#8217;t even work with Wine at the moment, so it might be a non-issue. What are your thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/18-08-2009/overriding-dynamic-library-calls-function-interposition/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Code snippets</title>
		<link>http://wesley.vidiqatch.org/12-08-2009/code-snippets/</link>
		<comments>http://wesley.vidiqatch.org/12-08-2009/code-snippets/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 16:38:17 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=460</guid>
		<description><![CDATA[I&#8217;ve created a new page where I will upload small code snippets that I created and which might be useful for some. Most code snippets are released in the Public Domain. The code snippets might not have the highest quality, so feel free to propose improvements to them if you feel like it.
PS: I have [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a <a href="/code-snippets/">new page</a> where I will upload small code snippets that I created and which might be useful for some. Most code snippets are released in the <em>Public Domain</em>. The code snippets might not have the highest quality, so feel free to propose improvements to them if you feel like it.</p>
<p><em>PS: I have moved the &#8220;safe replacement for gets&#8221; blogpost to the code snippets page and have moved over all the comments as well.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/12-08-2009/code-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>100 visits by 50 unique visitors</title>
		<link>http://wesley.vidiqatch.org/08-08-2009/100-visits-by-50-unique-visitors/</link>
		<comments>http://wesley.vidiqatch.org/08-08-2009/100-visits-by-50-unique-visitors/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 00:44:52 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=419</guid>
		<description><![CDATA[This blog has been back on line for 5 days now. I am using Google Analytics to obtain statistics about the visitors of this website. Don&#8217;t be scared though; no personal information is collected. I thought it would be nice to discuss some of the statistics, as I have now had 100 visits by 50 [...]]]></description>
			<content:encoded><![CDATA[<p>This blog has been back on line for 5 days now. I am using <a href="http://www.google.com/analytics/">Google Analytics</a> to obtain statistics about the visitors of this website. Don&#8217;t be scared though; no personal information is collected. I thought it would be nice to discuss some of the statistics, as I have now had <strong>100 visits by 50 unique visitors</strong> in total.</p>
<p><em>I should note that at this early age of my blog the results aren&#8217;t very trustworthy, but they should give you a rough sketch anyway.</em></p>
<h3>Webbrowsers</h3>
<p><img class="aligncenter" title="Browser usage" src="http://wesley.vidiqatch.org/images/browserusage_8aug_.png" alt="" width="600" height="240" />Visitors of this blog seem to prefer <a href="http://en.wikipedia.org/wiki/Firefox"><strong><em>Firefox</em></strong></a> (56.44%), although there have been a lot of visits by the <a href="http://en.wikipedia.org/wiki/Safari_(web_browser)"><strong><em>Safari</em></strong></a> (28.71%) webbrowser as well. <a href="http://en.wikipedia.org/wiki/Google_Chrome"><strong><em>Chrome</em></strong></a> and <a href="http://en.wikipedia.org/wiki/Mozilla"><strong><em>Mozilla</em></strong></a> are a bit less popular among my visitors, both have a share of 5.94% individually. The most shocking however, is the low amount of visits by the <a href="http://en.wikipedia.org/wiki/Internet_explorer"><strong><em>Internet Explorer</em></strong></a> webbrowser. Less than 2% of visits to this blog have been made using this webbrowser. I can only applaud that. Okay, perhaps the results aren&#8217;t that shocking after all, knowing that this blog is primarily aimed at Linux users and/or developers.</p>
<h3>Operating systems</h3>
<p style="text-align: left;"><img class="aligncenter" title="Operating system usage" src="http://wesley.vidiqatch.org/images/osusage_8aug_.png" alt="" width="600" height="240" />44.55% of all visits were made by people using the <strong><a href="http://en.wikipedia.org/wiki/Linux"><em>Linux</em></a></strong> operating system. This is not a big surprise, as my blog is primarily aimed at Linux users. More surprisingly however: an astonishing 31.68% of all visits were made by people using the <strong><a href="http://en.wikipedia.org/wiki/Mac_os_x"><em>Mac OS X</em></a></strong> operating system. A possible explanation is that a lot of my blogposts are about cross-platform development and that a lot of the posts about <em>Linux</em> are applicable to <em>Mac OS X</em> as well (both operating systems are fully <a href="http://en.wikipedia.org/wiki/POSIX"><em>POSIX</em></a>-compliant). Only 22.77% of my visitors use the <strong><a href="http://en.wikipedia.org/wiki/Windows">Windows</a></strong> operating system.</p>
<p><strong>PS: I have created a <a href="http://wesley.vidiqatch.org/request-article/"><em>Request article</em></a> page. If you are interested in something about Linux or programming or anything else that I might find interesting to write about, just tell me by posting a comment on that page!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/08-08-2009/100-visits-by-50-unique-visitors/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>NeHe OpenGL lessons in Qt &#8211; Chapter 4</title>
		<link>http://wesley.vidiqatch.org/08-08-2009/nehe-opengl-lessons-in-qt-chapter-4/</link>
		<comments>http://wesley.vidiqatch.org/08-08-2009/nehe-opengl-lessons-in-qt-chapter-4/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 23:43:25 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=414</guid>
		<description><![CDATA[As promised, the fourth chapter of the NeHe OpenGL lessons ported to make use of the Qt toolkit.
 
Fourth chapter: fog, fonts revisited, quadrics, particle engine, triangle strips, masking
In the fourth chapter you will learn a few cooler tricks. You will learn how to create good-looking fog effects and how certain objects can easily be [...]]]></description>
			<content:encoded><![CDATA[<p>As promised, the fourth chapter of the <a href="http://nehe.gamedev.net/">NeHe OpenGL lessons</a> ported to make use of the <a href="http://www.qtsoftware.com/">Qt toolkit</a>.</p>
<p style="text-align: center;"><img title="OpenGL" src="http://www.fabioruini.eu/blog/wp-content/uploads/2008/07/opengl_logo.png" alt="" width="137" height="72" /> <img title="Qt 4" src="http://www.qtsoftware.com/logo.png" alt="" width="174" height="71" /></p>
<h4>Fourth chapter: fog, fonts revisited, quadrics, particle engine, triangle strips, masking</h4>
<p>In the <a href="http://nehe.gamedev.net/lesson.asp?index=04">fourth chapter</a> you will learn a few cooler tricks. You will learn how to create good-looking fog effects and how certain objects can easily be constructed using quadrics. But the coolest thing that you will learn is how to create a simple <strong>particle engine</strong> (during lesson 19). To end off the chapter, you will learn how you can use masking to create partial transparency using bitmap textures.</p>
<p><em>Some minor modifications were made to improve the visual appearance of some of the lessons.</em></p>
<p><img class="aligncenter" title="Particle engine" src="http://wesley.vidiqatch.org/images/particles_snapshot.png" alt="" width="386" height="269" /></p>
<h4>Videos and source code</h4>
<p><a href="http://www.youtube.com/watch?v=SksYPqFCj4M&amp;fmt=18">This video</a> shows the fog effect (lesson 16)<br />
<a href="http://www.youtube.com/watch?v=5TxEGk6W-YU&amp;fmt=18">This video</a> shows what you can achieve using quadrics (lesson 18)<br />
<a href="http://www.youtube.com/watch?v=0FfH9fx_hJo&amp;fmt=18">This video</a> shows the very cool particle engine that you will create! (lesson 19)<br />
<a href="http://www.youtube.com/watch?v=gfBfRVgi5FU&amp;fmt=18">This video</a> shows which effect masking has (lesson 20)<br />
You can download the Qt 4 source code for this chapter <a href="http://wesley.vidiqatch.org/files/chapter4.zip"><strong>here</strong></a>.</p>
<p><em>PS: The port of chapter 5 will take a while&#8230; I will be a bit busy the coming weeks, and the first lesson of chapter 5 is HUGE, so will require a lot of time to port.<br />
Oh, and apparently I forgot to upload the source code for the third chapter. I have uploaded it now <img src='http://wesley.vidiqatch.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/08-08-2009/nehe-opengl-lessons-in-qt-chapter-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NeHe OpenGL lessons in Qt – Chapter 3</title>
		<link>http://wesley.vidiqatch.org/04-08-2009/nehe-opengl-lessons-in-qt-chapter-3/</link>
		<comments>http://wesley.vidiqatch.org/04-08-2009/nehe-opengl-lessons-in-qt-chapter-3/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 19:57:01 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=409</guid>
		<description><![CDATA[Here is the third chapter of the NeHe OpenGL lessons ported to make use of the Qt toolkit.
 
Third chapter: waving texture, display lists and a lot of fonts
The third chapter starts off with a cool looking waving flag effect. After that you will learn about display lists. The last three lessons focus on different [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the third chapter of the <a href="http://nehe.gamedev.net/">NeHe OpenGL lessons</a> ported to make use of the <a href="http://www.qtsoftware.com/">Qt toolkit</a>.</p>
<p style="text-align: center;"><img title="OpenGL" src="http://www.fabioruini.eu/blog/wp-content/uploads/2008/07/opengl_logo.png" alt="" width="137" height="72" /> <img title="Qt 4" src="http://www.qtsoftware.com/logo.png" alt="" width="174" height="71" /></p>
<h4>Third chapter: waving texture, display lists and a lot of fonts</h4>
<p>The <a href="http://nehe.gamedev.net/lesson.asp?index=03">third chapter</a> starts off with a cool looking <strong>waving flag effect</strong>. After that you will learn about <strong>display lists</strong>. The last three lessons focus on different ways of <strong>displaying fonts</strong>. It is worth noting that rendering basic text at a chosen location, or translated into the OpenGL scene is extremely easy in Qt/OpenGL thanks to <a href="http://doc.qtsoftware.com/4.5/qglwidget.html#renderText">QGLWidget::renderText()</a>. For other basic text effects (such as rotated, skewed or otherwise transformed text) you could also use <a href="http://doc.qtsoftware.com/4.5/qpainter.html">QPainter</a> directly on a <a href="http://doc.qtsoftware.com/4.5/qglwidget.html">QGLWidget</a>. We won&#8217;t be doing this in our examples, but I just wanted to point out that it is possible.</p>
<p>I should also note that I have used an extra library in lesson 14 to display the 3D text. Qt itself is not able to display 3D text and doing this in a cross-platform way yourself would be rather hard. That&#8217;s why I have used the <a href="http://sourceforge.net/projects/ftgl/develop"><strong>FTGL</strong></a> library for this. FTGL is a very easy to use cross-platform library with the sole purpose of rendering (3D) text in OpenGL.</p>
<h4>Videos and source code</h4>
<p><a href="http://www.youtube.com/watch?v=jy3g5TV0WRg&amp;fmt=18">This video</a> shows the waving flag effect (lesson 11)<br />
<a href="http://www.youtube.com/watch?v=-uaRypjMJuo&amp;fmt=18">This video</a> shows the effect of using display lists (lesson 12)<br />
<a href="http://www.youtube.com/watch?v=MZlRzwxqw3c&amp;fmt=18">This video</a> shows rotated 3D text (lesson 14)<br />
You can download the Qt 4 source code for this chapter <a href="http://wesley.vidiqatch.org/files/chapter3.zip"><strong>here</strong></a>.</p>
<p><em>PS: You can expect chapter 4 in a few days <img src='http://wesley.vidiqatch.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/04-08-2009/nehe-opengl-lessons-in-qt-chapter-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Resizable photo frames in Qt</title>
		<link>http://wesley.vidiqatch.org/04-08-2009/resizable-photo-frames-in-qt/</link>
		<comments>http://wesley.vidiqatch.org/04-08-2009/resizable-photo-frames-in-qt/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 23:03:09 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=388</guid>
		<description><![CDATA[Today someone asked how to copy one image into another image in Qt. I thought it was a nice idea to write an example about how to do that, plus a few extra things. We will create a resizable photo frame from just one simple image of a photo frame! It works like this:

Reimplement QWidget::paintEvent() [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Today someone asked how to copy one image into another image in Qt. I thought it was a nice idea to write an example about how to do that, plus a few extra things. We will create a resizable photo frame from just one simple image of a photo frame!</strong> It works like this:</p>
<ul>
<li>Reimplement <a href="http://doc.qtsoftware.com/latest/qwidget.html#paintEvent">QWidget::paintEvent()</a> and construct a <a href="http://doc.qtsoftware.com/latest/qpainter.html">QPainter</a>(this) in the reimplementation so we can draw on the widget</li>
<li>Load the image of the photo frame and define 4 <a href="http://doc.qtsoftware.com/latest/qrect.html">QRect</a> objects to define the position of the frame borders &#8211; these borders are not allowed to scale</li>
<li>Draw something which will be contained inside of the frame &#8211; for example another image using <a href="http://doc.qtsoftware.com/latest/qpainter.html#drawPixmap">QPainter::drawPixmap()</a> or <a href="http://doc.qtsoftware.com/latest/qpainter.html#drawImage">QPainter::drawImage()</a></li>
<li>Generate and draw the frame bars (the pieces between the borders)
<ul>
<li>Make use of the <a href="http://doc.qtsoftware.com/latest/qimage.html#mirrored">QImage::mirrored()</a> function and another QPainter to create a new pixmap which contains the frame bar plus the mirrored frame bar.</li>
<li>This will make the bar look great when the frame bar is enlarged by tiling. This method is actually a very popular one in basic photo manipulation.</li>
</ul>
</li>
<li>Draw the four borders</li>
</ul>
<p><strong>The result looks like this:</strong></p>
<p><a href="http://wesley.vidiqatch.org/images/photowidget1.png">Photo frame in native size</a> &#8211; versus &#8211; <a href="http://wesley.vidiqatch.org/images/photowidget2.png">Enlarged photo frame</a></p>
<p><strong>The code looks like this:</strong></p>
<p style="text-align: center;">photowidget.h</p>
<div class="codecolorer-container cpp-qt default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="cpp-qt codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006E28;">#ifndef PHOTOWIDGET_H</span><br />
<span style="color: #006E28;">#define PHOTOWIDGET_H</span><br />
<br />
<span style="color: #006E28;">#include &lt;QtGui/QWidget&gt;</span><br />
<br />
<span style="color: #0057AE;">class</span> PhotoWidget <span style="color: #006E28;">:</span> <span style="color: #0057AE;">public</span> <a href="http://doc.trolltech.com/latest/qwidget.html"><span style="color: #22aadd;">QWidget</span></a> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0057AE;">Q_OBJECT</span><br />
<br />
<span style="color: #0057AE;">public</span><span style="color: #006E28;">:</span><br />
&nbsp; &nbsp; PhotoWidget<span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qwidget.html"><span style="color: #22aadd;">QWidget</span></a> <span style="color: #006E28;">*</span>parent <span style="color: #006E28;">=</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
<span style="color: #0057AE;">protected</span><span style="color: #006E28;">:</span><br />
&nbsp; &nbsp; <span style="color: #0057AE;">void</span> paintEvent<span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpaintevent.html"><span style="color: #22aadd;">QPaintEvent</span></a> <span style="color: #006E28;">*</span>event<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
<span style="color: #0057AE;">private</span><span style="color: #006E28;">:</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> createBar<span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Orientation</span> orientation<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> <span style="color: #006E28;">&amp;</span>pixmap<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> <span style="color: #006E28;">&amp;</span>rect<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<span style="color: #006E28;">&#125;</span><span style="color: #006E28;">;</span><br />
<br />
<span style="color: #006E28;">#endif // PHOTOWIDGET_H</span></div></td></tr></tbody></table></div>
<p style="text-align: center;">photowidget.cpp</p>
<div class="codecolorer-container cpp-qt default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br /></div></td><td><div class="cpp-qt codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006E28;">#include &quot;photowidget.h&quot;</span><br />
<span style="color: #006E28;">#include &lt;QPainter&gt;</span><br />
<span style="color: #006E28;">#include &lt;QPaintEvent&gt;</span><br />
<br />
<span style="color: #006E28;">#define SIZE 108</span><br />
<br />
PhotoWidget<span style="color: #006E28;">::</span><span style="color: #2B74C7;">PhotoWidget</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qwidget.html"><span style="color: #22aadd;">QWidget</span></a> <span style="color: #006E28;">*</span>parent<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">:</span> <a href="http://doc.trolltech.com/latest/qwidget.html"><span style="color: #22aadd;">QWidget</span></a><span style="color: #006E28;">&#40;</span>parent<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; resize<span style="color: #006E28;">&#40;</span>400<span style="color: #006E28;">,</span> 329<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; setWindowTitle<span style="color: #006E28;">&#40;</span><span style="color: #BF0303;">&quot;Photo Frame Example&quot;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<span style="color: #006E28;">&#125;</span><br />
<br />
<span style="color: #888888;">// This function generates a pixmap that can be used as a tiled bar.</span><br />
<span style="color: #888888;">// Note: We use a QPainter and the mirrored() function to make sure that the bar looks good when tiled.</span><br />
<span style="color: #888888;">// &nbsp; &nbsp; &nbsp; This technique is often applied in basic photo manipulation.</span><br />
<a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> PhotoWidget<span style="color: #006E28;">::</span><span style="color: #2B74C7;">createBar</span><span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Orientation</span> orientation<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> <span style="color: #006E28;">&amp;</span>pixmap<span style="color: #006E28;">,</span> <span style="color: #0057AE;">const</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> <span style="color: #006E28;">&amp;</span>rect<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qimage.html"><span style="color: #22aadd;">QImage</span></a> barA <span style="color: #006E28;">=</span> pixmap.<span style="color: #2B74C7;">copy</span><span style="color: #006E28;">&#40;</span>rect<span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">toImage</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qimage.html"><span style="color: #22aadd;">QImage</span></a> barB <span style="color: #006E28;">=</span> barA.<span style="color: #2B74C7;">mirrored</span><span style="color: #006E28;">&#40;</span>orientation <span style="color: #006E28;">==</span> Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Horizontal</span> ? <span style="color: #0057AE;">true</span> <span style="color: #006E28;">:</span> <span style="color: #0057AE;">false</span><span style="color: #006E28;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; orientation <span style="color: #006E28;">==</span> Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Vertical</span> ? <span style="color: #0057AE;">true</span> <span style="color: #006E28;">:</span> <span style="color: #0057AE;">false</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qsize.html"><span style="color: #22aadd;">QSize</span></a> size<span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; size.<span style="color: #2B74C7;">setWidth</span><span style="color: #006E28;">&#40;</span>orientation <span style="color: #006E28;">==</span> Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Horizontal</span> ? barA.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&lt;&lt;</span> 1 <span style="color: #006E28;">:</span> barA.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; size.<span style="color: #2B74C7;">setHeight</span><span style="color: #006E28;">&#40;</span>orientation <span style="color: #006E28;">==</span> Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Vertical</span> ? barA.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&lt;&lt;</span> 1 <span style="color: #006E28;">:</span> barA.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> bar<span style="color: #006E28;">&#40;</span>size<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; bar.<span style="color: #2B74C7;">fill</span><span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">transparent</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpainter.html"><span style="color: #22aadd;">QPainter</span></a> merger<span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&amp;</span>bar<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; merger.<span style="color: #2B74C7;">drawImage</span><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">,</span> barA<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">if</span> <span style="color: #006E28;">&#40;</span>orientation <span style="color: #006E28;">==</span> Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Horizontal</span><span style="color: #006E28;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; merger.<span style="color: #2B74C7;">drawImage</span><span style="color: #006E28;">&#40;</span>barA.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> 0<span style="color: #006E28;">,</span> barB<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; merger.<span style="color: #2B74C7;">drawImage</span><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> barA.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> barB<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight:bold;">return</span> bar<span style="color: #006E28;">;</span><br />
<span style="color: #006E28;">&#125;</span><br />
<br />
<span style="color: #0057AE;">void</span> PhotoWidget<span style="color: #006E28;">::</span><span style="color: #2B74C7;">paintEvent</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpaintevent.html"><span style="color: #22aadd;">QPaintEvent</span></a> <span style="color: #006E28;">*</span>event<span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpainter.html"><span style="color: #22aadd;">QPainter</span></a> p<span style="color: #006E28;">&#40;</span><span style="color: #000000; font-weight:bold;">this</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888;">// Our frame as one full image, and an image to put in the frame</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> frame<span style="color: #006E28;">&#40;</span><span style="color: #BF0303;">&quot;:/img/frame.png&quot;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qpixmap.html"><span style="color: #22aadd;">QPixmap</span></a> sky<span style="color: #006E28;">&#40;</span><span style="color: #BF0303;">&quot;:/img/palmtree.jpg&quot;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888;">// These four rectangles define the four borders of the frame</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> topLeft<span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> topRight<span style="color: #006E28;">&#40;</span>frame.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> bottomLeft<span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a> bottomRight<span style="color: #006E28;">&#40;</span>frame.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> SIZE<span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888;">// Draw the image first</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span>40<span style="color: #006E28;">,</span> 40<span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">width</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> 80<span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">height</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> 80<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> sky<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888;">// Draw the bars</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawTiledPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">topRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">,</span> SIZE <span style="color: #006E28;">-</span> 1<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBar<span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Horizontal</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">topRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawTiledPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span>event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomLeft</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE <span style="color: #006E28;">-</span> 1<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBar<span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Horizontal</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span>frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomLeft</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawTiledPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomLeft</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBar<span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Vertical</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomLeft</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">+</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawTiledPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span>event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">topRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE <span style="color: #006E28;">+</span> 1<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createBar<span style="color: #006E28;">&#40;</span>Qt<span style="color: #006E28;">::</span><span style="color: #2B74C7;">Vertical</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> <a href="http://doc.trolltech.com/latest/qrect.html"><span style="color: #22aadd;">QRect</span></a><span style="color: #006E28;">&#40;</span>frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">topRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> <span style="color: #006E28;">-</span>SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame.<span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #888888;">// Draw the borders</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawPixmap</span><span style="color: #006E28;">&#40;</span><a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> topLeft<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawPixmap</span><span style="color: #006E28;">&#40;</span>event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">topRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> 0<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> topRight<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawPixmap</span><span style="color: #006E28;">&#40;</span>event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomLeft</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>0<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> bottomLeft<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
&nbsp; &nbsp; p.<span style="color: #2B74C7;">drawPixmap</span><span style="color: #006E28;">&#40;</span>event<span style="color: #006E28;">-&gt;</span><span style="color: #2B74C7;">rect</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span>.<span style="color: #2B74C7;">bottomRight</span><span style="color: #006E28;">&#40;</span><span style="color: #006E28;">&#41;</span> <span style="color: #006E28;">-</span> <a href="http://doc.trolltech.com/latest/qpoint.html"><span style="color: #22aadd;">QPoint</span></a><span style="color: #006E28;">&#40;</span>SIZE<span style="color: #006E28;">,</span> SIZE<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">,</span> frame<span style="color: #006E28;">,</span> bottomRight<span style="color: #006E28;">&#41;</span><span style="color: #006E28;">;</span><br />
<span style="color: #006E28;">&#125;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/04-08-2009/resizable-photo-frames-in-qt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NeHe OpenGL lessons in Qt &#8211; Chapter 1 and 2</title>
		<link>http://wesley.vidiqatch.org/03-08-2009/nehe-opengl-lessons-in-qt-chapter-1-and-2/</link>
		<comments>http://wesley.vidiqatch.org/03-08-2009/nehe-opengl-lessons-in-qt-chapter-1-and-2/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 17:16:38 +0000</pubDate>
		<dc:creator>Wesley</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://wesley.vidiqatch.org/?p=365</guid>
		<description><![CDATA[Last week I have ported two chapters (the first 10 lessons) of the NeHe OpenGL lessons to make use of the Qt toolkit. You will notice that the code in Qt is much cleaner and simpler than the code in the original NeHe lessons. There is no need to create a rendering or device context [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I have ported two chapters (the first 10 lessons) of the <a href="http://nehe.gamedev.net/">NeHe OpenGL lessons</a> to make use of the <a href="http://www.qtsoftware.com/">Qt toolkit</a>. You will notice that the code in Qt is much <strong>cleaner</strong> and <strong>simpler</strong> than the code in the original NeHe lessons. There is no need to create a rendering or device context yourself or anything like that, and input support like input from keyboard or mouse can simply be implemented by reimplementing one function. As an added bonus, your 3D applications will run on pretty much any platform.</p>
<p style="text-align: center;"><img title="OpenGL" src="http://www.fabioruini.eu/blog/wp-content/uploads/2008/07/opengl_logo.png" alt="" width="137" height="72" /> <img title="Qt 4" src="http://www.qtsoftware.com/logo.png" alt="" width="174" height="71" /></p>
<h4>First chapter: setting up an OpenGL window, polygons, colors, rotation, 3D shapes</h4>
<p>After completing the <a href="http://nehe.gamedev.net/lesson.asp?index=01">first chapter</a>, you will end up with a rotating pyramid and cube&#8230;<a href="http://www.youtube.com/watch?v=dE3_vgnm7Ck&amp;fmt=18"></a></p>
<p><a href="http://www.youtube.com/watch?v=dE3_vgnm7Ck&amp;fmt=18">This video</a> shows the end result (lesson 5).<br />
You can download the Qt 4 source code for this chapter <a href="http://wesley.vidiqatch.org/files/chapter1.zip"><strong>here</strong></a>.</p>
<h4>Second chapter: texture mapping, texture filters, lighting, keyboard control, blending, moving bitmaps in 3D space, loading and moving through a 3D world</h4>
<p>In the <a href="http://nehe.gamedev.net/lesson.asp?index=02">second chapter</a> you will learn a lot about textures, among some other things. Sometimes we make use of <a href="http://doc.qtsoftware.com/4.5/qglcontext.html#bindTexture">QGLContext::bindTexture()</a> to load an image, morph it into a texture and bind it to OpenGL all in one go. Other times we will do it manually because we want to specify the texture filter ourselves (but we do have <a href="http://doc.qtsoftware.com/4.5/qglwidget.html#convertToGLFormat">QGLWidget::convertToGLFormat()</a> which makes that easy as well). To handle keypresses we simply reimplement <a href="http://doc.qtsoftware.com/4.5/qwidget.html#keyPressEvent">keyPressEvent()</a>. To load in the 3D world from the file we make use of the excellent <a href="http://doc.qtsoftware.com/4.5/qfile.html">QFile</a> and <a href="http://doc.qtsoftware.com/4.5/qtextstream.html">QTextStream</a> classes. As an added <strong>bonus</strong>, we also make use of <a href="http://doc.qtsoftware.com/4.5/qglwidget.html#renderText">QGLWidget::renderText()</a> to show the user what has changed when a key is pressed inside the OpenGL window. Lesson 9 also features a <strong>bonus</strong> fade-in effect for the revived stars. This makes the effect look much cooler.</p>
<p><a href="http://www.youtube.com/watch?v=_apiJu9oF8A&amp;fmt=18">This video</a> shows the result of adding texture filters, lighting and keyboard control (lesson 7)<br />
<a href="http://www.youtube.com/watch?v=uoa8x4Vwxco&amp;fmt=18">This video</a> shows the result of all the above plus blending (lesson 8<em></em>)<br />
<a href="http://www.youtube.com/watch?v=MoFNngz7_qg&amp;fmt=18">This video</a> shows the result of moving bitmaps in 3D space (lesson 9)<br />
<a href="http://www.youtube.com/watch?v=JSybmJKGu1k&amp;fmt=18">This video</a> shows the result of moving through a very simple 3D world (lesson 10)<br />
You can download the Qt 4 source code for this chapter <a href="http://wesley.vidiqatch.org/files/chapter2.zip"><strong>here</strong></a>.</p>
<p>The <strong>third and fourth chapter</strong> are almost complete as well, but I will give you the Qt ports of those chapters another time. Perhaps tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://wesley.vidiqatch.org/03-08-2009/nehe-opengl-lessons-in-qt-chapter-1-and-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
