<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Philip Buuck</title>
	<atom:link href="http://philipbuuck.com/feed" rel="self" type="application/rss+xml" />
	<link>http://philipbuuck.com</link>
	<description>Video Game Programmer / Project Manager</description>
	<lastBuildDate>Thu, 06 Jun 2013 20:34:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>FBX Files, part 1</title>
		<link>http://philipbuuck.com/fbx-files-part-1?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fbx-files-part-1</link>
		<comments>http://philipbuuck.com/fbx-files-part-1#comments</comments>
		<pubDate>Thu, 06 Jun 2013 20:34:06 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[FBX Files]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=228</guid>
		<description><![CDATA[This summer I will be doing an independent study here at DePaul under Ed Keenan. I am focusing on the development of an exporter for FBX files that will pull the data from the files into a format compatible with our AZUL engine. Some of this information may end up published here. Some may not. [...]]]></description>
				<content:encoded><![CDATA[<p>This summer I will be doing an independent study here at DePaul under Ed Keenan. I am focusing on the development of an exporter for FBX files that will pull the data from the files into a format compatible with our AZUL engine.</p>
<p>Some of this information may end up published here. Some may not. But this part is at least.</p>
<p>Every FBX file consists of a single scene. This scene consists of a tree of nodes, which in the FBX SDK are from the KfbxNode class. The head of this tree is the root node, which is a dummy node. It is not saved into files, and therefore you do not ever want to put any crucial information into the root node.</p>
<p>Below this node is the tree of child nodes. Each of these nodes are of the KfbxNode class. Each of these nodes are connected to another class, called the KfbxNodeAttribute. It is THIS class that actually contains the elements of the scene. For example</p>
<p><code><br />
typedef enum<br />
{<br />
eUNIDENTIFIED,<br />
eNULL,<br />
eMARKER,<br />
eSKELETON,<br />
eMESH,<br />
eNURB,<br />
ePATCH,<br />
eCAMERA,<br />
eCAMERA_STEREO,<br />
eCAMERA_SWITCHER,<br />
eLIGHT,<br />
eOPTICAL_REFERENCE,<br />
eOPTICAL_MARKER,<br />
eNURBS_CURVE,<br />
eTRIM_NURBS_SURFACE,<br />
eBOUNDARY,<br />
eNURBS_SURFACE,<br />
eSHAPE,<br />
eLODGROUP,<br />
eSUBDIV,<br />
eCACHED_EFFECT,<br />
eLINE<br />
} EAttributeType;<br />
</code></p>
<p>Those are the different attributes. You see obvious ones, like a light, a mesh, a skeleton (or more specifically, a bone from the skeleton). The others are not as obvious, but this is where everything in the FBX file is defined.</p>
<p>This is a complex topic that is not documented well online at all &#8211; so we&#8217;ll be back to this another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/fbx-files-part-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rebuilding the Engine into a Dev Kit of Sorts</title>
		<link>http://philipbuuck.com/rebuilding-the-engine-into-a-dev-kit-of-sorts?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rebuilding-the-engine-into-a-dev-kit-of-sorts</link>
		<comments>http://philipbuuck.com/rebuilding-the-engine-into-a-dev-kit-of-sorts#comments</comments>
		<pubDate>Tue, 02 Apr 2013 01:47:59 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[PGE]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=202</guid>
		<description><![CDATA[I like my engine. I like what it does, and I like that I can move lots of shapes around with it. It&#8217;s a nice engine to work with. However, it is not flexible enough for my general needs. I intend to add to it as the next class progresses. It needs a good lighting [...]]]></description>
				<content:encoded><![CDATA[<p>I like my engine. I like what it does, and I like that I can move lots of shapes around with it. It&#8217;s a nice engine to work with.</p>
<p>However, it is not flexible enough for my general needs. I intend to add to it as the next class progresses. It needs a good lighting system. It needs a terrain system. It needs lots of things it doesn&#8217;t have yet.</p>
<p>Everything is too hardcoded to be of any use right now. I&#8217;ve made a texture manager, but it looks for the three textures that I have and no others. If I wanted to add another texture, it would take lots of grueling hand-crafting to add it.</p>
<p>I need to build the back-end in a way that I can quickly and easily create as many different demos as I want. This is going to take some refactoring that will not show on the screen all that much, but will be essential to the health of the engine.</p>
<p>Hopefully I can continue to add to the demo, to the point that there&#8217;s a point to making new videos. But I may have a few weeks here where there is no outward change in how things look.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/rebuilding-the-engine-into-a-dev-kit-of-sorts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL Trouble with AMD Graphics Cards</title>
		<link>http://philipbuuck.com/opengl-trouble-with-amd-graphics-cards?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=opengl-trouble-with-amd-graphics-cards</link>
		<comments>http://philipbuuck.com/opengl-trouble-with-amd-graphics-cards#comments</comments>
		<pubDate>Sat, 30 Mar 2013 14:14:43 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=200</guid>
		<description><![CDATA[My laptop from 2009 has an NVIDIA card in it. I built my desktop in 2012 and put an AMD Radeon HD 7770 in it &#8211; a very capable card. However, I&#8217;ve been having trouble getting the OpenGL programs that I run on my laptop to work properly on my desktop, which has struck me [...]]]></description>
				<content:encoded><![CDATA[<p>My laptop from 2009 has an NVIDIA card in it. I built my desktop in 2012 and put an AMD Radeon HD 7770 in it &#8211; a very capable card. However, I&#8217;ve been having trouble getting the OpenGL programs that I run on my laptop to work properly on my desktop, which has struck me as weird.</p>
<p>I have been concerned about this for awhile because it seems to be an open secret in the graphics hardware world that AMD&#8217;s support of OpenGL isn&#8217;t quite as good as NVIDIA&#8217;s is. But on the other hand, I don&#8217;t want to just jump to a &#8220;this company sucks&#8221; kind of conclusion. Odds are there is something I&#8217;m not doing quite right, seeing as I have a little less experience than the millions of man hours that have gone into NVIDIA and AMD&#8217;s history.</p>
<p>I realized this morning as I got to work (away from my desktop, so I can&#8217;t test anything just yet) that GLUT has a glutInitContextVersion() function that allows the user to define the version of OpenGL they are using. I haven&#8217;t been using it, and while OpenGL defaults to 3.3 on my laptop, that&#8217;s also the highest level it supports. Perhaps my desktop is defaulting to 4.2, which doesn&#8217;t compiler shaders right or something?</p>
<p>I have a new video to put together to show off the basics of a GUI that I&#8217;ve been putting together for my engine, but while everything looks great on my laptop, it doesn&#8217;t work at all on my desktop, which is the whole basis for this post. It&#8217;s annoying, and makes me wish our school was using DirectX rather than OpenGL for its work. Maybe I should maintain two versions of my engine, one in OpenGL for the classes and one in DirectX for my &#8216;professional&#8217; portfolio. I don&#8217;t really intend to work outside the Windows work anyway, unless I&#8217;m going to consoles, and then XBOX uses DirectX too, whereas the PS3 and PS4 use proprietary graphics libraries that I&#8217;ll have to learn anyway.</p>
<p>This is mostly just me thinking out loud, but it&#8217;s useful to get things down in writing, in a linear fashion. Helps organize my thoughts. Time to play around with the engine some more.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/opengl-trouble-with-amd-graphics-cards/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL Tutorial for 3.x and Above</title>
		<link>http://philipbuuck.com/opengl-tutorial-for-3-x-and-above?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=opengl-tutorial-for-3-x-and-above</link>
		<comments>http://philipbuuck.com/opengl-tutorial-for-3-x-and-above#comments</comments>
		<pubDate>Thu, 28 Mar 2013 13:49:14 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=197</guid>
		<description><![CDATA[I have found understanding OpenGL 3.x to be a difficult topic to really pick up on online. There are some good tutorials, specifically at OglDev, but overall it&#8217;s not nearly as covered a topic as DirectX. This doesn&#8217;t surprise me, since Microsoft has spent years aiming DirectX at the game community and Windows is at [...]]]></description>
				<content:encoded><![CDATA[<p>I have found understanding OpenGL 3.x to be a difficult topic to really pick up on online. There are some good tutorials, specifically at <a href="http://ogldev.atspace.co.uk/">OglDev</a>, but overall it&#8217;s not nearly as covered a topic as DirectX. This doesn&#8217;t surprise me, since Microsoft has spent years aiming DirectX at the game community and Windows is at least 85% of the PC game market (probably closer to 90-95%). So why would a game programmer worry about OpenGL at all?</p>
<p>Well, to be honest, my biggest reason for focusing on OpenGL is that we use it in our game classes at DePaul University. If we used DirectX instead, I&#8217;d be working on that instead. However, the perspective from this side of the fence has been interesting. DirectX has quite a few helper classes available to it, such as a font class and math classes that you can just plug and chug away. With OpenGL, I have to do this type of work on my own. It has forced me to really think about the representation of a font in a program, for example, or even a simple GUI. How does a slider bar work exactly? How does it get drawn? I appreciate this lowest-of-levels look at programming.</p>
<p>Most online resources for OpenGL tutorials still focus on the fixed pipeline of OpenGL 2.1 and earlier. This functionality still works just fine, and probably won&#8217;t go anywhere in GPUs of the future, but the world of video games is moving on. Many AAA titles being released this year requiring DirectX 10, which is programmable pipeline based, which is the equivalent to OpenGL 3.0 and above. The world is advancing to the point where the best studios use shaders to work with their game data. For someone to wants to work in the industry, I can&#8217;t bother with fixed pipelines anymore.</p>
<p>The best resource for learning modern OpenGL is the OpenGL Superbible in my opinion. The 5th edition of the book focuses on the programmable pipeline, but it has been criticized for using a helper library called GLTools for most of the book. This class encapsulates ideas like a camera, a graphics pipeline, and even emulates old-school fixed function concepts like the old glBegin() and glEnd() functions. This might not necessarily be a bad idea, but my problem with it is that the code itself is hard to work with. It builds but with a ton of build warnings because the author did not include any of the debug files with the library. The author supplied a Visual Studio 2010 solution file, but the files are arranged haphazardly inside it. Overall, I consider myself fairly competent in figuring out technical things, and this whole set felt very messy to me. For someone who is less experienced in the technical world, it may be enough to turn them off the book completely. Based on the reviews on Amazon, this is a very real problem.</p>
<p>The book never really breaks the reader completely free from the helper classes, which is unfortunate. It makes fully understanding some of these concepts harder than it seems it should be. In my own work in understanding OpenGL, I have started to slowly pull the code out of the GLTools library for the source code tutorials, so that instead of using those libraries I can actually see the OpenGL code instead. As I do this I&#8217;m going to post the source code and projects on the site here.</p>
<p>My impression of the book itself is that it is very good &#8211; Mr. Wright clearly knows a lot about OpenGL, and the book goes into details that no online tutorial I have seen covers. I think these topics are essential for anyone who wants to really understand how not only OpenGL but GPU hardware operates. But the code is just so hard to work with that I think posting a &#8216;translated&#8217; version of it will be beneficial &#8211; certainly for me, and perhaps also for people looking to really understand the nuts and bolts of how OpenGL works.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/opengl-tutorial-for-3-x-and-above/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL GUI buttons now working!</title>
		<link>http://philipbuuck.com/opengl-gui-buttons-now-working?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=opengl-gui-buttons-now-working</link>
		<comments>http://philipbuuck.com/opengl-gui-buttons-now-working#comments</comments>
		<pubDate>Tue, 26 Mar 2013 14:36:08 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[PGE]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=193</guid>
		<description><![CDATA[I don&#8217;t typically use exclamation points in the titles of a post, but I&#8217;m pretty thrilled about this one. I have added a GUI to my engine and support in that GUI for buttons! It took me a LONG time to figure out how to do this in OpenGL 3.3. I found many tutorials online [...]]]></description>
				<content:encoded><![CDATA[<p>I don&#8217;t typically use exclamation points in the titles of a post, but I&#8217;m pretty thrilled about this one. I have added a GUI to my engine and support in that GUI for buttons!</p>
<p><a href="http://philipbuuck.com/wp-content/uploads/2013/03/GUI.png"><img src="http://philipbuuck.com/wp-content/uploads/2013/03/GUI-300x234.png" alt="GUI" width="300" height="234" class="aligncenter size-medium wp-image-194" /></a></p>
<p>It took me a LONG time to figure out how to do this in OpenGL 3.3. I found many tutorials online about how to do it in old school OpenGL, and I guess that&#8217;s becoming a more accepted modern way, but I didn&#8217;t want to do that. I&#8217;m really working on learning the mindset behind OpenGL 3+, and so I spent two days, but I got it working.</p>
<p>The basic idea is that the two buttons you see are each textures. I used GL_TEXTURE_RECTANGLE inside the glBindTexture() function so that I would be drawing in absolute window coordinates, rather than the typical GL_TEXTURE_2D that would give me a range of -1 to 1 in the x and y coordinates. That is probably not necessary, but made understanding the issue better. I also grabbed a shader from Chapter 7 of the SuperBible that translates the x and y values into 2D coordinates. That may not sound too coherent, but I haven&#8217;t spent much time with shaders yet, so I&#8217;m a little hazy on them still.</p>
<p>Currently, if I click on the OpenGL logo it exits the program. The Settings button (which is a .tga file, not a font &#8211; no fonts implemented yet) does nothing. My next plan is to have the buttons respond when the mouse moves over it, and have a state for clicking and releasing buttons. I have other versions of that Settings .tga so I can swap textures out when an action takes place.</p>
<p>Perhaps when I get this down a little better I will put a tutorial on OpenGL 3+ GUI programming. I&#8217;m sure people are looking for something like that. There are libraries online that will create pretty sophisticated GUIs, but I&#8217;m thrilled to have finished the basics of my own.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/opengl-gui-buttons-now-working/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Game Design and Programming Blog #1</title>
		<link>http://philipbuuck.com/video-game-design-and-programming-blog-1?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=video-game-design-and-programming-blog-1</link>
		<comments>http://philipbuuck.com/video-game-design-and-programming-blog-1#comments</comments>
		<pubDate>Sat, 23 Mar 2013 22:23:36 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=190</guid>
		<description><![CDATA[I am live with the first recording of my game programming blog. I&#8217;m taking the engine I built for my first class at DePaul and running wild with it. Over the next few months I intend to see it turn into a full 3D world, complete with animated character walking around and maybe even other [...]]]></description>
				<content:encoded><![CDATA[<p>I am live with the first recording of my game programming blog. I&#8217;m taking the engine I built for my first class at DePaul and running wild with it. Over the next few months I intend to see it turn into a full 3D world, complete with animated character walking around and maybe even other characters to interact with!  This will be kept on YouTube, and embedded here.</p>
<p><a href="http://philipbuuck.com/wp-content/uploads/2013/03/PGE.rar">Here is the executable. Try it out!</a></p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/MCKXPbM0lgg" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/video-game-design-and-programming-blog-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Game Engine, 10 weeks in</title>
		<link>http://philipbuuck.com/game-engine-10-weeks-in?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=game-engine-10-weeks-in</link>
		<comments>http://philipbuuck.com/game-engine-10-weeks-in#comments</comments>
		<pubDate>Fri, 22 Mar 2013 21:01:17 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[PGE]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=188</guid>
		<description><![CDATA[So now I&#8217;m done with my first quarter of actual game programming at DePaul University. The culmination of my work over these first 10 weeks can be seen in this video on YouTube: GAM475 Demo This project was created in five parts. The first part was the scene graph, which is just a node object [...]]]></description>
				<content:encoded><![CDATA[<p>So now I&#8217;m done with my first quarter of actual game programming at DePaul University. The culmination of my work over these first 10 weeks can be seen in this video on YouTube:</p>
<p><a href="http://www.youtube.com/watch?v=su3LrZaVCc0">GAM475 Demo</a></p>
<p>This project was created in five parts. The first part was the scene graph, which is just a node object that has a parent, child, and sibling. Make a ton of them and connect them all together and you have a tree. Professor Keenan gave us a bunch of unit tests that our tree had to pass and I was pretty surprised by how hard it was to make sure they all actually passed. But in the end we made a great scene graph.</p>
<p>The second part was a memory system, which was by far the hardest part of this whole thing. It was an elaborately debuggable system based on the Windows Heap API. Very complex, lots of pointer math, but I was so impressed by the whole concept that I&#8217;m going to do an independent study over the summer where I build a more in depth memory module for DePaul&#8217;s Azul project.</p>
<p>The third part was a file I/O system, which is currently just a simple Win32 wrapper. This was much simpler compared to the memory system.</p>
<p>The fourth part was the Math library, at least the Vector and Matrix portions of it. We are adding quaternions next quarter. This was more of an operator-overloading lesson for C++ than anything else. The math was pretty simple, but to get the operators to do what we wanted was harder.</p>
<p>The fifth part was the graphics system, where we took a simple OpenGL demo and built it into whatever we wanted. The requirements were to use the scene graph we made, cull objects against the camera frustum, and instantiate a bunch of our objects. It was hard because we were left to our devices to figure out how to do most of this stuff. Each week in class Prof. Keenan would go through the process of refactoring or building a small part of what we needed, but a bunch of it was left to us.</p>
<p>This proved to be a fascinating lesson. Rather than worry about finding The One Right Way to do something, as I used to do, I learned to just hack something together to get what I wanted, and then refactor the functioning code into a proper system. This is a much more effective and iterative way to get things done, and it was a lesson I don&#8217;t think I would be able to learn any other way. It was terrific.</p>
<p>So where to go from here? We have a number of steps we will be taking next quarter, but that doesn&#8217;t mean I intend to sit on my laurels in the meantime! I have four objects in the code as it stands &#8211; the pyramid, the cube, the doughnut, and an object that is essentially the parent that holds all 36 of those objects into a DNA shape. These represent four classes in my code. Each of these classes has a file for its overall representation or model, and a class that represents an instance of that object.</p>
<p>I want to abstract this into two classes. One will be the equivalent of Game Coding Complete&#8217;s Actor class &#8211; a generalized class that holds an OpenGL VBO with however many vertices this object needs, its location in the world, and anything else I may need for it. The other class will represent an instance of one of these objects.</p>
<p>In the end, this code will not function any differently, but internally it will be much simpler. It will also be more data-driven, as each of these objects will have a source file that its info is read from.</p>
<p>I hope to update here on a weekly basis of what I am changing in my system. As the months and years go by I hope to see it improve from what it is now to a fully realized game engine. I think even the next 10 weeks are going to show a drastic improvement.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/game-engine-10-weeks-in/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL, VAOs, VBOs, etc etc&#8230;</title>
		<link>http://philipbuuck.com/opengl-vaos-vbos-etc-etc?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=opengl-vaos-vbos-etc-etc</link>
		<comments>http://philipbuuck.com/opengl-vaos-vbos-etc-etc#comments</comments>
		<pubDate>Thu, 07 Mar 2013 17:53:13 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=185</guid>
		<description><![CDATA[I&#8217;ve spent the past several weeks learning the ins and outs of the OpenGL system. It hasn&#8217;t felt very intuitive to me, which is probably because it has been designed by committee over the past several decades, but at the same time, as I got used to its style of &#8216;thinking&#8217;, I&#8217;ve been able to [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve spent the past several weeks learning the ins and outs of the OpenGL system.  It hasn&#8217;t felt very intuitive to me, which is probably because it has been designed by committee over the past several decades, but at the same time, as I got used to its style of &#8216;thinking&#8217;, I&#8217;ve been able to absorb things at a somewhat decent clip.</p>
<p>When a programmer wants to create anything in OpenGL, from a vertex array object to a shader program, the proper course of creation is to define a GLuint ( which is just a typedef for an unsigned int ) which will serve as a label that connects your code to the object inside the OpenGL state.  This is done because many of these objects are kept on the GPU, and so loading the data to the GPU is a different process than actually operating on the objects.</p>
<p>You use a call to define the label, and then use that label to load data into the OpenGL object.  Once you get to the point where the label is no longer needed, you can actually delete the label.  Deletion of the label is NOT the same thing as deletion of the object &#8211; in fact, OpenGL will hold onto information that it needs at a later time, so you don&#8217;t technically know when it is deleted.</p>
<p>That sounds a little abstract and crazy, so here&#8217;s an example for creating a shader.  You initially call glCreateShader() to create a shader label, you send in the source code for your shader, and then, immediately after checking everything is okay, you can call glDeleteShader() to delete the shader label.  The compiled code is still inside the OpenGL object, and will be used to transform your data, but the label is gone.</p>
<p>Of course, if you need to switch from shader to shader in your program, you don&#8217;t want to remove your one link to it.  But you can if you don&#8217;t need it anymore.</p>
<p>VAOs serve as a batch of drawing commands.  You can define a VAO, send in some drawing commands to set a particular state, and then in the future instead of calling those commands you can just set the VAO again.  In my demo code I use separate VAOs for separate types of objects &#8211; lines, points, and triangles &#8211; and then bounce from VAO to VAO to draw them all.</p>
<p>VBOs are the buffers where you keep vertices and indices.  This is where the actual tuples are kept.  Many VBOs can be kept inside a VAO, along with instructions on how to use them.</p>
<p>I use gDEbugger to peek into how OpenGL is operating on my program.  It&#8217;s a complex program with a TON of information &#8211; more than I really need at this point, but it&#8217;s been very insightful in showing how OpenGL states work, what is being stored in the GPU, and when objects can be safely destroyed.  Best of all, it was currently made 100% free!</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/opengl-vaos-vbos-etc-etc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DePaul&#8217;s Azul Engine</title>
		<link>http://philipbuuck.com/depauls-azul-engine?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=depauls-azul-engine</link>
		<comments>http://philipbuuck.com/depauls-azul-engine#comments</comments>
		<pubDate>Fri, 01 Mar 2013 17:12:53 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=183</guid>
		<description><![CDATA[I am currently involved in a new project at DePaul University &#8211; the Azul game engine. The goal of the project is to create a game engine that is accessible as the best possible learning tool for a budding game programmer. We have only had a couple basic meetings, but here is the basic idea. [...]]]></description>
				<content:encoded><![CDATA[<p>I am currently involved in a new project at DePaul University &#8211; the Azul game engine.</p>
<p>The goal of the project is to create a game engine that is accessible as the best possible learning tool for a budding game programmer.  We have only had a couple basic meetings, but here is the basic idea.  A game engine has many different moving parts &#8211; let&#8217;s generalize things and say it has an Input system, a File system, a Memory system, and so on.</p>
<p>Our goal is to make a 100% open source project that is built in terms of separate modules that can easily be pulled out.  So if you&#8217;re interested in seeing how an Input system may look, you could come to our site and pull out the Input system by itself.  Each individual system would have the library as it is used in Azul, as well as a sample Test solution that will be full of unit tests, so the person could see how those systems are tested.</p>
<p>I think this is a fascinating idea.  My game engine course at DePaul has already won me over on Test-Driven Development this quarter, and Azul is helping me even more.  As it stands, we are at such an early stage that much of my time is being spent thinking about the game architecture and how we want to structure things in general.  I am busy reading up on several books on game engine design (and software architecture in general) and am finding the entire experience extremely educational.  It gives me a chance to get involved in making some very big decisions about how to build a project, with the watchful way of Professor Ed Keenan giving us all guidance.</p>
<p>We are probably several months away from having something to show off, but that definitely doesn&#8217;t mean that no work is happening.  On the contrary, there is a TON of work to be done.  We have a game in mind as our goal, which will help drive us in a particular direction (and gives us a great end goal too).  But as work happens, I will post here to update.</p>
<p>Needless to say, this also means my older game engines that I have written about here is moot for the time being.  This is too good an opportunity to pass up.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/depauls-azul-engine/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Volatile To Disable Optimizations</title>
		<link>http://philipbuuck.com/using-volatile-to-disable-optimizations?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-volatile-to-disable-optimizations</link>
		<comments>http://philipbuuck.com/using-volatile-to-disable-optimizations#comments</comments>
		<pubDate>Mon, 07 Jan 2013 19:06:46 +0000</pubDate>
		<dc:creator>Philip</dc:creator>
				<category><![CDATA[assembly]]></category>

		<guid isPermaLink="false">http://philipbuuck.com/?p=171</guid>
		<description><![CDATA[Let&#8217;s say you wanted to study how a function is called in C++. You decide to look at the assembly of the following program: void f&#40;&#41; &#123;&#125; &#160; int main&#40;&#41; &#123; f&#40;&#41;; return 0; &#125; In x64 disassembly, running in Debug mode, we get the following: push rdi sub rsp,20h mov rdi,rsp mov ecx,8 mov [...]]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s say you wanted to study how a function is called in C++. You decide to look at the assembly of the following program:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> f<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
     f<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
     <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>In x64 disassembly, running in Debug mode, we get the following:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #00007f; font-weight: bold;">push</span> <span style="color: #46aa03; font-weight: bold;">rdi</span>
<span style="color: #00007f; font-weight: bold;">sub</span> <span style="color: #46aa03; font-weight: bold;">rsp</span><span style="color: #339933;">,</span><span style="color: #ff0000;">20h</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #46aa03; font-weight: bold;">rdi</span><span style="color: #339933;">,</span><span style="color: #46aa03; font-weight: bold;">rsp</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #46aa03; font-weight: bold;">ecx</span><span style="color: #339933;">,</span><span style="color: #ff0000;">8</span>
<span style="color: #00007f; font-weight: bold;">mov</span> <span style="color: #46aa03; font-weight: bold;">eax</span><span style="color: #339933;">,</span><span style="color: #ff0000;">0CCCCCCCCh</span>
<span style="color: #00007f; font-weight: bold;">rep</span> <span style="color: #00007f; font-weight: bold;">stos</span> <span style="color: #0000ff; font-weight: bold;">dword</span> ptr <span style="color: #009900; font-weight: bold;">&#91;</span><span style="color: #46aa03; font-weight: bold;">rdi</span><span style="color: #009900; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">call</span> f <span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#123;</span>address<span style="color: #009900; font-weight: bold;">&#125;</span><span style="color: #009900; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">xor</span> <span style="color: #46aa03; font-weight: bold;">eax</span><span style="color: #339933;">,</span><span style="color: #46aa03; font-weight: bold;">eax</span>
&nbsp;
<span style="color: #00007f; font-weight: bold;">add</span> <span style="color: #46aa03; font-weight: bold;">rsp</span><span style="color: #339933;">,</span><span style="color: #ff0000;">20h</span>
<span style="color: #00007f; font-weight: bold;">pop</span> <span style="color: #46aa03; font-weight: bold;">rdi</span>
<span style="color: #00007f; font-weight: bold;">ret</span></pre></td></tr></table></div>

<p>Really this is mostly setup and teardown of the main() function &#8211; the only line that refers to the function call is the actual <code>call f ({address})</code> line, where the number in {address} will be different depending on where Windows put your program in memory.</p>
<p>This is obviously as simple as it gets, but what happens if we switch this to a Release version?</p>
<pre>xor eax,eax</pre>
<p>That&#8217;s it.  Not even the setup and teardown of the main function!!!</p>
<p>This happens because the Visual Studio compiler is optimizing away everything that is unnecessary for the program to run.  By looking at this extremely basic source code, it sees the following:</p>
<p>The f() function is unnecessary because it doesn&#8217;t actually do anything.  So we aren&#8217;t going to call it at all.</p>
<p>In fact, the only thing the entire program does is returns 0!  So instead of even setting up the main function, all we need to do is put a 0 in the eax register, which, as you know, is where the return value of any function is placed.  So the entire program has gone from the 11 lines in the Debug version (really more, as the <code>rep stos</code> command is a loop in disguise), to a single <code>xor</code> in the Release version.</p>
<p>This is great when you are programming a game, as it saves a lot of real time in your Release version.  But&#8230; what if you really wanted to ensure that something is NOT optimized away?</p>
<p>The general answer to this is the <code>volatile</code> keyword.  This keyword, when applied to a variable, tells the program that it is possible for this variable to be adjusted by a program outside of this one.  In other words, the compiler can never assume it holds the same value it held the last time you read it, so you can never optimize any reads away.</p>
<p>So let&#8217;s stick that in here.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">volatile</span> <span style="color: #0000ff;">int</span> a <span style="color: #000080;">=</span> <span style="color: #0000dd;">5</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> f<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> a<span style="color: #000040;">++</span><span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    f<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Notice that we are now incrementing this volatile int inside of the f() function.  This should do it right?</p>
<p>Well, let&#8217;s take a peek at what we have now:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #00007f; font-weight: bold;">inc</span> <span style="color: #0000ff; font-weight: bold;">dword</span> ptr <span style="color: #009900; font-weight: bold;">&#91;</span>a <span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #009900; font-weight: bold;">&#123;</span>address<span style="color: #009900; font-weight: bold;">&#125;</span><span style="color: #009900; font-weight: bold;">&#41;</span><span style="color: #009900; font-weight: bold;">&#93;</span>
<span style="color: #00007f; font-weight: bold;">xor</span> <span style="color: #46aa03; font-weight: bold;">eax</span><span style="color: #339933;">,</span><span style="color: #46aa03; font-weight: bold;">eax</span></pre></td></tr></table></div>

<p>Well, we&#8217;re partly there.  The inc instruction is what increments that <code>volatile int</code>, but it has still optimized out the function call and just increments it in the main function.  This is a sign of just how smart the optimizer in Visual Studio is.</p>
<p>We would have to make some more complicated code to keep the function call inside main(), but this should be enough to show how important using volatile can be when you absolutely need to see some assembly code in your Release version.</p>
]]></content:encoded>
			<wfw:commentRss>http://philipbuuck.com/using-volatile-to-disable-optimizations/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
