<?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>BitwiseOR &#187; Notes</title>
	<atom:link href="http://bitwiseor.com/category/notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://bitwiseor.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 16 Feb 2010 02:16:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Logical vs. Bitwise</title>
		<link>http://bitwiseor.com/2008/05/logical-vs-bitwise/</link>
		<comments>http://bitwiseor.com/2008/05/logical-vs-bitwise/#comments</comments>
		<pubDate>Thu, 01 May 2008 22:19:45 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/47/</guid>
		<description><![CDATA[I started a new job not too long ago. All new hires at my company need to go through a couple months of training. That&#8217;s fine; I actually see it as a good thing. I&#8217;ve been learning how the company works, who is in charge of what and what I need to do when I [...]]]></description>
			<content:encoded><![CDATA[<p>I started a new job not too long ago. All new hires at my company need to go through a couple months of training. That&#8217;s fine; I actually see it as a good thing. I&#8217;ve been learning how the company works, who is in charge of what and what I need to do when I screw up.</p>
<p>A large part of the training actually involves teaching newcomers how to code. This is actually the main focus of the training as they hire people who have majored in math or economics and don&#8217;t have a background in code. Having quite a large background in code, the training has been rather dull. But it&#8217;s still good for me to know how the company works, and it has made me comfortable enough that I won&#8217;t have the pressure of a new job bearing down on me once I actually start doing important work.</p>
<p>But my background also gives me a different perspective on coding and the specifics of languages that I&#8217;ve used. When they are told things about a language, they just have to accept it and move on without really questioning the reasons. For instance: they were taught that the difference between <code>&#038;</code> and <code>&#038;&#038;</code> in Java has to do with what exactly is executed when used in an if statement.</p>
<p>So, the following two <code>if</code> statements are executed differently. The first will not execute <code>obj.hasElements()</code> when <code>obj</code> is <code>null</code>, while the second statement will throw a <code>NullPointerException</code>.</p>
<p>
<pre name="code" class="java:nogutter:nocontrols">
if(obj != null &#038;&#038; obj.hasElements()) {
    obj.run();
}

if(obj != null &#038; obj.hasElements()) {
    obj.run();
}
</pre>
</p>
<p>Of course, this is correct; however, I have a problem with explaining the difference between the two AND statements for a couple reasons. Firstly, BitwiseAND and BitwiseOR are my namesake websites, and really are close to my heart. When described so poorly, I feel a need to speak out on their behalf. Secondly, the second <code>if</code> statement really wouldn&#8217;t be used this way; at least not in Java (I could see this occurring in C++ quite a bit). Bitwise operators (<code>&#038;</code>, <code>|</code>, <code>^</code>, &#8230;) are for manipulating bits, not booleans (as the name implies). Likewise, logical operators (<code>&#038;&#038;</code>, <code>|</code>, <code>!</code>, &#8230;) are for logic statements. There is no reason to write the second <code>if</code> statement for efficiency and semantic reasons.</p>
<p>Now, to be fair, the instructors must have mentioned this to let the students know why a program was crashing with the second version and why they should stick to the first version. I asked one of the students if they gave any scenario in which the bitwise operations would be used, and I was told that they didn&#8217;t give any examples.</p>
<p>So, the students are seeing the bitwise operations and are left with a sense that they should never use them in an <code>if</code> statement and therefore are pointless additions to the Java language. Never to be used and only to confuse you when you use <code>&#038;</code> instead of <code>&#038;&#038;</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2008/05/logical-vs-bitwise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coding methodology</title>
		<link>http://bitwiseor.com/2008/03/coding-methodology/</link>
		<comments>http://bitwiseor.com/2008/03/coding-methodology/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 03:13:03 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/46/</guid>
		<description><![CDATA[You know what I find fun? Coding.
Not planning to code, not testing by hand, but pure coding from scratch and then untangling the mess I made by debugging it. That&#8217;s why I don&#8217;t care for certain methodologies. The Waterfall method specifically.
Don&#8217;t get me wrong; when done correctly coding models work beautifully. In fact, it was [...]]]></description>
			<content:encoded><![CDATA[<p>You know what I find fun? Coding.</p>
<p>Not planning to code, not testing by hand, but pure coding from scratch and then untangling the mess I made by debugging it. That&#8217;s why I don&#8217;t care for certain methodologies. The <a href="http://en.wikipedia.org/wiki/Waterfall_model">Waterfall</a> method specifically.</p>
<p>Don&#8217;t get me wrong; when done correctly coding models work beautifully. In fact, it was the Waterfall model that I just used recently on a small program that worked so well to show me how much I despise. </p>
<p>First, we start with the requirements. Make a list of the major requirements in the project, now break those down into manageable pieces, break those down into finer details, keep breaking down each item in the list until you have one <em>specific</em> requirement for each bullet point. Now your list is 30 pages long and 15 levels deep.</p>
<p>Now that we have a list of requirements, &#8220;design&#8221; your program. Don&#8217;t code it; &#8220;design&#8221; it in psuedocode. </p>
<p>Next, create your test data. Make sure you have a test for each and every requirement. Also make sure that each branch in you design is tested somehow. Be thorough; test edge conditions, test invalid input. Verify that every possible input is going to be tested. Now test your design by hand. I know this sounds like something a computer can do better than a human, and in fact, it is. However, you would have to code your design in order to test it and that part comes later.</p>
<p>After killing yourself by pouring over each line of code with every item of test data you are now ready to code your program. Lucky for you, you&#8217;ve managed to create a perfect design after all that testing by hand, so this is actually the easy part. No thinking involved other than dealing with the minutia of the language itself (but you probably hinted at that in the design anyway).</p>
<p>Now do your actual testing in order catch your coding mistakes. Run all the test data through and compare it with the output from earlier. It all works great right? Great!</p>
<p>You&#8217;ve just managed to do so much work in advanced that the actual coding and debugging has become the shortest part of the process. The rest of the time you spent doing boring tasks that put you to sleep.</p>
<p>Now, not all methodologies are like this. Variants of the <a href="http://en.wikipedia.org/wiki/Agile_software_development">Agile method</a> are more oriented towards the needs of the programmer instead of the needs of a corporation. These other methods make the time line of a project seem uncertain and risky, but in my experience, the final project has a higher quality and you&#8217;ve made your programmers happier at the same time by working with them instead of demanding deliverables.</p>
<p>So, long story short, the Waterfall method is a great way to make a working program, as long you think coding and debugging is the most expensive or least important part of the process. I, on the other hand, love to code. Requirements and designs are necessary, sure, but not in such detail. Lets get to the coding and test from there. Don&#8217;t make me do so much work that I will only do poorly because I hate it so; just tell me what you want, and I&#8217;ll code it for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2008/03/coding-methodology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Depth Map, Normal Map</title>
		<link>http://bitwiseor.com/2006/08/depth-map-normal-map/</link>
		<comments>http://bitwiseor.com/2006/08/depth-map-normal-map/#comments</comments>
		<pubDate>Thu, 24 Aug 2006 05:18:39 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/37/</guid>
		<description><![CDATA[A lot of interesting graphics techniques require the use of depth maps and normals maps. Depth maps store information of how far a pixel is from the eye in the final rendered scene. Similarly, normal maps store the surface&#8217;s normal vector for the cooresponding pixel. One way to do this would be to draw the [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of interesting graphics techniques require the use of depth maps and normals maps. Depth maps store information of how far a pixel is from the eye in the final rendered scene. Similarly, normal maps store the surface&#8217;s normal vector for the cooresponding pixel. One way to do this would be to draw the scene with vertex normals instead of vertex colors and copy the color and depth buffers into a texture. A more straight forward technique uses vertex and pixel shaders and gives us more control over the final maps. Also, if we use <a href="http://www.nvidia.com/dev_content/nvopenglspecs/GL_EXT_framebuffer_object.txt">GL_EXT_framebuffer_object</a>, we can avoid any nasty context switches that are associated with pBuffers.</p>
<p>The first thing we do is understand the layout of the maps. Really, we&#8217;ll only be rendering to a single texture. This has the advantage of saving space, but may cause a problem if we only have 8 bits per channel. If the normal {x, y, z} is stored in {r, g, b} and the depth stored in {a}, then we&#8217;ve gone from 32 bit floating point {x} to 8 bit {r}, or 24 bit depth to 8 bit {a}; the same goes for the other components. This loss in precision will show up in banding artifacts and the errors will be carried through for every computation that follows that map use. But sometimes this is unavoidable based on the platform that we&#8217;re using.</p>
<p>How do we fit a normal and depth into a single pixel? Well, we know which color component will hold which value, but we then find out that the GL will clamp our texture values to [0,1].  No negative values for us. Luckily, the depth is already clamped to [0,1] by virtue of the graphics pipeline; the normal is an entirely different problem. It does have an easy solution though. Normals can be normalized (duh), which means each component will map to [-1,1]. If we normalize, then multiply by two and subtract one, our mapping will be fine. We just need to undo the tranformation when we reference it later on.</p>
<p>This gives us our GLSL vertex shader:</p>
<p><code lang="cpp">varying vec3 normal;<br />
varying float depth;<br />
void main()<br />
{<br />
	gl_Position = ftransform();<br />
	normal = gl_NormalMatrix * gl_Normal;</p>
<p>	vec4 eyeTmp = gl_Position;<br />
	eyeTmp.xyz = eyeTmp.xyz / eyeTmp.w;<br />
	depth = eyeTmp.z;<br />
}</code></p>
<p>And our fragment shader:</p>
<p><code lang="cpp">varying vec3 normal;<br />
varying float depth;</p>
<p>void main()<br />
{<br />
	vec3 N = normalize(normal);<br />
	N = 0.5 * N + 0.5;</p>
<p>	gl_FragColor = vec4(N, depth);<br />
}</code></p>
<p>Now, that may not be the absolute best way, but it works on nearly every platform that can use GLSL. One issue that I should bring up, is that the pixel&#8217;s depth value can be directly referenced in the fragment shader through <code>gl_FragCoord.z</code>; on some machines, reding this value was very, very slow, but now I&#8217;ve seen great improvement in reading the value. This means we can remove all references to the varying variable depth from both shaders.</p>
<p>Depending on your system, you may have acces to floating point textures through <a href="http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_texture_float.txt">GL_ARB_texture_float</a>. Two very nice things about that extension. First, floating point textures are not clamped by the GL. This means that messing around with the normals can be avoided. Second, we are no longer limited to 8 bits per channel. We now have access to 16 or 32 bits per channel which will reduce or remove banding issues completly.</p>
<p>Now what do our shaders look like? The vertex shader:</p>
<p><code lang="cpp">varying vec3 normal</p>
<p>void main(void) {<br />
	gl_Position = ftransform();<br />
	normal = gl_NormalMatrix * gl_Normal;<br />
}</code></p>
<p>Fragment shader:</p>
<p><code lang="cpp">varying vec3 normal;</p>
<p>void main (void) {<br />
	gl_FragColor = vec4(normalize(normal), gl_FragCoord.z);<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2006/08/depth-map-normal-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL Transforms and the Inverse Model View</title>
		<link>http://bitwiseor.com/2006/08/opengl-transforms-and-the-inverse-model-view/</link>
		<comments>http://bitwiseor.com/2006/08/opengl-transforms-and-the-inverse-model-view/#comments</comments>
		<pubDate>Mon, 14 Aug 2006 15:39:21 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/?p=36</guid>
		<description><![CDATA[Below, I mentioned that I stored the inverse modelview matrix in gl_TextureMatrix[0] . Why did I do this? Well, I needed to transform the vertices and vectors from eye space to world space. Unfortunately, OpenGL sets up the Model View matrix to transform from object space to camera space; the inverse of that would skip [...]]]></description>
			<content:encoded><![CDATA[<p>Below, I mentioned that I stored the inverse modelview matrix in <code>gl_TextureMatrix[0] </code>. Why did I do this? Well, I needed to transform the vertices and vectors from eye space to world space. Unfortunately, OpenGL sets up the Model View matrix to transform from object space to camera space; the inverse of that would skip right over world space and go straight back to object space. Solution? Once the camera transform is set up, invert it and store it in the texture matrix. This way, we can transform something to camera space (which we usually do anyway), then transform it to world space by removing the camera transform. But first, a review of all the transforms OpenGL does.</p>
<h3>Object Space to Image Space (Quick and Dirty)</h3>
<p>First, how do we move from object space to image space in OpenGL? Well, we start off with a vertex <code>V</code> in object space, simple enough. Then, some transforms are applied to the object. Let&#8217;s say it gets rotated, translated, scaled, rotated again and translated once more. Each of these transforms can be described by their own matrix, but for simplicity&#8217;s sake, we&#8217;ll say that they were all multiplied into a single matrix &#8211; <code>M</code>. So, we have <code>V</code>, a vertex in object space, and now <code>V * M</code>, a vertex in world space.</p>
<p>Next, there&#8217;s the transformation from world space to camera space. In OpenGL, camera space consists of right = +X, up = +Y, and forward = -Z. This can be done using the command <code>gluLookAt</code> with the camera&#8217;s location, point of focus and up vector. We&#8217;ll call this matrix <code>C</code>. Moving a vertex from object space to camera space is then <code>V * M * C</code>, seeing the pattern?</p>
<p>Once we are in camera space, we use the projection matrix (specified with functions like <code>glFrustum</code> and <code>gluOrtho2D</code>) to again change the coordinate space. We&#8217;ll call this matrix <code>P</code>, and the sequence <code>V * M * C * P</code> will tell us which vertexes will be clipped. Once in this space (and after the perspective divide), if x or y coordinates of the vertex are outside [-1,+1] or if the z coordinate is outside [0, +1], then the vertex is clipped.</p>
<p>So, what do we have? Taking a vertex <code>V</code> in object space, multiplying it by <code>M</code> moves it to world space, multiplying that by <code>C</code> moves it to camera space, multiplying it <code>P</code> moves it to projected space. <code>V * M * C * P</code>.</p>
<h3>Model View Matrix: Object Space to Camera Space</h3>
<p>The matrix created to move a vertex to world space is defined by the various transforms applied to that vertex in OpenGL through functions like <code>glTranslate</code>, <code>glRotate</code> and <code>glScale</code>. Loading on the transforms creates a single matrix to change to world space. It&#8217;s also worth noting that the final matrix has an inverse and it is very easy to create if you know the tranforms that were used to create it. Let&#8217;s say you translate something by 10, rotate it by 90 and scale it by 0.5. This results in a 4&#215;4 matrix where the original transforms have been muddled together to do the entire series of transforms at once. The inverse of this matrix would have to undo each of those transforms in the proper order. So the inverse can be constructed by scaling by 2.0, rotating by -90 and translating by -10. Easy as pie.</p>
<p>The camera space transform can be easily specified by the function <code><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/gluLookAt.3.html">gluLookAt</a></code>. That link contains the implementation to create the matrix for OpenGL. Here&#8217;s a sampler to see implementation using GLSL like C++ types.</p>
<pre name="code" class="cpp">
mat4 makeGluLookAt(vec3 eye, vec3 center, vec3 up)
{
	// forward pointing vector
	vec3 f(center - eye);
	f.normalize();
	up.normalize();

	// right pointing vector
	vec3 s(f.cross(up));

	// orthonormal up vector
	vec3 u(s.cross(f));

	s.normalize();
	u.normalize();

	// construct orthonormal orientation transfom
	mat4 Orient(
		s.x, s.y, s.z, 0.0f,
		u.x, u.y, u.z, 0.0f,
		-f.z, -f.y, -f.z, 0.0f,
		0.0f, 0.0f, 0.0f, 1.0f
	);

	// translate the new coordinate system to the origin
	mat4 Translate(
		1.0f, 0.0f, 0.0f, -eye.x,
		0.0f, 1.0f, 0.0f, -eye.y,
		0.0f, 0.0f, 1.0f, -eye.z,
		0.0f, 0.0f, 0.0f, 1.0f
	);

	return Orient * Translate;
}</pre>
<p>If you pay close attention to the <code>Orient</code> matrix, you&#8217;ll see that the rows represent the right, up and -forward that will correspond to +X, +Y and +Z (remember that the OpenGL camera looks down -Z). This is a standard change of orientation matrix; this will effectively rotate the world around so that the +X, +Y, and +Z axis line up with the right, up and -forward vectors of the camera. We then translate by the position of the camera to move the old origin to the camera&#8217;s origin.</p>
<p>One sticky part to note about all of this is that we have been working with row-wise matrices that are intended to be post multiplied. That is, we start with the vertex, then multiply by the transforms, then multiply by the camera matrix. But, OpenGL uses pre-multiplied matrices to achieve the same effect (that&#8217;s why you clear the model view matrix, then specify the camera, then specify the transforms and finally the vertex last). In order to end up with the same matrices in the end, OpenGL needs to use transposed matrices, or column-wise matrices. This means that our function needs to be reworked. One important point to remember: the transpose of multiplied matrices is the same as multiplying the transpose of the matrices in reverse order, ie. <code>(A * B)<sup>T</sup> = B<sup>T</sup> * A<sup>T</sup></code>. Here is the correct OpenGL Friendly code.</p>
<pre name="code" class="cpp">
mat4 makeGluLookAt(vec3 eye, vec3 center, vec3 up)
{
	vec3 f(center - eye);
	f.normalize();
	up.normalize();

	vec3 s(f.cross(up));
	vec3 u(s.cross(f));

	s.normalize();
	u.normalize();

	mat4 Orient(
		s.x, u.x, -f.x, 0.0f,
		s.y, u.y, -f.y, 0.0f,
		s.z, u.z, -f.z, 0.0f,
		0.0f, 0.0f, 0.0f, 1.0f
	);

	mat4 Translate(
		1.0f, 0.0f, 0.0f, 0.0f,
		0.0f, 1.0f, 0.0f, 0.0f,
		0.0f, 0.0f, 1.0f, 0.0f,
		-eye.x, -eye.y, -eye.z, 1.0f
	);

	return Translate * Orient;
}</pre>
<p>It is important to realize that OpenGL&#8217;s Model View matrix is actually <code>M * C</code>, so, if we want to get the position of the vertex in world space, we will have to use the modelview matrix to go to camera space, then multiply by <code>C<sup>-1</sup></code> (the inverse of the camera matrix). This gives us <code>V * M * C * C<sup>-1</sup> = V * gl_ModelViewMatrix * C<sup>-1</sup> = V * M</code>. And world space is exactly what we need to do shadow mapping, refraction, reflection and a plethora of other things. OpenGL took care of this for us with the <a href="http://blog.bitwiseor.com/gl_arb_shadow">GL_ARB_Shadow extension</a>. By using glTexGen, OpenGL computes the inverse camera matrix and applies it without us having to fuss with inverses. But, now we&#8217;ll need to do an inverse ourselves.</p>
<h4>Inverse <code>gluLookAt</code></h4>
<p>Remember that the camera matrix is given to us by <code>gluLookAt</code>, and above, we have the exact implementation of how the matrix is created. If you know your matrices, you may notice some properties that the camera matrix adheres to when being constructed this way. Normally, for a generic matrix, the inverse is a slow and painful process. You really don&#8217;t want to invert a lot of matrices in order to run your program in real time. Luckily, the camera matrix isn&#8217;t just a generic matrix, it has a specific construction with easily invertable properties.</p>
<p>If you paid attention to the construction of the <code>Orient</code> matrix, you would have seen that the columns represent an orthonormal coordinate system. That is, the vectors, <code>s</code>, <code>u</code> and <code>-f</code> are all at 90 degree angles to each other and their lengths are equal to 1. The property that this gives us is that the dot product of any two of those vectors equal 0 when the vectors are different. When the vectors are the same, the dot product is the length of the vector squared, or 1.</p>
<p>Now, imagine a matrix multiply as the dot product of two vectors, the row of the first matrix and the column of the second matrix. What we want to do is construct the inverse of <code>Orient</code> such that <code>Orient * Orient<sup>-1</sup></code> equals the identity matrix (0&#8217;s everywhere with 1&#8217;s on the diagonals), see where I&#8217;m going? As it turns out, the inverse of a matrix that represents an orthonormal coordinate system is exactly it&#8217;s transpose.</p>
<pre name="code" class="cpp">
mat4 Orient(
	s.x, u.x, -f.x, 0.0f,
	s.y, u.y, -f.y, 0.0f,
	s.z, u.z, -f.z, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f
);

mat4 OrientInverse(
	s.x, s.y, s.z, 0.0f,
	u.x, u.y, u.z, 0.0f,
	-f.x, -f.y, -f.z, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f
);</pre>
<p>But the camera matrix also contains a translation that gets multiplied to <code>Orient</code>. We know the inverse of a translation is just a negative translation, so that&#8217;s easy. So, if <code>C = Translate * Orient</code>, then <code>C<sup>-1</sup> = (Translate * Orient)<sup>-1</sup> = Orient<sup>-1</sup> * Translate<sup>-1</sup></code>. Hey, we know all those pieces! Let&#8217;s put it into OpenGL friendly code.</p>
<pre name="code" class="cpp">
mat4 makeGluLookAtInverse(vec3 eye, vec3 center, vec3 up)
{
	vec3 f(center - eye);
	f.normalize();
	up.normalize();

	vec3 s(f.cross(up));
	vec3 u(s.cross(f));

	s.normalize();
	u.normalize();

	mat4 OrientInverse(
		s.x, s.y, s.z, 0.0f,
		u.x, u.y, u.z, 0.0f,
		-f.x, -f.y, -f.z, 0.0f,
		0.0f, 0.0f, 0.0f, 1.0f
	);

	mat4 TranslateInverse(
		1.0f, 0.0f, 0.0f, 0.0f,
		0.0f, 1.0f, 0.0f, 0.0f,
		0.0f, 0.0f, 1.0f, 0.0f,
		eye.x, eye.y, eye.z, 1.0f
	);

	return OrientInverse * TranslateInverse;
}</pre>
<p>That is probably the most difficult part of doing shadow mapping and other real time techniques (once you get past all of the theory, that is). And look, it&#8217;s all wrapped up in a tiny function! Store that into a texture matrix and your shaders have quick and easy access to world space.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2006/08/opengl-transforms-and-the-inverse-model-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NVidia DualTV + nForce 2</title>
		<link>http://bitwiseor.com/2006/06/nvidia-dualtv-nforce-2/</link>
		<comments>http://bitwiseor.com/2006/06/nvidia-dualtv-nforce-2/#comments</comments>
		<pubDate>Tue, 06 Jun 2006 16:32:07 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/34/</guid>
		<description><![CDATA[Oi, what a pain. NVidia&#8217;s DualTV Tuner does not like to play well with the latest nForce 2 drivers. Random restarts occur when trying to use it. Solution: Use the latest DualTV drivers and roll back to version 4.27 of the nForce 2 drivers.
]]></description>
			<content:encoded><![CDATA[<p>Oi, what a pain. NVidia&#8217;s DualTV Tuner does not like to play well with the latest nForce 2 drivers. Random restarts occur when trying to use it. Solution: Use the latest DualTV drivers and roll back to version 4.27 of the nForce 2 drivers.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2006/06/nvidia-dualtv-nforce-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Website</title>
		<link>http://bitwiseor.com/2006/01/php-website/</link>
		<comments>http://bitwiseor.com/2006/01/php-website/#comments</comments>
		<pubDate>Mon, 09 Jan 2006 17:46:32 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/25/</guid>
		<description><![CDATA[I just had to finish a huge project in a relatively short time. It was a PHP driven admin system that had to display various information to users and allow all content to be editable. There was a blog-like section and afew sections that needed to scan a directory. Users could only be added by [...]]]></description>
			<content:encoded><![CDATA[<p>I just had to finish a huge project in a relatively short time. It was a PHP driven admin system that had to display various information to users and allow all content to be editable. There was a blog-like section and afew sections that needed to scan a directory. Users could only be added by administrators and you had to login to see any of it. Quite a pain considering that I was told to give an estimate at a time where only a small portion of the work was told to me. Luckily I lied and said it take longer.</p>
<p>So, the question is, what can I conjure up to make my life easier in the future. First, a solid login system is needed. Also, a way to organise sections of the site, including subsections. Each section should provide title text, breadcrumb text, menu text, content, edit content forms, templates and so on. Finally, a site object has to tie everything together.</p>
<p>This needs to be very freeform. First, the login system. <a href="http://evolt.org/node/60384">EVolt</a> has a good rundown that I think I&#8217;ll gut and modify to my liking. In its current form, it has too much involvement with the form object. Next, I need to create  a Section class. It needs the following:</p>
<ul>
<li>Variables</li>
<ul>
<li>title_text</li>
<li>menu_text</li>
<li>breadcrumb_text</li>
<li>id</li>
<li>template</li>
<li>subsections</li>
<li>content</li>
<li>is_current</li>
<li>database</li>
</ul>
<li>Methods</li>
<ul>
<li>Section()</li>
<li>get_content()</li>
<li>add_subsection(section)</li>
<li>set_current()</li>
<li>draw()</li>
</ul>
</ul>
<p>The main Site class should be similar to Section, but act more as a wrapper and tell which section is current. That might be able to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2006/01/php-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Ray Caster</title>
		<link>http://bitwiseor.com/2005/12/javascript-ray-caster/</link>
		<comments>http://bitwiseor.com/2005/12/javascript-ray-caster/#comments</comments>
		<pubDate>Fri, 09 Dec 2005 16:48:29 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/24/</guid>
		<description><![CDATA[Using the new javacript canvas element, someone put together a simple ray caster.
]]></description>
			<content:encoded><![CDATA[<p>Using the new javacript canvas element, someone put together a simple <a href="http://developer.mozilla.org/en/docs/A_Basic_RayCaster">ray caster</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2005/12/javascript-ray-caster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GL_ARB_depth_texture</title>
		<link>http://bitwiseor.com/2005/12/gl_arb_depth_texture/</link>
		<comments>http://bitwiseor.com/2005/12/gl_arb_depth_texture/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 20:12:23 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/23/</guid>
		<description><![CDATA[OpenGL Extensions allow us to use graphics hardware without delving into many specifics. The first one we will look at is fairly easy to use and understand, and it is a requirement for other extensions that do much more interesting manipulations. GL_ARB_depth_texture allows us to create a texture from the depth component of the scene. [...]]]></description>
			<content:encoded><![CDATA[<p>OpenGL Extensions allow us to use graphics hardware without delving into many specifics. The first one we will look at is fairly easy to use and understand, and it is a requirement for other extensions that do much more interesting manipulations. <a href="http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_depth_texture.txt">GL_ARB_depth_texture</a> allows us to create a texture from the depth component of the scene. This will allow us to do shadow maps later on.</p>
<h3>Set Up</h3>
<p>In this example I will be using OglExt, but there are many different <a href="http://blog.bitwiseor.com/14/">extension managers</a> out there and all are easy to use. I like OglExt because it doesn&#8217;t require an initialization step like the OpenGL Extension Wrangler requires. I will also be using <a href="http://blog.bitwiseor.com/glwindow/">GLWindow</a> as it is an easy to use OpenGL framework. This example works just as well in GLUT or any other window manager you can find. Here is the main file that we will be working with. Each step is outlined.</p>
<p><code lang="cpp">#include "GLWindow.h"<br />
#include <gl/gl.h><br />
#include <gl/glu.h><br />
#include <gl/glaux.h><br />
#include <gl/OglExt.h></p>
<p>#define SIZE 512</p>
<p>class DepthTexture : public GLWindow<br />
{<br />
public:<br />
    GLuint texture;</p>
<p>    bool init()<br />
    {<br />
        // Check that extension is supported</p>
<p>        // Create texture<br />
        // Make texture active<br />
        // Fiddle with texture parameters</p>
<p>        // Initialize texture memory using DEPTH_TEXTURE for internal format and format</p>
<p>        return true;<br />
    }</p>
<p>    void draw()<br />
    {<br />
        // clear the depth and color buffers<br />
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br />
        glLoadIdentity();</p>
<p>        // Set viewpoint</p>
<p>        // Draw scene that we will take the depth of</p>
<p>        // Copy the current depth buffer to the texture</p>
<p>        // clear the depth and color buffers<br />
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br />
        glLoadIdentity();</p>
<p>        // Set viewpoint<br />
        // Draw a quad with the texture attached<br />
    }<br />
};</p>
<p>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)<br />
{<br />
    DepthTexture* window = new DepthTexture();</p>
<p>    // Set Window size<br />
    window->starting_width = SIZE;<br />
    window->starting_height = SIZE;<br />
    window->mainLoop(hInstance, hPrevInstance, lpCmdLine, nCmdShow);<br />
}</code></p>
<p>Read more about <a href="http://blog.bitwiseor.com/gl_arb_depth_texture/2/">GL_ARB_depth_texture</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2005/12/gl_arb_depth_texture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NVSG 2.1.0.9 Released</title>
		<link>http://bitwiseor.com/2005/12/nvsg-2109-released/</link>
		<comments>http://bitwiseor.com/2005/12/nvsg-2109-released/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 20:09:55 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/22/</guid>
		<description><![CDATA[Download it from the NVSG SDK page at NVidia&#8217;s website.
]]></description>
			<content:encoded><![CDATA[<p>Download it from the <a href="http://developer.nvidia.com/object/nvsg_home.html">NVSG SDK page</a> at NVidia&#8217;s website.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2005/12/nvsg-2109-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NVSG Memory Manager</title>
		<link>http://bitwiseor.com/2005/11/nvsg-memory-manager/</link>
		<comments>http://bitwiseor.com/2005/11/nvsg-memory-manager/#comments</comments>
		<pubDate>Tue, 08 Nov 2005 23:13:38 +0000</pubDate>
		<dc:creator>yasunobu13</dc:creator>
				<category><![CDATA[Engine]]></category>

		<guid isPermaLink="false">http://blog.bitwiseor.com/10/</guid>
		<description><![CDATA[NVSG was built with a very comprehensive memory manager, and thread safety manager. But using these make things over complicated for the programmer using this package. Adding / removing references, creation and cloning through static class members. There must be simpler way to do this. I should look into implicit reference management and tagging.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.nvidia.com/object/nvsg_home.html">NVSG</a> was built with a very comprehensive memory manager, and thread safety manager. But using these make things over complicated for the programmer using this package. Adding / removing references, creation and cloning through static class members. There must be simpler way to do this. I should look into implicit reference management and tagging.</p>
]]></content:encoded>
			<wfw:commentRss>http://bitwiseor.com/2005/11/nvsg-memory-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
