<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2611445094003468791</id><updated>2011-07-08T05:34:44.647+02:00</updated><category term='introduction'/><category term='NeHe'/><category term='Derelict'/><category term='D Programming'/><category term='SDL'/><category term='Tango'/><category term='OpenGL'/><title type='text'>OdeFu</title><subtitle type='html'>Now mostly about programming and gamedev</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://odefu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>45</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-6820344256357054701</id><published>2010-06-19T15:58:00.001+03:00</published><updated>2010-06-19T16:03:07.574+03:00</updated><title type='text'>Let's Roll Some Dice</title><content type='html'>I reimplemented my very simple dice rolling module. It is now a pair of functions instead of a struct, and it supports strings as input.&lt;br /&gt;&lt;br /&gt;Couple examples:&lt;br /&gt;&lt;pre&gt;auto roll = rollDice("1d4"); // results in a value between 1 and 4&lt;br /&gt;auto roll2 = rollDice("2d6+2", 4); // results in a value between 8 and 18&lt;br /&gt;auto roll3 = rollDice(1, 8, -2); // results in a value between -1 and 6&lt;br /&gt;&lt;/pre&gt;The parser doesn't support strings like "1d4 + 2d6". I have no plans to add that kind of support any way as it can be combined from smaller pieces.&lt;br /&gt;&lt;br /&gt;Source code: &lt;a href="http://odefu.googlecode.com/svn/trunk/D/Dice/dice.d"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-6820344256357054701?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6820344256357054701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6820344256357054701'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2010/06/lets-roll-some-dice.html' title='Let&apos;s Roll Some Dice'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5049369791469893359</id><published>2010-04-04T10:15:00.000+02:00</published><updated>2010-04-04T10:15:29.799+02:00</updated><title type='text'>Undeath</title><content type='html'>This blog's been dead for about two years now, and I don't see much of chance that it will change in the near future.&lt;br /&gt;&lt;br /&gt;I've started sharing some stuff in Google Reader from all the blogs I'm following, here:&lt;br /&gt;&lt;a href="http://www.google.com/reader/shared/OAalto"&gt;http:&lt;label class="custom-url-option"&gt;&lt;wbr&gt;&lt;/wbr&gt;/&lt;wbr&gt;&lt;/wbr&gt;/www.google.com&lt;wbr&gt;&lt;/wbr&gt;/reader&lt;wbr&gt;&lt;/wbr&gt;/shared&lt;wbr&gt;&lt;/wbr&gt;/OAalto&lt;/label&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;There's mostly AS3/Flash stuff, as that is the focus of my interests at the moment. If I have time I might write something about the &lt;a href="http://pushbuttonengine.com/"&gt;PushButton Engine&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5049369791469893359?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5049369791469893359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5049369791469893359'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2010/04/undeath.html' title='Undeath'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-405728911719186340</id><published>2008-12-15T14:49:00.002+02:00</published><updated>2008-12-15T15:09:34.428+02:00</updated><title type='text'>Composite Oriented Programming Part 2</title><content type='html'>I made a slightly more complicated version of the hello world example. This time I made two composite implementations of a Speaker interface.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public interface Speaker&lt;br /&gt;{&lt;br /&gt; public void setSpeech(char[] speech);&lt;br /&gt; &lt;br /&gt; public char[] speak();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then I changed how the data is handled as I didn't want two different templates, HelloData and ByeData. So I made a PropertiesMixin template which contains a simple way to set and get properties as char[]s.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public template PropertiesMixin()&lt;br /&gt;{&lt;br /&gt; private char[][char[]] properties;&lt;br /&gt; &lt;br /&gt; public void set(char[] name, char[] value)&lt;br /&gt; {&lt;br /&gt;  properties[name] = value;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public char[] get(char[] name, char[] defaultValue = null)&lt;br /&gt; {&lt;br /&gt;  if (name in properties)&lt;br /&gt;  {&lt;br /&gt;   return properties[name];&lt;br /&gt;  }&lt;br /&gt;  return defaultValue;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This can be used to add properties support to a class. There is room for improvement, for example some how use the tango.text.Properties class to save and load the properties.&lt;br /&gt;&lt;br /&gt;Then the real meat are the new HelloMixin and ByeMixin, which handles the heavy lifting.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public template HelloMixin()&lt;br /&gt;{&lt;br /&gt; private static const char[] HELLO = "hello";&lt;br /&gt; &lt;br /&gt; mixin PropertiesMixin;&lt;br /&gt; &lt;br /&gt; public void setSpeech(char[] speech)&lt;br /&gt; {&lt;br /&gt;  set(HELLO, speech);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public char[] speak()&lt;br /&gt; {&lt;br /&gt;  return get(HELLO);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public template ByeMixin()&lt;br /&gt;{&lt;br /&gt; private static const char[] BYE = "bye";&lt;br /&gt; &lt;br /&gt; mixin PropertiesMixin;&lt;br /&gt; &lt;br /&gt; public void setSpeech(char[] speech)&lt;br /&gt; {&lt;br /&gt;  set(BYE, speech);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public char[] speak()&lt;br /&gt; {&lt;br /&gt;  return get(BYE);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I've mixed in the PropertiesMixin for both of them, and then implemented the Speaker interface functions using properties. We could even have a default speech very easily, if needed.&lt;br /&gt;&lt;br /&gt;The composite classes are very simple as they do not contain any functionality whatsoever.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class HelloSpeaker : Speaker&lt;br /&gt;{&lt;br /&gt; mixin HelloMixin;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ByeSpeaker : Speaker&lt;br /&gt;{&lt;br /&gt; mixin ByeMixin;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I've put the setting of the speeches in the main function of the program, where the composites are created, to better demonstrate the usage of the Speaker interface.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public void main()&lt;br /&gt;{&lt;br /&gt; Speaker hello = new HelloSpeaker();&lt;br /&gt; hello.setSpeech("Hello, World!");&lt;br /&gt; Stdout(hello.speak()).newline;&lt;br /&gt; &lt;br /&gt; Speaker bye = new ByeSpeaker();&lt;br /&gt; bye.setSpeech("Bye, World!");&lt;br /&gt; Stdout(bye.speak()).newline;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'm pretty impressed about how easy it is to implement complex objects using mixins. Next I need to look into a more complicated version. Something like Fredrik Kalseth has done &lt;a href="http://iridescence.no/post/Composite-Oriented-Programming.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Until then you can find the new code &lt;a href="http://odefu.googlecode.com/svn/trunk/CompositeOrientedProgramming/HelloWorld2/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-405728911719186340?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/405728911719186340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/405728911719186340'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/12/composite-oriented-programming-part-2.html' title='Composite Oriented Programming Part 2'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-4570734765616932849</id><published>2008-12-15T11:12:00.002+02:00</published><updated>2008-12-15T11:39:41.772+02:00</updated><title type='text'>Composite Oriented Programming</title><content type='html'>Ok, so I found a new buzzword; Composite Oriented Programming. I first heard it from Thomas Biskup. He wrote about it on his JADE-blog, &lt;a href="http://www.adom.de/blog/2008/12/08/the-state-of-jade/"&gt;here&lt;/a&gt;. From there I started reading about COP on &lt;a href="http://www.qi4j.org"&gt;qi4j.org&lt;/a&gt;. I haven't completely understood it, but so far it seems to be quite nice buzzword.&lt;br /&gt;&lt;br /&gt;So I wrote a small hello world sample in D using templates. Got it working after a while with the help of downs and Bill Baxter, on #D and D.learn respectively.&lt;br /&gt;&lt;br /&gt;You can find the code &lt;a href="http://odefu.googlecode.com/svn/trunk/CompositeOrientedProgramming/HelloWorld/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'll go over it here now.&lt;br /&gt;&lt;br /&gt;First we have a template to hold out data, namely helloStr:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public template HelloData&lt;br /&gt;{&lt;br /&gt;    private char[] helloStr;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next we define the action or function for the whole composite. I don't remember what this is in COP-speak.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public interface HelloSpeech&lt;br /&gt;{&lt;br /&gt;    public char[] sayHello();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then we implement the above function in HelloSpeaker.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public template HelloSpeaker&lt;br /&gt;{&lt;br /&gt;    mixin HelloData;&lt;br /&gt;&lt;br /&gt;    public char[] sayHello()&lt;br /&gt;    {&lt;br /&gt;        return helloStr;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So we mixin the data template, so we can return the helloStr from sayHello. Notice that we don't need to import the actual interface for sayHello.&lt;br /&gt;&lt;br /&gt;Then we will create the actual composite.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class HelloWorld : HelloSpeech&lt;br /&gt;{&lt;br /&gt;    mixin HelloSpeaker;&lt;br /&gt;&lt;br /&gt;    public this()&lt;br /&gt;    {&lt;br /&gt;        helloStr = "Hello, World!";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now we have a concrete class that implements HelloSpeech. If you look at the code &lt;a href="http://odefu.googlecode.com/svn/trunk/CompositeOrientedProgramming/HelloWorld/hello/HelloWorld.d"&gt;here&lt;/a&gt;, you notice that we've had to import the HelloData module. This is as far as I can see the only downside so far.&lt;br /&gt;&lt;br /&gt;We have now nicely removed the implementation for sayHello to their own modules. This is a very small example, but I can see it to be quite useful with bigger systems and with more interfaces.&lt;br /&gt;&lt;br /&gt;Now just add an interface for setting the value for helloStr and creating an implementation for it, then this would be complete. The helloStr could be hidden completely behind a getter/setter-pair.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-4570734765616932849?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4570734765616932849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4570734765616932849'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/12/composite-oriented-programming.html' title='Composite Oriented Programming'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-4673638012592552479</id><published>2008-09-08T13:58:00.002+02:00</published><updated>2008-09-08T14:04:36.565+02:00</updated><title type='text'>Small Update</title><content type='html'>It seems that I won't have much free time in the future either, Ive decided to completely stop even thinking on doing any of the old NeHe tutorials anymore. Besides anyone can get a pretty good idea of how to do them from those that I've already done and do the ones they want. It's good practice that way too. =)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll probably do any new tutorials for the new basecode, if ever there will be any.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My next D project or journey will be to familiarize myself with &lt;a href="http://hybrid.team0xf.com/wiki/Main/HomePage"&gt;Hybrid&lt;/a&gt; and &lt;a href="http://hybrid.team0xf.com/wiki/Main/Dog"&gt;Dog&lt;/a&gt;. I've got a few ideas on what to do with them. But time will tell. I'll write anything worthwhile here.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-4673638012592552479?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4673638012592552479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4673638012592552479'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/09/small-update.html' title='Small Update'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-436408978311183923</id><published>2008-06-30T14:22:00.003+03:00</published><updated>2008-06-30T14:36:51.974+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NeHe'/><title type='text'>NeHe Update</title><content type='html'>There's been some activity on the NeHe site recently. They have launched a &lt;a href="http://nehe.gamedev.net/wiki/NeHeProductionsWiki.ashx"&gt;wiki&lt;/a&gt;, and are planning on moving the old stuff from the website to the wiki. There is also new versions of the new lessons on the wiki. For some reason they rewrote the &lt;a href="http://nehe.gamedev.net/wiki/NewLessons.ashx"&gt;basecode and the first three lessons&lt;/a&gt;.  The beta version wasn't that bad. On the plus side the code is much simpler, so they can extend the it later.&lt;br /&gt;&lt;br /&gt;I've ported the new lessons to D. Why else write this post. =) I didn't do it 1:1, as in my opinion there are too much c++(bad design) in them. I kept them mostly as they were, but fixed most of the more glaring problems in it, at least in my opinion.  I'm still thinking on making them more D'ish/generally better. I'll decide probably after more lessons are available, and we'll see where they are taking the basecode.&lt;br /&gt;&lt;br /&gt;You can find the relevant information about the source code on the &lt;a href="http://code.google.com/p/odefu/"&gt;google code project page&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-436408978311183923?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/436408978311183923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/436408978311183923'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/06/nehe-update.html' title='NeHe Update'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5455787465386468672</id><published>2008-04-04T09:06:00.002+02:00</published><updated>2008-04-04T09:17:08.533+02:00</updated><title type='text'>GLFW Derelictified</title><content type='html'>I started looking again at the &lt;a href="http://glfw.sourceforge.net/"&gt;GLFW&lt;/a&gt; library yesterday. I do really like the API. Somehow it's nicer than SDL's. The only thing missing is a better support for image loading.&lt;br /&gt;&lt;br /&gt;I remembered using a D binding for GLFW once and tried to find it. In the end I found it in the Schooner project in dsource, but it hasn't been updated in a long time. Plus it uses Phobos. I thought about trying to update and convert it to Tango for about a second or two, and then decided to do Derelict bindings for it instead. They are easier to maintain, but the downside is that you need to lug around the shared library for it.&lt;br /&gt;&lt;br /&gt;I used the latest release of GLFW (2.6), and only tested things with a simple test application on Windows XP.&lt;br /&gt;&lt;br /&gt;So if you like the framework go grab the D bindings from &lt;a href="http://code.google.com/p/odefu/source/browse/trunk/DerelictGLFW/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Windows users please read the &lt;a href="http://code.google.com/p/odefu/source/browse/trunk/DerelictGLFW/README.txt"&gt;readme&lt;/a&gt; file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5455787465386468672?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5455787465386468672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5455787465386468672'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/04/glfw-derelictified.html' title='GLFW Derelictified'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1940151402859926730</id><published>2008-03-20T21:44:00.002+02:00</published><updated>2008-03-20T21:54:43.032+02:00</updated><title type='text'>NeHe Lesson 25: Morphing &amp; Loading Objects From A File</title><content type='html'>Somehow I found time to do the next one too. This was pretty fun one as well. I love the morphing effect. And I like the simpleness of the code compared to the c/c++ version. :)&lt;br /&gt;&lt;br /&gt;I left out the Object struct as the D version didn't need the field for the number of vertices, and then there wasn't anything else left than the array itself. So now there are just arrays of Vertices.&lt;br /&gt;I also put a static opCall in the Vertex struct, although it isn't strictly necessary.&lt;br /&gt;&lt;br /&gt;And as with the lesson 10, the datais imported into the binary at compile time, so no file i/o is needed.&lt;br /&gt;&lt;br /&gt;You can check it out &lt;a href="http://code.google.com/p/odefu/source/browse/trunk/NeHe/lesson25/lesson25.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1940151402859926730?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1940151402859926730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1940151402859926730'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/03/nehe-lesson-25-morphing-loading-objects.html' title='NeHe Lesson 25: Morphing &amp; Loading Objects From A File'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2423766646212669948</id><published>2008-03-20T09:45:00.002+02:00</published><updated>2008-03-20T09:53:21.725+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 24: Tokens, Extensions, Scissor Testing And TGA Loading</title><content type='html'>A new lesson done. Yay! I should have called this one the Extensions and Scissor Testing lesson, because I left the TGA stuff out and the token thingy was replaced with a call to split. But I wanted to keep to the pattern with the lesson titles.&lt;br /&gt;&lt;br /&gt;I changed the code to initialize the texts only once and not every draw-call. Better that way. Otherwise there isn't that much new stuff. Then &lt;a href="http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml"&gt;glScissor&lt;/a&gt; call is pretty simple.&lt;br /&gt;&lt;br /&gt;See the code &lt;a href="http://code.google.com/p/odefu/source/browse/trunk/NeHe/lesson24/lesson24.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2423766646212669948?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2423766646212669948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2423766646212669948'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/03/nehe-lesson-24-tokens-extensions.html' title='NeHe Lesson 24: Tokens, Extensions, Scissor Testing And TGA Loading'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-6473014492351752289</id><published>2008-01-22T22:41:00.000+02:00</published><updated>2008-01-22T22:46:04.135+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tango'/><title type='text'>NeHe Lessons Updated</title><content type='html'>It's been a while. Life has been busy. Haven't had the time and energy for coding at home. Although I still follow the happenings in the D world. And because of that I've updated all the NeHe lessons to work with the latest version of Tango. I'll try to get more done during the coming spring, but can't promise anything as there are lots of things happening at the moment.&lt;br /&gt;&lt;br /&gt;Happy new year and all that. =)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-6473014492351752289?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6473014492351752289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6473014492351752289'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2008/01/nehe-lessons-updated.html' title='NeHe Lessons Updated'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-6826034247148936821</id><published>2007-10-08T09:17:00.000+02:00</published><updated>2007-10-08T12:29:36.839+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 23: Sphere Mapping Quadrics In OpenGL</title><content type='html'>The 23rd lesson is finished. Nothing special on the D-front in this one. Go read the the text &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=23"&gt;here&lt;/a&gt;.&lt;br /&gt;Then grab the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson23/lesson23.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-6826034247148936821?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6826034247148936821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6826034247148936821'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/10/nehe-lesson-23-sphere-mapping-quadrics.html' title='NeHe Lesson 23: Sphere Mapping Quadrics In OpenGL'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2723322035291962494</id><published>2007-10-03T13:06:00.000+02:00</published><updated>2007-10-03T13:15:44.473+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SDL'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 22: Bump-Mapping, Multi-Texturing &amp; Extensions</title><content type='html'>Oh, it's been a while from my last post. Been busy with the life outside of computers.&lt;br /&gt;&lt;br /&gt;The next lesson has been done for a quite a while now, except for a small bug. When displaying the cube with mip-mapped textures the texture is not drawn for some reason. Today I got the drawing working, but it introduced a another problem. The fix was to remove the texture flipping and rotating code from the initGL function. This has the effect of displaying the logos upside down and as mirror images, but now the mip-mapped cube is displayed correctly.&lt;br /&gt;&lt;br /&gt;If any of you has any idea how to fix this small problem, let me know so I can fix it. Otherwise I'll move on to the next lesson.&lt;br /&gt;&lt;br /&gt;The NeHe's lesson can be found &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=22"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Btw, I've kept the broken mip-map version in the repository as I think it's a smaller problem than upside down logos.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2723322035291962494?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2723322035291962494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2723322035291962494'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/10/nehe-lesson-22-bump-mapping-multi.html' title='NeHe Lesson 22: Bump-Mapping, Multi-Texturing &amp; Extensions'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2941091682960514431</id><published>2007-08-20T15:42:00.000+03:00</published><updated>2007-08-20T15:47:19.299+03:00</updated><title type='text'>NeHe tutorials ported to D news post</title><content type='html'>There is a news post of D in general and my NeHe lesson ports on &lt;a href="http://nehe.gamedev.net/"&gt;http://nehe.gamedev.net&lt;/a&gt;. =)&lt;br /&gt;&lt;br /&gt;Direct link: &lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=460765"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2941091682960514431?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2941091682960514431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2941091682960514431'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/08/nehe-tutorials-ported-to-d-news-post.html' title='NeHe tutorials ported to D news post'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1882351139144600222</id><published>2007-07-24T11:07:00.000+03:00</published><updated>2007-07-24T11:34:34.277+03:00</updated><title type='text'>NeHe Lesson 21: Lines, Antialiasing, Timing, Ortho View And Simple Sounds</title><content type='html'>It's time for a new &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=21"&gt;lesson&lt;/a&gt;. This time NeHe has made a simple game for us to enjoy.&lt;br /&gt;&lt;br /&gt;First before doing anything else make sure that you have &lt;a href="http://www.libsdl.org/projects/SDL_mixer/"&gt;SDL_Mixer&lt;/a&gt; installed on your system, as we're going to use it to play back the music and sound effects.&lt;br /&gt;&lt;br /&gt;Next is a small improvement I made over the C version, is the use of the enemies-array. The original lesson uses it as a static array, but I made it dynamic. This way we can use the D's great foreach-loop to go over every enemy in the level.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;/// Enemy Information&lt;br /&gt;GameObject[] enemies;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Resets the player character and all the enemies.&lt;br /&gt;*/&lt;br /&gt;void resetObjects()&lt;br /&gt;{&lt;br /&gt; player.x  = 0; // Reset Player X Position To Far Left Of The Screen&lt;br /&gt; player.y  = 0; // Reset Player Y Position To The Top Of The Screen&lt;br /&gt; player.fx = 0; // Set Fine X Position To Match&lt;br /&gt; player.fy = 0; // Set Fine Y Position To Match&lt;br /&gt;&lt;br /&gt; // Create the enemies for the next level/stage&lt;br /&gt; enemies = new GameObject[stage * level];&lt;br /&gt; // Loop Through All The Enemies&lt;br /&gt; foreach (inout enemy ; enemies)&lt;br /&gt; {&lt;br /&gt;  // A Random X Position&lt;br /&gt;  enemy.x  = 5 + rand.next() % 6;&lt;br /&gt;  // A Random Y Position&lt;br /&gt;  enemy.y  = rand.next() % 11;&lt;br /&gt;  // Set Fine X To Match&lt;br /&gt;  enemy.fx = enemy.x * 60;&lt;br /&gt;  // Set Fine Y To Match&lt;br /&gt;  enemy.fy = enemy.y * 40;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you can see there, we use the new operator to create just the number of enemies for the level/stage. Then we can loop over the array with foreach and be certain that we always have the correct number of enemies.&lt;br /&gt;&lt;br /&gt;In the module constructor the parameter to SDL_Init has changed to SDL_INIT_EVERYTHING.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;if (SDL_Init(SDL_INIT_EVERYTHING) &lt; 0)&lt;br /&gt;{&lt;br /&gt; throw new Exception("Failed to initialize SDL: " ~ getSDLError());&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This is needed for audio. There are other options, which you can read about &lt;a href="http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fInit"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The module destructor is responsible for freeing the textures and SDL_Mixer's buffers.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;static ~this()&lt;br /&gt;{&lt;br /&gt; // Clean up our font list&lt;br /&gt; glDeleteLists(base, 256);&lt;br /&gt;&lt;br /&gt; // Clean up our textures&lt;br /&gt; glDeleteTextures(NUM_TEXTURES, &amp;textures[0]);&lt;br /&gt;&lt;br /&gt; // Stop playing the music&lt;br /&gt; Mix_HaltMusic();&lt;br /&gt;&lt;br /&gt; // Free up the memory for the music&lt;br /&gt; Mix_FreeMusic(music);&lt;br /&gt;&lt;br /&gt; // Free up any memory for the sfx&lt;br /&gt; Mix_FreeChunk(chunk);&lt;br /&gt;&lt;br /&gt; // Close our audio device&lt;br /&gt; Mix_CloseAudio();&lt;br /&gt;&lt;br /&gt; SDL_Quit();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;That's about it. Everything else is hopefully easy enough to understand, so just &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson21/lesson21.d"&gt;dig in&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1882351139144600222?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1882351139144600222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1882351139144600222'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/07/nehe-lesson-21-lines-antialiasing.html' title='NeHe Lesson 21: Lines, Antialiasing, Timing, Ortho View And Simple Sounds'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5925794420835498208</id><published>2007-07-04T14:37:00.000+03:00</published><updated>2007-07-04T14:42:11.984+03:00</updated><title type='text'>NeHe Lesson 20: Masking</title><content type='html'>Puuh! Full 20 lessons now. =) Almost half of them. With luck I'll get them all by the end of the year. ;)&lt;br /&gt;&lt;br /&gt;This lesson doesn't bring anything special on the D-table, but the lesson itself is interesting, so go read &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20"&gt;it&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I separated the texture loading into two functions, because there is 5 different textures which need to be loaded.&lt;br /&gt;&lt;br /&gt;The source can be found &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson20/lesson20.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5925794420835498208?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5925794420835498208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5925794420835498208'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/07/nehe-lesson-20-masking.html' title='NeHe Lesson 20: Masking'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5407064467463171381</id><published>2007-06-26T16:45:00.000+03:00</published><updated>2007-06-26T17:00:22.700+03:00</updated><title type='text'>NeHE Lesson 19: Particle Engine Using Triangle Strips</title><content type='html'>I've been sitting on this one far too long. It's a nice tutorial on particles and NeHe has written a long explanation for it &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19"&gt;here&lt;/a&gt;. There shouldn't be anything new on the D front that warrants an explanation. If you disagree then leave me a note and I'll go over it.&lt;br /&gt;&lt;br /&gt;The source can be found &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson19/lesson19.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5407064467463171381?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5407064467463171381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5407064467463171381'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/06/nehe-lesson-19-particle-engine-using.html' title='NeHE Lesson 19: Particle Engine Using Triangle Strips'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1521188481932131752</id><published>2007-06-21T09:49:00.000+03:00</published><updated>2007-06-21T09:53:48.111+03:00</updated><title type='text'>The OpenGL Pipeline Newsletter Volume 004</title><content type='html'>The newest edition of the Pipeline has been &lt;a href="http://www.opengl.org/pipeline/vol004/"&gt;released&lt;/a&gt;. I've been reading it and there was a small paragraph which contains information about the recent debug stuff that has been going on in the D-OpenGL-land.&lt;br /&gt;&lt;br /&gt;Here's the part:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;blockquote&gt;&lt;b&gt;More context creation options are available.&lt;/b&gt;  In the previous edition of &lt;a href="http://www.opengl.org/pipeline/article/vol003_1/"&gt;OpenGL Pipeline&lt;/a&gt; I described how we are planning on handling interoperability of OpenGL 2.1 and Longs Peak code. As a result, the application needs to explicitly create an OpenGL Longs Peak or OpenGL 2.x context. To aid debugging, it is also possible to request the GL to create a debug context. A debug context is only intended for use during application development. It provides additional validation, logging and error checking, but possibly at the cost of performance.&lt;/blockquote&gt;&lt;br /&gt;At last OpenGL itself will assist the poor programmer in debuggin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1521188481932131752?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1521188481932131752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1521188481932131752'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/06/opengl-pipeline-newsletter-volume-004.html' title='The OpenGL Pipeline Newsletter Volume 004'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-7139554804180675864</id><published>2007-06-15T16:48:00.000+03:00</published><updated>2007-11-28T09:15:07.539+02:00</updated><title type='text'>DebugGL</title><content type='html'>After reading Daniel's excellent post &lt;a href="http://while-nan.blogspot.com/2007/06/wrapping-functions-for-fun-and-profit.html"&gt;here&lt;/a&gt;, which by the way was something I've been thinking about a little. Although not to the extend that Daniel has. But he got me working on the foundation he made in the post, and the first results can be seen &lt;a href="http://odefu.googlecode.com/svn/trunk/OpenGLUtils/DebugGL.d"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And thanks to h3r3tic and larsivi on #D.Tango. Without you I couldn't have done this. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-7139554804180675864?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7139554804180675864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7139554804180675864'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/06/debuggl.html' title='DebugGL'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-376122681473647625</id><published>2007-05-16T16:12:00.000+03:00</published><updated>2007-05-16T16:15:24.292+03:00</updated><title type='text'>New Page</title><content type='html'>I've finally made use of the OdeFu projects &lt;a href="http://code.google.com/p/odefu/"&gt;main page&lt;/a&gt;. There is now a table of the NeHe lessons that have been done, with links to their respective sources. I've also added a link to the page to my bookmarks on the right side.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-376122681473647625?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/376122681473647625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/376122681473647625'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/new-page.html' title='New Page'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2747286115745992140</id><published>2007-05-16T12:19:00.000+03:00</published><updated>2007-05-16T12:22:01.827+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHE Lesson 18: Quadrics</title><content type='html'>The 18th lesson gives a tour of some of the GLU functions and how to display different shapes with them. The shortish text can be read &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=18"&gt;here&lt;/a&gt;. There shouldn't be anything special.&lt;br /&gt;&lt;br /&gt;The D code is &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson18/lesson18.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2747286115745992140?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2747286115745992140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2747286115745992140'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/nehe-lesson-18-quadrics.html' title='NeHE Lesson 18: Quadrics'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-378166268177288746</id><published>2007-05-15T10:00:00.000+03:00</published><updated>2007-05-15T10:07:50.410+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 17: 2D Texture Font</title><content type='html'>This lesson should contain code for those who are interested in drawing text in an OpenGL window. After reading &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17"&gt;the tutorial&lt;/a&gt; text and getting the hang of it, you might want to implement support for &lt;a href="http://www.angelcode.com/products/bmfont/"&gt;AngelCode's&lt;/a&gt; Bitmap Font Generator. It's a nifty tool for making bitmap fonts for your games.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson17/lesson17.d"&gt;Here's&lt;/a&gt; the D code for the lesson.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-378166268177288746?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/378166268177288746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/378166268177288746'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/nehe-lesson-17-2d-texture-font.html' title='NeHe Lesson 17: 2D Texture Font'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1210062010009149963</id><published>2007-05-14T20:33:00.000+03:00</published><updated>2007-05-14T20:39:01.916+03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 16: Cool Looking Fog</title><content type='html'>This lesson doesn't bring that much new to the table. The fog functions should be pretty self-explanatory, but read what &lt;span class="text"&gt;&lt;span nd="2" class="text"&gt;Chris Aliotta has to say about it &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=16"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The D version is &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson16/lesson16.d"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1210062010009149963?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1210062010009149963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1210062010009149963'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/nehe-lesson-16-cool-looking-fog.html' title='NeHe Lesson 16: Cool Looking Fog'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-8854195295520867200</id><published>2007-05-14T18:46:00.000+03:00</published><updated>2007-05-14T20:33:30.481+03:00</updated><title type='text'>About Lessons 13, 14 and 15</title><content type='html'>I've decided that I'm not going to cover the next 3 lessons(13, 14 and 15). They contain platform specific code, and I'm not into that kind of stuff. The lesson 17 contains a way to show text in a platform independent way for those that want to see text in an OpenGL application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-8854195295520867200?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8854195295520867200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8854195295520867200'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/about-lessons-13-14-and-15.html' title='About Lessons 13, 14 and 15'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2519414355470065963</id><published>2007-05-12T14:10:00.000+03:00</published><updated>2007-05-12T14:19:08.420+03:00</updated><title type='text'>The New NeHe Tutorials</title><content type='html'>Some of you are probably aware that a beta version of the new NeHe tutorials have been &lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=437842"&gt;released&lt;/a&gt; earlier this year. There is a window backend for all the lessons which contains window creation and a simple framework for running the lesson applications. Then they have written 5 lessons already.&lt;br /&gt;&lt;br /&gt;I've been writing them in D for some time now. When ever I've had time. They are now done and working nicely. I'm not going to go over them yet, as the real tutorials haven't been released yet, but you can browse the sources &lt;a href="http://odefu.googlecode.com/svn/trunk/NewNeHe/"&gt;here&lt;/a&gt;, or if you want to try them out just checkout them. I've written DSSS configuration files for them, so you can just do 'dsss install', for NeHeWindow, and then 'dsss build' for the lessons.&lt;br /&gt;&lt;br /&gt;And now back to your regular old NeHe tutorial studying.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2519414355470065963?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2519414355470065963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2519414355470065963'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/05/new-nehe-tutorials.html' title='The New NeHe Tutorials'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-446772969997819945</id><published>2007-04-18T14:06:00.000+02:00</published><updated>2007-04-18T14:16:05.128+02:00</updated><title type='text'>The New NeHe Lessons</title><content type='html'>I just noticed that a beta release is available for the new NeHe lessons. You can see the release notes &lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=437836"&gt;here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I took a look at the code, and apart from the horrible naming convetion and the fact that they still use C++, it looks pretty good. So I've decided to do a port of them to D, but there is a catch:&lt;br /&gt;&lt;br /&gt;   * I'll only port the SDL backend&lt;br /&gt;    * I'll "fix" the naming convertion to something more to my tastes&lt;br /&gt;   * I don't know when I have the time to do this&lt;br /&gt;&lt;br /&gt;Probably the best place to start is from the window backend so that I can get something useful done as fast as possible.&lt;br /&gt;&lt;br /&gt;Stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-446772969997819945?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/446772969997819945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/446772969997819945'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/04/new-nehe-lessons.html' title='The New NeHe Lessons'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5721605682990882821</id><published>2007-04-18T08:24:00.000+02:00</published><updated>2007-04-18T08:47:29.459+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='SDL'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 12: Display Lists</title><content type='html'>Ok, didn't get to test this on Windows, but it should work as the lesson doesn't contain platform specific code.&lt;br /&gt;&lt;br /&gt;First off there's an example on how to initialize a static multi-dimensional array:&lt;br /&gt;(In case you didn't know already how to do it.)&lt;br /&gt;&lt;pre&gt;/// Array For Box Colors&lt;br /&gt;GLfloat boxcol[5][3] =&lt;br /&gt;[&lt;br /&gt;   // Bright:  Red, Orange, Yellow, Green, Blue&lt;br /&gt;   [1.0f, 0.0f, 0.0f], [1.0f, 0.5f, 0.0f], [1.0f, 1.0f, 0.0f], [0.0f, 1.0f, 0.0f], [0.0f, 1.0f, 1.0f]&lt;br /&gt;];&lt;/pre&gt;&lt;br /&gt;In the module constructor we have something new.&lt;br /&gt;&lt;pre&gt;// Enable key repeating&lt;br /&gt;if ((SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)))&lt;br /&gt;{&lt;br /&gt;   throw new Exception("Failed to set key repeat: " ~ getSDLError());&lt;br /&gt;}&lt;/pre&gt;Here we enable SDL to repeat key presses if you keep a key down. I've used SDL's default values for the arguments.&lt;br /&gt;&lt;br /&gt;There isn't really anything special about the rest of the code, so grab a cola and go read what NeHe has written on the subject, &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=12"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here's the link to &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson12/lesson12.d"&gt;the source&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5721605682990882821?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5721605682990882821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5721605682990882821'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/04/nehe-lesson-12-display-lists.html' title='NeHe Lesson 12: Display Lists'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1819895125889785933</id><published>2007-04-17T12:58:00.000+02:00</published><updated>2007-04-17T13:02:59.489+02:00</updated><title type='text'>Linux Update</title><content type='html'>I wanted to leave a quite note on the Linux support. I tested all the current lessons on a Linux box with the following setup: Tango RC1 with DMD 1.012 and Rebuild 0.18. All of the worked fine. Found only couple typos in image filenames. Wrong case.&lt;br /&gt;&lt;br /&gt;Plus I've pretty much done lesson 12 and I'll put it up as soon as I get home.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1819895125889785933?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1819895125889785933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1819895125889785933'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/04/linux-update.html' title='Linux Update'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-7117074178038949409</id><published>2007-03-22T10:06:00.000+02:00</published><updated>2007-03-22T10:10:24.444+02:00</updated><title type='text'>Small Update</title><content type='html'>I've gone through all the existing lessons and updated them to Tango beta2 and DMD 1.009. They work at least on my Windows box, but I'm having some troubles with my Linux laptop. I'll give an update when and if I get them to work on Linux too.&lt;br /&gt;&lt;br /&gt;I also changed the links in the first five lessons to point to the source code directly and not zip files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-7117074178038949409?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7117074178038949409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7117074178038949409'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/03/small-update.html' title='Small Update'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2891641022470651309</id><published>2007-03-14T22:42:00.000+02:00</published><updated>2007-03-14T22:47:05.523+02:00</updated><title type='text'>Status Update</title><content type='html'>Sorry for not posting anything for a while. I've just started this Monday in a new job at &lt;a href="http://www.digitalchocolate.com/"&gt;Digital Chocolate&lt;/a&gt;! At last got into a game company. =) My new job title is Tools Programmer, which suits me just fine. It's been great and I look forward to many interesting days ahead.&lt;br /&gt;&lt;br /&gt;I also have other stuff going on, so it will probably be a while before I get the next lesson done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2891641022470651309?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2891641022470651309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2891641022470651309'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/03/status-upfate.html' title='Status Update'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-6427774675387697014</id><published>2007-03-06T11:08:00.000+02:00</published><updated>2007-03-06T11:15:22.466+02:00</updated><title type='text'>NeHe Lesson 11: Flag Effect (Waving Texture)</title><content type='html'>Got the next one ready at last. This one shows you how to do a flag effect. The only hard part should be the math for calculating the wave. Go read Bosco's explanation &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=11"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'll add the only new D bit in the code. I've used a nice way to initialize a dynamic multi-dimensional array.&lt;br /&gt;&lt;br /&gt;First we have at the top of the module the declaration:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;GLfloat[][][] points;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then in initGL we initialize the array, like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;points = new GLfloat[][][](45, 45, 3);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then we just loop through the indices and assign values to them.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson11/lesson11.d"&gt;Here's&lt;/a&gt; the whole code, and &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/data/Tim.bmp"&gt;here's&lt;/a&gt; the flag texture.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-6427774675387697014?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6427774675387697014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6427774675387697014'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/03/nehe-lesson-11-flag-effect-waving.html' title='NeHe Lesson 11: Flag Effect (Waving Texture)'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-6209850776166714935</id><published>2007-03-01T10:15:00.000+02:00</published><updated>2007-03-01T10:37:36.046+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 10: Loading And Moving Through A 3D World</title><content type='html'>The 10th lesson is finally converted and polished. This lesson shows you how to load world data from a text file and then how to display it. And actually it's pretty simple code. The original lesson can be read &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=10"&gt;here&lt;/a&gt;. I'll go over couple things here that are more specific to D and Tango.&lt;br /&gt;&lt;br /&gt;First I've imported the world data at compile time into the final executable. This is a cool feature and I think very useful for static data like this. You can of course use it to import texture data or something totally different.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;setupWorld(import("world.txt"));&lt;br /&gt;&lt;/pre&gt;You need at least the version 1.005 of DMD for this to work. I have no idea if GDC even supports this yet. With 1.005 you need to add the relative path to the world.txt to the string above. With 1.006 and later you don't need to change the code, but you must use the -J switch to define the search path for the compiler where it can find the file.&lt;br /&gt;&lt;br /&gt;The setupWorld function is pretty simple. With the use of Tango's LineIterator, reading through the world data is a breeze.&lt;br /&gt;&lt;br /&gt;Now go play with it, &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson10/lesson10.d"&gt;lesson10.d&lt;/a&gt; and &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/data/world.txt"&gt;world.txt&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-6209850776166714935?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6209850776166714935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/6209850776166714935'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/03/nehe-lesson-10-loading-and-moving.html' title='NeHe Lesson 10: Loading And Moving Through A 3D World'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-8456186469050783228</id><published>2007-02-27T11:54:00.000+02:00</published><updated>2007-02-27T11:59:29.585+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>The OpenGL SDK</title><content type='html'>The OpenGL SDK has been released recently. It's not the usual thing when you think of SDKs. This time there are tutorials, libraries and links to different tools, but the most interesting feature is the inclusion of the whole reference to OpenGL version 2.1. No need to flip through the reference manual! =)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.opengl.org/pipeline/article/vol003_3/"&gt;A First Glimpse at the OpenGL SDK&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.opengl.org/sdk/"&gt;The OpenGL SDK&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-8456186469050783228?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8456186469050783228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8456186469050783228'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/opengl-sdk.html' title='The OpenGL SDK'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2818412010144963272</id><published>2007-02-26T14:05:00.000+02:00</published><updated>2007-02-26T14:22:40.988+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 09: Moving Bitmaps In 3D Space</title><content type='html'>The 9th lesson covers more ground on moving things around and applying color to black and white textures. The lesson can be read &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=09"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This is the first time in these tutorials where we see a nice little example on how to use the D's foreach loop. It is used to initialize all the stars in the array. It is very clean looking and easy to follow. The only thing to remember in a situation like this, is to use the 'inout' modifier on the star variable so that the changes stick.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foreach (i, inout star ; stars)&lt;br /&gt;{&lt;br /&gt;    star.angle = 0.0f;&lt;br /&gt;    star.dist = cast(float)i / stars.length * 5.0f;&lt;br /&gt;    star.r = rand.next() % 256;&lt;br /&gt;    star.g = rand.next() % 256;&lt;br /&gt;    star.b = rand.next() % 256;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The foreach loop is used in the drawing function also. There too the 'inout' modifier must be used because we update the values in the star at the end.&lt;br /&gt;&lt;br /&gt;The rest of the code can be read &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson09/lesson09.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2818412010144963272?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2818412010144963272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2818412010144963272'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/nehe-lesson-09-moving-bitmaps-in-3d.html' title='NeHe Lesson 09: Moving Bitmaps In 3D Space'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5004828891331934183</id><published>2007-02-26T12:53:00.000+02:00</published><updated>2007-02-26T14:22:15.615+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 08: Blending</title><content type='html'>The &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08"&gt;next lesson&lt;/a&gt; shows us how to do blending in OpenGL. It's a very cool feature even if your just doing a glass cube. :) There isn't any differences to the original work concerning OpenGL so I'll just give you couple things you could try to change in the code. Homework so to speak.&lt;br /&gt;&lt;br /&gt;1. Change the drawing code to only apply the blending to the front and back faces of the cube.&lt;br /&gt;2. Change the texture used in the other faces.&lt;br /&gt;&lt;br /&gt;Link to the code is &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson08/lesson08.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5004828891331934183?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5004828891331934183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5004828891331934183'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/nehe-lesson-08-blending.html' title='NeHe Lesson 08: Blending'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1227052429178418380</id><published>2007-02-23T12:54:00.000+02:00</published><updated>2007-02-26T14:23:05.874+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 07: Texture Filters, Lighting &amp; Keyboard Control</title><content type='html'>The 7th lesson adds some lights and 2 more ways to make textures.  Keyboard input is added to move and rotate the box. There shouldn't be anything too difficult about the lesson. Check out the new parameters to glTexParameteri and how the lights are defined. The original lesson can be read &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The D version is &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson07/lesson07.d"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;All the images and other data used in these lessons can be found &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/data/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1227052429178418380?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1227052429178418380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1227052429178418380'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/nehe-lesson-07-texture-filters-lighting.html' title='NeHe Lesson 07: Texture Filters, Lighting &amp; Keyboard Control'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-4935437471144736653</id><published>2007-02-23T10:38:00.000+02:00</published><updated>2007-02-23T10:51:43.929+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Derelict'/><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='SDL'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 06: Texture Mapping</title><content type='html'>So, it's been a while. I've been very busy with other stuff lately, but I haven't forgotten this blog.&lt;br /&gt;&lt;br /&gt;The next lesson is about texture mapping. Go read it &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06"&gt;here&lt;/a&gt;. There's couple things I'd like to mention about SDL and OpenGL concerning this tutorial.&lt;br /&gt;&lt;br /&gt;First of SDL has its own image loading functions, mainly SDL_LoadBMP, which loads BMP images. In a bigger project you might want to look at &lt;a href="http://jcatki.no-ip.org/SDL_image/"&gt;SDL_image&lt;/a&gt; for other image types.&lt;br /&gt;&lt;br /&gt;The other thing is that you will need to flip and rotate your textures when using SDL. The following lines of code will setup OpenGL to do that for you.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;glMatrixMode(GL_TEXTURE);&lt;br /&gt;glRotatef(180.0f, 0.0f, 0.0f, 1.0f);&lt;br /&gt;glScalef(-1.0f, 1.0f, 1.0f);&lt;br /&gt;glMatrixMode(GL_MODELVIEW);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The full code listing can be found &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson06/lesson06.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-4935437471144736653?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4935437471144736653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/4935437471144736653'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/nehe-lesson-06-texture-mapping.html' title='NeHe Lesson 06: Texture Mapping'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1955434196830300964</id><published>2007-02-19T11:08:00.000+02:00</published><updated>2007-02-19T11:13:09.106+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tango'/><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><title type='text'>Update: Lessons 1-5 use Tango now</title><content type='html'>I've updated the lessons 1-5 to use the Tango runtime. Only the to and from char* functions needed to be changed.&lt;br /&gt;&lt;br /&gt;So from now on I'll publish code only compatible with &lt;a href="http://www.dsource.org/projects/tango/wiki"&gt;Tango&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1955434196830300964?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1955434196830300964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1955434196830300964'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/update-lessons-1-5-use-tango-now.html' title='Update: Lessons 1-5 use Tango now'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-1238753324845069441</id><published>2007-02-02T09:32:00.000+02:00</published><updated>2007-02-02T09:41:11.895+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tango'/><category scheme='http://www.blogger.com/atom/ns#' term='Derelict'/><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><title type='text'>Let's dance to the Tango 0.95 beta 1</title><content type='html'>So &lt;a href="http://www.dsource.org/projects/tango/wiki"&gt;Tango's&lt;/a&gt; first beta has been released. So the first thing I did, was to go and &lt;a href="http://dsource.org/forums/viewtopic.php?t=2361"&gt;ask&lt;/a&gt; when and if Derelict will support it. "&lt;a href="http://dblog.aldacron.net/2007/02/01/tango-095-beta-1/"&gt;In the very near future.&lt;/a&gt;"&lt;br /&gt;&lt;br /&gt;I will be using Tango exclusively from now on because as far as I'm concerned it's far better than Phobos. That might be my Java background talking too.&lt;br /&gt;&lt;br /&gt;I'll start of by converting the existing lessons to Tango. That shouldn't take too long, as they don't have many dependencies to Phobos. But first I have to wait for Mr. Parker to add the support to Derelict.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-1238753324845069441?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1238753324845069441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/1238753324845069441'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/02/lets-dance-to-tango-095-beta-1.html' title='Let&apos;s dance to the Tango 0.95 beta 1'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-9082002524721943058</id><published>2007-01-30T12:34:00.000+02:00</published><updated>2007-03-22T10:06:13.316+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 05: 3D Shapes</title><content type='html'>The last lesson of the very basics is here. This lesson doesn't bring anything new to the table, but shows you how to combine triangles and quads into pyramids and cubes.&lt;br /&gt;Go read the lesson &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=05"&gt;here&lt;/a&gt; first.&lt;br /&gt;&lt;br /&gt;I'll put the changed drawing code here for your enjoyment.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/**&lt;br /&gt;* The drawing function. Here we will draw the pyramid and cube.&lt;br /&gt;*/&lt;br /&gt;void drawGLScene()&lt;br /&gt;{&lt;br /&gt;  // Clear The Screen And The Depth Buffer&lt;br /&gt;  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;  // Reset The Current Modelview Matrix&lt;br /&gt;  glLoadIdentity();&lt;br /&gt;&lt;br /&gt;  // Move Left 1.5 Units And Into The Screen 6.0&lt;br /&gt;  glTranslatef(-1.5f, 0.0f, -6.0f);&lt;br /&gt;&lt;br /&gt;  // Rotate The Triangle On The Y axis&lt;br /&gt;  glRotatef(rtri, 0.0f, 1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;  // Start Drawing The Pyramid&lt;br /&gt;  glBegin(GL_TRIANGLES);&lt;br /&gt;      glColor3f(1.0f,0.0f,0.0f);  // Red&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);  // Top Of Triangle (Front)&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);  // Green&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 1.0f);  // Left Of Triangle (Front)&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);  // Blue&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 1.0f);  // Right Of Triangle (Front)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);  // Red&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);  // Top Of Triangle (Right)&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);  // Blue&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 1.0f);  // Left Of Triangle (Right)&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);  // Green&lt;br /&gt;      glVertex3f(1.0f, -1.0f, -1.0f);  // Right Of Triangle (Right)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);  // Red&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);  // Top Of Triangle (Back)&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);  // Green&lt;br /&gt;      glVertex3f(1.0f, -1.0f, -1.0f);  // Left Of Triangle (Back)&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);  // Blue&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, -1.0f); // Right Of Triangle (Back)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);  // Red&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);  // Top Of Triangle (Left)&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);  // Blue&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, -1.0f); // Left Of Triangle (Left)&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);  // Green&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 1.0f);  // Right Of Triangle (Left)&lt;br /&gt;  // Done Drawing The Pyramid&lt;br /&gt;  glEnd();&lt;br /&gt;&lt;br /&gt;  // Reset The Current Modelview Matrix&lt;br /&gt;  glLoadIdentity();&lt;br /&gt;&lt;br /&gt;  // Move Right And Into The Screen&lt;br /&gt;  glTranslatef(1.5f, 0.0f, -7.0f);&lt;br /&gt;&lt;br /&gt;  // Rotate The Cube On X, Y &amp; Z&lt;br /&gt;  glRotatef(rquad, 1.0f, 1.0f, 1.0f);&lt;br /&gt;&lt;br /&gt;  // Set The Color To Blue One Time Only&lt;br /&gt;  glColor3f(0.5f, 0.5f, 1.0f);&lt;br /&gt;&lt;br /&gt;  // Start Drawing The Cube&lt;br /&gt;  glBegin(GL_QUADS);&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);  // Set The Color To Green&lt;br /&gt;      glVertex3f(1.0f, 1.0f, -1.0f);  // Top Right Of The Quad (Top)&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, -1.0f);  // Top Left Of The Quad (Top)&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, 1.0f);  // Bottom Left Of The Quad (Top)&lt;br /&gt;      glVertex3f(1.0f, 1.0f, 1.0f);  // Bottom Right Of The Quad (Top)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.5f, 0.0f);  // Set The Color To Orange&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 1.0f);  // Top Right Of The Quad (Bottom)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 1.0f);  // Top Left Of The Quad (Bottom)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Quad (Bottom)&lt;br /&gt;      glVertex3f(1.0f, -1.0f, -1.0f);  // Bottom Right Of The Quad (Bottom)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);  // Set The Color To Red&lt;br /&gt;      glVertex3f(1.0f, 1.0f, 1.0f);  // Top Right Of The Quad (Front)&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, 1.0f);  // Top Left Of The Quad (Front)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 1.0f);  // Bottom Left Of The Quad (Front)&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 1.0f);  // Bottom Right Of The Quad (Front)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 1.0f, 0.0f);  // Set The Color To Yellow&lt;br /&gt;      glVertex3f(1.0f, -1.0f, -1.0f);  // Bottom Left Of The Quad (Back)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Quad (Back)&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, -1.0f);  // Top Right Of The Quad (Back)&lt;br /&gt;      glVertex3f(1.0f, 1.0f, -1.0f);  // Top Left Of The Quad (Back)&lt;br /&gt;&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);  // Set The Color To Blue&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, 1.0f);  // Top Right Of The Quad (Left)&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, -1.0f);  // Top Left Of The Quad (Left)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Quad (Left)&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 1.0f);  // Bottom Right Of The Quad (Left)&lt;br /&gt;&lt;br /&gt;      glColor3f(1.0f, 0.0f, 1.0f);  // Set The Color To Violet&lt;br /&gt;      glVertex3f(1.0f, 1.0f, -1.0f);  // Top Right Of The Quad (Right)&lt;br /&gt;      glVertex3f(1.0f, 1.0f, 1.0f);  // Top Left Of The Quad (Right)&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 1.0f);  // Bottom Left Of The Quad (Right)&lt;br /&gt;      glVertex3f(1.0f, -1.0f, -1.0f);  // Bottom Right Of The Quad (Right)&lt;br /&gt;  // Done Drawing The Cube&lt;br /&gt;  glEnd();&lt;br /&gt;&lt;br /&gt;  // Increase The Rotation Variable For The Triangle&lt;br /&gt;  rtri += 0.2f;&lt;br /&gt;  // Decrease The Rotation Variable For The Quad&lt;br /&gt;  rquad -= 0.15f;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can download the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson05/lesson05.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-9082002524721943058?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/9082002524721943058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/9082002524721943058'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/nehe-lesson-05-3d-shapes.html' title='NeHe Lesson 05: 3D Shapes'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-631773454679297994</id><published>2007-01-26T14:04:00.000+02:00</published><updated>2007-03-22T10:05:33.582+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 04: Rotation</title><content type='html'>The fourth NeHe lesson is about using the glRotate*() functions. Go read what he has to say about them &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=04"&gt;here&lt;/a&gt;. The lesson builds on the previous one. I'll show the parts the have changed here.&lt;br /&gt;&lt;br /&gt;First of we need to declare two need variables for the rotation.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/// Angle For The Triangle&lt;br /&gt;GLfloat rtri = 0.0f;&lt;br /&gt;/// Angle For The Quad&lt;br /&gt;GLfloat rquad = 0.0f;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here you must be careful with how D initializes floating point variables. For example if we had declared them like this: (Like the C-version)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/// Angle For The Triangle&lt;br /&gt;GLfloat rtri;&lt;br /&gt;/// Angle For The Quad&lt;br /&gt;GLfloat rquad;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Then the variables would have been initialized to NaN and the triangle and the quad would not have shown on the screen at all. I've fallen for this many times, especially with these tutorials.&lt;br /&gt;&lt;br /&gt;The drawGLScene function is the same except the calls to glRotatef and the glLoadIdentity in the middle. Try to leave it out and see what happens.&lt;br /&gt;&lt;br /&gt;Having the variables rtri and rquad initialized to 0.0f wont do us much good if we don't change them, so there is at the end we change them slightly to archive the moving rotation effect.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/**&lt;br /&gt;* The drawing function. Here we will draw the triangle and the quad.&lt;br /&gt;* Now with color and rotation.&lt;br /&gt;*/&lt;br /&gt;void drawGLScene()&lt;br /&gt;{&lt;br /&gt;  // Clear The Screen And The Depth Buffer&lt;br /&gt;  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;  // Reset The Current Modelview Matrix&lt;br /&gt;  glLoadIdentity();&lt;br /&gt;&lt;br /&gt;  // Move Left 1.5 Units And Into The Screen 6.0&lt;br /&gt;  glTranslatef(-1.5f, 0.0f, -6.0f);&lt;br /&gt;&lt;br /&gt;  // Rotate The Triangle On The Y axis&lt;br /&gt;  glRotatef(rtri, 0.0f, 1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;  // Drawing Using Triangles&lt;br /&gt;  glBegin(GL_TRIANGLES);&lt;br /&gt;      // Set The Color To Red&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);&lt;br /&gt;      // Top&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;      // Set The Color To Green&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);&lt;br /&gt;      // Bottom Left&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;      // Set The Color To Blue&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);&lt;br /&gt;      // Bottom Right&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 0.0f);&lt;br /&gt;  // Finished Drawing The Triangle&lt;br /&gt;  glEnd();&lt;br /&gt;&lt;br /&gt;  // Reset The Current Modelview Matrix&lt;br /&gt;  glLoadIdentity();&lt;br /&gt;&lt;br /&gt;  // Move Right 1.5 Units And Into The Screen 6.0&lt;br /&gt;  glTranslatef(1.5f, 0.0f, -6.0f);&lt;br /&gt;&lt;br /&gt;  // Rotate The Quad On The X axis&lt;br /&gt;  glRotatef(rquad, 1.0f, 0.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;  // Set The Color To Blue One Time Only&lt;br /&gt;  glColor3f(0.5f, 0.5f, 1.0f);&lt;br /&gt;&lt;br /&gt;  // Draw A Quad&lt;br /&gt;  glBegin(GL_QUADS);&lt;br /&gt;      // Top Left&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, 0.0f);&lt;br /&gt;      // Top Right&lt;br /&gt;      glVertex3f(1.0f, 1.0f, 0.0f);&lt;br /&gt;      // Bottom Right&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 0.0f);&lt;br /&gt;      // Bottom Left&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 0.0f);&lt;br /&gt;  // Done Drawing The Quad&lt;br /&gt;  glEnd();&lt;br /&gt;&lt;br /&gt;  // Increase The Rotation Variable For The Triangle&lt;br /&gt;  rtri += 0.2f;&lt;br /&gt;  // Decrease The Rotation Variable For The Quad&lt;br /&gt;  rquad -= 0.15f;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can download the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson04/lesson04.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-631773454679297994?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/631773454679297994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/631773454679297994'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/nehe-lesson-04-rotation.html' title='NeHe Lesson 04: Rotation'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-7415216602643411004</id><published>2007-01-26T12:38:00.000+02:00</published><updated>2007-03-22T10:05:05.748+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 03: Adding Color</title><content type='html'>This lesson adds some color to the dark realm of OpenGL magic. Go read what the Master has to say about &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=03"&gt;color incantations&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'll show you the whole spell here for your convenience. This lesson adds directly to the previous one.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/**&lt;br /&gt;* The drawing function. Here we will draw the triangle and the quad.&lt;br /&gt;* Now with color.&lt;br /&gt;*/&lt;br /&gt;void drawGLScene()&lt;br /&gt;{&lt;br /&gt;  // Clear The Screen And The Depth Buffer&lt;br /&gt;  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;  // Reset The Current Modelview Matrix&lt;br /&gt;  glLoadIdentity();&lt;br /&gt;&lt;br /&gt;  // Move Left 1.5 Units And Into The Screen 6.0&lt;br /&gt;  glTranslatef(-1.5f, 0.0f, -6.0f);&lt;br /&gt;&lt;br /&gt;  // Drawing Using Triangles&lt;br /&gt;  glBegin(GL_TRIANGLES);&lt;br /&gt;      // Set The Color To Red&lt;br /&gt;      glColor3f(1.0f, 0.0f, 0.0f);&lt;br /&gt;      // Top&lt;br /&gt;      glVertex3f(0.0f, 1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;      // Set The Color To Green&lt;br /&gt;      glColor3f(0.0f, 1.0f, 0.0f);&lt;br /&gt;      // Bottom Left&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;      // Set The Color To Blue&lt;br /&gt;      glColor3f(0.0f, 0.0f, 1.0f);&lt;br /&gt;      // Bottom Right&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 0.0f);&lt;br /&gt;  // Finished Drawing The Triangle&lt;br /&gt;  glEnd();&lt;br /&gt;&lt;br /&gt;  // Move Right 3 Units&lt;br /&gt;  glTranslatef(3.0f, 0.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;  // Set The Color To Blue One Time Only&lt;br /&gt;  glColor3f(0.5f, 0.5f, 1.0f);&lt;br /&gt;&lt;br /&gt;  // Draw A Quad&lt;br /&gt;  glBegin(GL_QUADS);&lt;br /&gt;      // Top Left&lt;br /&gt;      glVertex3f(-1.0f, 1.0f, 0.0f);&lt;br /&gt;      // Top Right&lt;br /&gt;      glVertex3f(1.0f, 1.0f, 0.0f);&lt;br /&gt;      // Bottom Right&lt;br /&gt;      glVertex3f(1.0f, -1.0f, 0.0f);&lt;br /&gt;      // Bottom Left&lt;br /&gt;      glVertex3f(-1.0f, -1.0f, 0.0f);&lt;br /&gt;  // Done Drawing The Quad&lt;br /&gt;  glEnd();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can download the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson03/lesson03.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-7415216602643411004?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7415216602643411004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/7415216602643411004'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/nehe-lesson-03-adding-color.html' title='NeHe Lesson 03: Adding Color'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2245863176222718480</id><published>2007-01-26T10:49:00.000+02:00</published><updated>2007-03-22T10:03:22.796+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 02: Your First Polygon</title><content type='html'>The NeHe &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02"&gt;lesson 2&lt;/a&gt; is here. There's not much new code, but the GL functions used are maybe the most important you'll ever learn when doing OpenGL coding. So I suggest if you passed the link at the beginning then don't miss is &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02"&gt;it&lt;/a&gt; this time. Read the tutorial. NeHe explains things so much better than I ever could. Afterwards you can marvel how similar the D version looks like. Isn't it great. :)&lt;br /&gt;&lt;br /&gt;The only difference between the first lesson and this one is the drawing function. I'll post only it as you can go and get the first one from &lt;a href="http://odefu.blogspot.com/2007/01/nehe-lesson-01-setting-up-opengl-window.html"&gt;here&lt;/a&gt; and just replace the drawGLScene function.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;/**&lt;br /&gt;* The drawing function. Here we will draw the triangle and the quad.&lt;br /&gt;*/&lt;br /&gt;void drawGLScene()&lt;br /&gt;{&lt;br /&gt;   // Clear The Screen And The Depth Buffer&lt;br /&gt;   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;   // Reset The Current Modelview Matrix&lt;br /&gt;   glLoadIdentity();&lt;br /&gt;&lt;br /&gt;   // Move Left 1.5 Units And Into The Screen 6.0&lt;br /&gt;   glTranslatef(-1.5f, 0.0f, -6.0f);&lt;br /&gt;&lt;br /&gt;   // Drawing Using Triangles&lt;br /&gt;   glBegin(GL_TRIANGLES);&lt;br /&gt;       glVertex3f(0.0f, 1.0f, 0.0f);   // Top&lt;br /&gt;       glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left&lt;br /&gt;       glVertex3f(1.0f, -1.0f, 0.0f);  // Bottom Right&lt;br /&gt;   // Finished Drawing The Triangle&lt;br /&gt;   glEnd();&lt;br /&gt;&lt;br /&gt;   // Move Right 3 Units&lt;br /&gt;   glTranslatef(3.0f, 0.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;   // Draw A Quad&lt;br /&gt;   glBegin(GL_QUADS);&lt;br /&gt;       glVertex3f(-1.0f, 1.0f, 0.0f);  // Top Left&lt;br /&gt;       glVertex3f(1.0f, 1.0f, 0.0f);   // Top Right&lt;br /&gt;       glVertex3f(1.0f, -1.0f, 0.0f);  // Bottom Right&lt;br /&gt;       glVertex3f(-1.0f, -1.0f, 0.0f);    // Bottom Left&lt;br /&gt;   // Done Drawing The Quad&lt;br /&gt;   glEnd();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Don't forget to change the title of the window to "NeHe's First Polygon Tutorial (D version)". Or to something else if you feel like it.&lt;br /&gt;&lt;br /&gt;You can download the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson02/lesson02.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2245863176222718480?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2245863176222718480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2245863176222718480'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/nehe-lesson-02-your-first-polygon.html' title='NeHe Lesson 02: Your First Polygon'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-5625948155973659045</id><published>2007-01-25T11:12:00.000+02:00</published><updated>2007-01-25T11:30:26.896+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Derelict'/><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='SDL'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>A few words</title><content type='html'>I wanted to say a few words about the requirements for building the lessons from my blog. First of all I'm working on a Windows box and wont be doing very much testing on the other platforms. The code is mostly cross-platform so it should compile and run just fine on Linux or Mac OS X. I'll try to point out places where I've used platform specific code.&lt;br /&gt;&lt;br /&gt;Next you will need the D compiler. There are two choices at the moment, the DMD from &lt;a href="http://www.digitalmars.com/d/dcompiler.html"&gt;DigitalMars&lt;/a&gt; and GDC a GCC based compiler from &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=154306"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You also need the shared library for your platform from the &lt;a href="http://libsdl.org"&gt;SDL website&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I use &lt;a href="http://dsource.org/projects/derelict"&gt;Derelict&lt;/a&gt; for OpenGL and SDL bindings. You can grab them from there or do as I do and use &lt;a href="http://dsource.org/projects/dsss"&gt;DSSS&lt;/a&gt;, the D Shared Software System.&lt;br /&gt;&lt;br /&gt;After that you should be ready to go.&lt;br /&gt;&lt;br /&gt;Please note, that I'm not going to go over how you can compile a D program or the basic usage of the SDL library. For those problems there are already very good documentation on the net. Google is your friend.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-5625948155973659045?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5625948155973659045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/5625948155973659045'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/few-words.html' title='A few words'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-8675180873889870208</id><published>2007-01-25T10:56:00.000+02:00</published><updated>2007-03-22T10:02:11.140+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='D Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='SDL'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenGL'/><title type='text'>NeHe Lesson 01: Setting up an OpenGL window</title><content type='html'>Hi, and welcome to the NeHe lesson 01 done in the D programming language.&lt;br /&gt;&lt;br /&gt;This code snippet shows you how to set up SDL to display an OpenGL window, How to use Derelict to load shared libraries and a basic loop for reading input and then drawing the screen.&lt;br /&gt;&lt;br /&gt;I'm trying to use documenting comments in the code as specified by &lt;a href="http://www.digitalmars.com/d/ddoc.html"&gt;Ddoc&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;/**&lt;br /&gt;* The first lesson in the &lt;a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01"&gt;NeHe tutorial series&lt;/a&gt;.&lt;br /&gt;* Originally written by Jeff Molofee.&lt;br /&gt;*&lt;br /&gt;* Authors: Jeff Molofee&lt;br /&gt;*          Olli Aalto&lt;br /&gt;*/&lt;br /&gt;module lesson01;&lt;br /&gt;&lt;br /&gt;import derelict.opengl.gl;&lt;br /&gt;import derelict.opengl.glu;&lt;br /&gt;import derelict.sdl.sdl;&lt;br /&gt;&lt;br /&gt;import tango.stdc.stringz;&lt;br /&gt;&lt;br /&gt;/// The window title&lt;br /&gt;const char[] WINDOW_TITLE = "NeHe's OpenGL Lesson 01 (D version)";&lt;br /&gt;&lt;br /&gt;/// The main loop flag&lt;br /&gt;bool running;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Module constructor. Here we load the GL, GLU and SDL shared libraries,&lt;br /&gt;* and the initialize SDL.&lt;br /&gt;*/&lt;br /&gt;static this()&lt;br /&gt;{&lt;br /&gt;   DerelictGL.load();&lt;br /&gt;   DerelictGLU.load();&lt;br /&gt;   DerelictSDL.load();&lt;br /&gt;&lt;br /&gt;   if (SDL_Init(SDL_INIT_VIDEO) &lt; args =" the" fullscreen =" false;"&gt; 1)&lt;br /&gt;   {&lt;br /&gt;       fullScreen = args[1] == "-fullscreen";&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   createGLWindow(WINDOW_TITLE, 640, 480, 16, fullScreen);&lt;br /&gt;   initGL();&lt;br /&gt;&lt;br /&gt;   running = true;&lt;br /&gt;   while (running)&lt;br /&gt;   {&lt;br /&gt;       processEvents();&lt;br /&gt;&lt;br /&gt;       drawGLScene();&lt;br /&gt;&lt;br /&gt;       SDL_GL_SwapBuffers();&lt;br /&gt;       SDL_Delay(10);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Process all the pending events.&lt;br /&gt;*/&lt;br /&gt;void processEvents()&lt;br /&gt;{&lt;br /&gt;   SDL_Event event;&lt;br /&gt;   while (SDL_PollEvent(&amp;event))&lt;br /&gt;   {&lt;br /&gt;       switch (event.type)&lt;br /&gt;       {&lt;br /&gt;           case SDL_KEYUP:&lt;br /&gt;               keyReleased(event.key.keysym.sym);&lt;br /&gt;               break;&lt;br /&gt;           case SDL_QUIT:&lt;br /&gt;               running = false;&lt;br /&gt;               break;&lt;br /&gt;           default:&lt;br /&gt;               break;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Process a key released event.&lt;br /&gt;*/&lt;br /&gt;void keyReleased(int key)&lt;br /&gt;{&lt;br /&gt;   switch (key)&lt;br /&gt;   {&lt;br /&gt;       case SDLK_ESCAPE:&lt;br /&gt;           running = false;&lt;br /&gt;           break;&lt;br /&gt;       default:&lt;br /&gt;           break;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Resize and initialize the OpenGL window.&lt;br /&gt;*/&lt;br /&gt;void resizeGLScene(GLsizei width, GLsizei height)&lt;br /&gt;{&lt;br /&gt;   if (height == 0)&lt;br /&gt;   {&lt;br /&gt;       height = 1;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   // Reset The Current Viewport&lt;br /&gt;   glViewport(0, 0, width, height);&lt;br /&gt;&lt;br /&gt;   // Select The Projection Matrix&lt;br /&gt;   glMatrixMode(GL_PROJECTION);&lt;br /&gt;&lt;br /&gt;   // Reset The Projection Matrix&lt;br /&gt;   glLoadIdentity();&lt;br /&gt;&lt;br /&gt;   // Calculate The Aspect Ratio Of The Window&lt;br /&gt;   gluPerspective(45.0f, cast(GLfloat)width / cast(GLfloat)height,&lt;br /&gt;       0.1f, 100.0f);&lt;br /&gt;&lt;br /&gt;   // Select The Modelview Matrix&lt;br /&gt;   glMatrixMode(GL_MODELVIEW);&lt;br /&gt;&lt;br /&gt;   // Reset The Modelview Matrix&lt;br /&gt;   glLoadIdentity();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Initialize OpenGL.&lt;br /&gt;*/&lt;br /&gt;void initGL()&lt;br /&gt;{&lt;br /&gt;   // Enables Smooth Shading&lt;br /&gt;   glShadeModel(GL_SMOOTH);&lt;br /&gt;&lt;br /&gt;   // Black Background&lt;br /&gt;   glClearColor(0.0f, 0.0f, 0.0f, 0.0f);&lt;br /&gt;&lt;br /&gt;   // Depth Buffer Setup&lt;br /&gt;   glClearDepth(1.0f);&lt;br /&gt;&lt;br /&gt;   // Enables Depth Testing&lt;br /&gt;   glEnable(GL_DEPTH_TEST);&lt;br /&gt;&lt;br /&gt;   // The Type Of Depth Test To Do&lt;br /&gt;   glDepthFunc(GL_LEQUAL);&lt;br /&gt;&lt;br /&gt;   // Really Nice Perspective Calculations&lt;br /&gt;   glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* The drawing function. Now we only clear the color and depht buffers, so that&lt;br /&gt;* the window stays black.&lt;br /&gt;*/&lt;br /&gt;void drawGLScene()&lt;br /&gt;{&lt;br /&gt;   // Clear The Screen And The Depth Buffer&lt;br /&gt;   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;&lt;br /&gt;   // Reset The Current Modelview Matrix&lt;br /&gt;   glLoadIdentity();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Initializes and opens the SDL window.&lt;br /&gt;*/&lt;br /&gt;void createGLWindow(char[] title, int width, int height, int bits,&lt;br /&gt;   bool fullScreen)&lt;br /&gt;{&lt;br /&gt;   // Set the OpenGL attributes&lt;br /&gt;   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);&lt;br /&gt;   SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);&lt;br /&gt;   SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);&lt;br /&gt;   SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);&lt;br /&gt;   SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);&lt;br /&gt;&lt;br /&gt;   // Set the window title&lt;br /&gt;   SDL_WM_SetCaption(toUtf8z(title), null);&lt;br /&gt;&lt;br /&gt;   // Note the SDL_DOUBLEBUF flag is not required to enable double&lt;br /&gt;   // buffering when setting an OpenGL video mode.&lt;br /&gt;   // Double buffering is enabled or disabled using the&lt;br /&gt;   // SDL_GL_DOUBLEBUFFER attribute. (See above.)&lt;br /&gt;   int mode = SDL_OPENGL;&lt;br /&gt;   if (fullScreen)&lt;br /&gt;   {&lt;br /&gt;       mode |= SDL_FULLSCREEN;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   // Now open a SDL OpenGL window with the given parameters&lt;br /&gt;   if (SDL_SetVideoMode(width, height, bits, mode) is null)&lt;br /&gt;   {&lt;br /&gt;       throw new Exception("Failed to open OpenGL window: " ~ getSDLError());&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   resizeGLScene(width, height);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Get the SDL error as a D string.&lt;br /&gt;*&lt;br /&gt;* Returns: A D string containing the current SDL error.&lt;br /&gt;*/&lt;br /&gt;char[] getSDLError()&lt;br /&gt;{&lt;br /&gt;   return fromUtf8z(SDL_GetError());&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;You can download the code from &lt;a href="http://odefu.googlecode.com/svn/trunk/NeHe/lesson01/lesson01.d"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-8675180873889870208?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8675180873889870208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/8675180873889870208'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/nehe-lesson-01-setting-up-opengl-window.html' title='NeHe Lesson 01: Setting up an OpenGL window'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-2611445094003468791.post-2379305682894392903</id><published>2007-01-25T09:53:00.000+02:00</published><updated>2007-01-25T10:17:11.828+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='introduction'/><title type='text'>Introduction</title><content type='html'>So here it is. My very first blog post. Been thinking about this for a while now. Finally figured out what I could write about. I'm going to put my versions of the &lt;a href="http://nehe.gamedev.net/"&gt;&lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;NeHe&lt;/span&gt; &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;OpenGL&lt;/span&gt; tutorials&lt;/a&gt;, written in the &lt;a href="http://digitalmars.com/d"&gt;D programming language&lt;/a&gt;, here. I will be using the &lt;a href="http://libsdl.org/"&gt;&lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SDL&lt;/span&gt;&lt;/a&gt; library for window handling and input.&lt;br /&gt;&lt;br /&gt;I have also some other stuff which relates to D, &lt;span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;OpenGL&lt;/span&gt; and games. I'll be posting about them too when I feel that I have a single module which is "good enough" to post about. Right now I have almost finished vector and matrix templates.&lt;br /&gt;&lt;br /&gt;But now I will welcome you to my blog. Let the writing commence.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2611445094003468791-2379305682894392903?l=odefu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2379305682894392903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2611445094003468791/posts/default/2379305682894392903'/><link rel='alternate' type='text/html' href='http://odefu.blogspot.com/2007/01/introduction.html' title='Introduction'/><author><name>OdeFu</name><uri>http://www.blogger.com/profile/13722314480601394379</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
