Commits

Jason McKesson committed 8618f34

Modified tutorials to add a glDepthMask call. Adjusted documentation as well.

Comments (0)

Files changed (12)

Documents/Outline.xml

                 </listitem>
             </itemizedlist>
         </section>
+        <section>
+            <title>Many Lights</title>
+            <para>This tutorial creates a scene with multiple light sources in it.</para>
+            <para>Concepts:</para>
+            <itemizedlist>
+                <listitem>
+                    <para>How to use multiple light sources. Particularly, looping in a
+                        shader.</para>
+                </listitem>
+                <listitem>
+                    <para>Separating the effects of multiple light sources.</para>
+                </listitem>
+                <listitem>
+                    <para>Using arrays in shaders and UBOs.</para>
+                </listitem>
+            </itemizedlist>
+        </section>
     </section>
     <section>
         <title>Texturing</title>
             </itemizedlist>
         </section>
         <section>
+            <title>Many Lights, Revisited</title>
+            <para>This tutorial creates a scene with multiple light sources in it.</para>
+            <para>Concepts:</para>
+            <itemizedlist>
+                <listitem>
+                    <para>The problems with using loops in shaders.</para>
+                </listitem>
+                <listitem>
+                    <para>Multipass rendering of the lights.</para>
+                </listitem>
+                <listitem>
+                    <para>Precision problems with multipass.</para>
+                </listitem>
+            </itemizedlist>
+        </section>
+        <section>
             <title>Video Camera</title>
             <para>This tutorial involves rendering a view of one scene to a texture used in a
                 different location.</para>

Documents/Positioning/Depth Precision.ods

Binary file modified.

Documents/Positioning/Tutorial 05.xml

             <example>
                 <title>Depth Buffer Setup</title>
                 <programlisting>glEnable(GL_DEPTH_TEST);
+glDepthMask(GL_TRUE);
 glDepthFunc(GL_LEQUAL);
 glDepthRange(0.0f, 1.0f);</programlisting>
             </example>
                     <literal>GL_LESS</literal>. This allows for the use of multipass algorithms,
                 where you render the same geometry with the same vertex shader, but linked with a
                 different fragment shader. We'll look at those much, much later.</para>
+            <para>The call to <function>glDepthMask</function> causes rendering to write the depth
+                value from the fragment to the depth buffer. The activation of depth testing alone
+                does not cause this. Because of that, it is possible to have depth testing for
+                objects where their <emphasis>own</emphasis> depth (the incoming fragment's depth)
+                is not written to the depth buffer.</para>
             <para>There is one more issue. We know what the depth value is in the depth buffer after
                 a fragment is written to it. But what is its value before any rendering is done at
                 all? Depth buffers and color buffers are very similar; color buffers get their
                     </glossdef>
                 </glossentry>
                 <glossentry>
+                    <glossterm>glDepthMask</glossterm>
+                    <glossdef>
+                        <para>Sets or unsets the writing of values to the depth buffer.</para>
+                    </glossdef>
+                </glossentry>
+                <glossentry>
                     <glossterm>glDepthFunc</glossterm>
                     <glossdef>
                         <para>Sets the depth comparison function for depth testing. Has no effect if

Documents/Positioning/Tutorial 06.xml

                 pushes it onto the stack. The <function>MatrixStack::Pop</function> function makes
                 the current matrix whatever the top of the stack is, and removes the top from the
                 stack. The effect of these is to allow you to save a matrix, modify the current
-                matrix, and then restore the old one after you have finished with the modified one.
-                This is invaluable when dealing with a hierarchical model, as it allows you to
-                iterate over each element in the model from root to the leaf nodes, preserving older
-                transforms and recovering them as needed.</para>
+                matrix, and then restore the old one after you have finished using the modified one.
+                And you can store an arbitrary number of matrices, all in a specific order. This is
+                invaluable when dealing with a hierarchical model, as it allows you to iterate over
+                each element in the model from root to the leaf nodes, preserving older transforms
+                and recovering them as needed.</para>
             <para>In the <function>Draw</function> code, the translation is applied to the stack
                 first, followed by an X rotation based on the current angle. Note that the order of
                 operations is <emphasis>backwards</emphasis> from what we said previously. That's

Tut 05 Objects in Depth/DepthBuffer.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 05 Objects in Depth/DepthClamping.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LESS);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 05 Objects in Depth/DepthFighting.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 05 Objects in Depth/VertexClipping.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LESS);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 06 Objects in Motion/Hierarchy.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 06 Objects in Motion/Rotations.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 06 Objects in Motion/Scale.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }

Tut 06 Objects in Motion/Translation.cpp

 	glFrontFace(GL_CW);
 
 	glEnable(GL_DEPTH_TEST);
+	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LEQUAL);
 	glDepthRange(0.0f, 1.0f);
 }