Roi Atalla avatar Roi Atalla committed c58c949

Fully ported Example 16.3.

Comments (0)

Files changed (47)

.idea/libraries/XPP3.xml

     <CLASSES>
       <root url="jar://$PROJECT_DIR$/files/xpp3.jar!/" />
     </CLASSES>
-    <JAVADOC />
+    <JAVADOC>
+      <root url="jar://$PROJECT_DIR$/files/XPP3-javadoc.zip!/" />
+    </JAVADOC>
     <SOURCES />
   </library>
 </component>

.idea/workspace.xml

 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="3bd3582b-975a-4915-888d-8e2c52d85938" name="Default" comment="Moved PNGDecoder back to util.">
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.checker_gamma.dds" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.checker_linear.dds" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/Example16_2.java" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.BigPlane.xml" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.Corridor.xml" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.PT.vert" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureGamma.frag" />
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureNoGamma.frag" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Terrain_tex.dds" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/LightEnv.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/StringUtil.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.LightEnv.xml" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.LitTexture.frag" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.PNT.vert" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Terrain.xml" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.UnitSphere.xml" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.frag" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.vert" />
       <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\testdata\Test.java" afterPath="" />
       <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\testdata\test.txt" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/natives/liblwjgl.jnilib" afterPath="$PROJECT_DIR$/files/natives/liblwjgl.jnilib" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/natives/liblwjgl.so" afterPath="$PROJECT_DIR$/files/natives/liblwjgl.so" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/natives/liblwjgl64.so" afterPath="$PROJECT_DIR$/files/natives/liblwjgl64.so" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/natives/lwjgl.dll" afterPath="$PROJECT_DIR$/files/natives/lwjgl.dll" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/lwjgl.jar" afterPath="$PROJECT_DIR$/files/lwjgl.jar" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/natives/lwjgl64.dll" afterPath="$PROJECT_DIR$/files/natives/lwjgl64.dll" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/files/lwjgl_util.jar" afterPath="$PROJECT_DIR$/files/lwjgl_util.jar" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example1/Example10_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example1/Example10_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example2/Example10_2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example2/Example10_2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/Example10_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/Example10_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example1/Example11_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example1/Example11_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example2/Example11_2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example2/Example11_2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example3/Example11_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example3/Example11_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example1/Example12_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example1/Example12_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example2/Example12_2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example2/Example12_2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example3/Example12_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example3/Example12_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/Example13_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/Example13_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example2/Example13_2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example2/Example13_2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example1/Example14_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example1/Example14_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example1/Example9_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example1/Example9_1.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example2/Example9_2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example2/Example9_2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example3/Example9_3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example3/Example9_3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/GLProgram.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/GLProgram.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/util/MousePoles.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/MousePoles.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector2.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector2.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector3.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector3.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector4.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector4.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/XPP3.xml" afterPath="$PROJECT_DIR$/.idea/libraries/XPP3.xml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.BasicImpostor.vert" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.BasicImpostor.vert" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.DepthImpostor.vert" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.DepthImpostor.vert" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.PerspImpostor.vert" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.PerspImpostor.vert" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
     </list>
     <ignored path="OpenGL.iws" />
     <ignored path=".idea/workspace.xml" />
-    <file path="/a.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1366949061566" ignored="false" />
-    <file path="/fragment.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1366949602145" ignored="false" />
+    <file path="/a.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460494174" ignored="false" />
+    <file path="/fragment.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367302921023" ignored="false" />
     <file path="/a.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361850040520" ignored="false" />
     <file path="/a.html" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361850041808" ignored="false" />
     <file path="/a.groovy" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361850042481" ignored="false" />
-    <file path="/Dummy.txt" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1365373483229" ignored="false" />
+    <file path="/Dummy.txt" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460584991" ignored="false" />
     <file path="/Example12_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362027020824" ignored="false" />
     <file path="/example12.1.DiffuseSpecular.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361702005810" ignored="false" />
     <file path="/LightManager.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362461124226" ignored="false" />
-    <file path="/sample.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1366086613787" ignored="false" />
-    <file path="/Scene.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362029076804" ignored="false" />
+    <file path="/sample.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460530818" ignored="false" />
+    <file path="/Scene.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460606995" ignored="false" />
     <file path="$PROJECT_DIR$/bin/com/ra4king/opengl/arcsynthesis/gl33/chapter8/example1/example8.1.Ship.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361777249769" ignored="false" />
     <file path="$PROJECT_DIR$/bin/com/ra4king/opengl/arcsynthesis/gl33/chapter8/example2/example8.2.Ship.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361777249770" ignored="false" />
     <file path="$PROJECT_DIR$/bin/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example2/example9.2.UnitCylinder.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361777249770" ignored="false" />
     <file path="/CommonCodeStyleSettings.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361943912554" ignored="false" />
     <file path="$PROJECT_DIR$/../../../../../Downloads/Downloaded Folders/IntelliJ IDEA/java/java-impl/src/com/intellij/application/options/JavaIndentOptionsEditor.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361943925808" ignored="false" />
     <file path="/JavaIndentOptionsEditor.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361943925425" ignored="false" />
-    <file path="/a.dummy" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367044931175" ignored="false" />
+    <file path="/a.dummy" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367471450683" ignored="false" />
     <file path="$PROJECT_DIR$/../../../../../Downloads/Downloaded Folders/IntelliJ IDEA/platform/platform-resources-en/src/messages/ApplicationBundle.properties" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361942803305" ignored="false" />
     <file path="/ApplicationBundle.properties" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361942802444" ignored="false" />
     <file path="$PROJECT_DIR$/../../../../../Downloads/Downloaded Folders/IntelliJ IDEA/system/conversion/Test4fc3a780.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361942830409" ignored="false" />
     <file path="$PROJECT_DIR$/../../../../../Downloads/Downloaded Folders/IntelliJ IDEA/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaRearranger.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361947416272" ignored="false" />
     <file path="/ReformatCodeProcessor.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1361992964680" ignored="false" />
     <file path="$PROJECT_DIR$/../../../../../Downloads/Downloaded Folders/IntelliJ IDEA/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362003317321" ignored="false" />
-    <file path="/GLProgram.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362018393427" ignored="false" />
+    <file path="/GLProgram.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367456185041" ignored="false" />
     <file path="/Example8_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362018560645" ignored="false" />
-    <file path="/Mesh.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363141748335" ignored="false" />
-    <file path="/MousePoles.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362117526452" ignored="false" />
-    <file path="/Vector4.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362025150664" ignored="false" />
+    <file path="/Mesh.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367383291806" ignored="false" />
+    <file path="/MousePoles.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367471073782" ignored="false" />
+    <file path="/Vector4.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367557397510" ignored="false" />
     <file path="/WeightedLinearInterpolatorVector.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362027648518" ignored="false" />
     <file path="/ConstVelLinearInterpolatorVector.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362028161945" ignored="false" />
     <file path="/LinearInterpolatorVector.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362028248368" ignored="false" />
     <file path="/Quaternion.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362099952877" ignored="false" />
     <file path="/Utils.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364268496796" ignored="false" />
     <file path="/Matrix4.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362630104620" ignored="false" />
-    <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example3/Example9_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
-    <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example2/Example9_2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
-    <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example1/Example9_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter8/example2/Example8_2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter8/example1/Example8_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter7/example1/Example7_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="/example16.2.PT.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367045462348" ignored="false" />
     <file path="/example16.2.TextureGamma.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367045516139" ignored="false" />
     <file path="/example16.2.TextureNoGamma.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367045555615" ignored="false" />
+    <file path="/Example16_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367559306089" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/GLProgram.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367456186528" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/Graph3DViewer.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460537496" ignored="false" />
+    <file path="/Graph3DViewer.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367460444190" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/MatrixStack.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367302876195" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Vector.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Vector4.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Matrix4.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Quaternion.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Matrix3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Vector2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/com/ra4king/graph3d/math/Vector3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367213089856" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/src/META-INF/MANIFEST.MF" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367302548176" ignored="false" />
+    <file path="$PROJECT_DIR$/../Graph3D/README.txt" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367302779441" ignored="false" />
+    <file path="/MatrixStack.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367302875505" ignored="false" />
+    <file path="/LightEnv.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367559006715" ignored="false" />
+    <file path="/example13.1.LargePlane.xml" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367467214926" ignored="false" />
+    <file path="/example13.1.DepthImpostor.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367467093552" ignored="false" />
+    <file path="/example13.1.BasicImpostor.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367467156986" ignored="false" />
+    <file path="/example13.1.PerspImpostor.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367467173294" ignored="false" />
+    <file path="/StringUtil.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367469582432" ignored="false" />
+    <file path="/Example10_2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367471311286" ignored="false" />
+    <file path="/Example10_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367471350266" ignored="false" />
+    <file path="/Example9_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367471426770" ignored="false" />
+    <file path="/Vector.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367557345202" ignored="false" />
+    <file path="/Vector2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367557455152" ignored="false" />
+    <file path="/Vector3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367557499365" ignored="false" />
+    <file path="/example16.3.PNT.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367558113675" ignored="false" />
+    <file path="/example16.3.LitTexture.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367558637653" ignored="false" />
+    <file path="/example16.3.Unlit.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367558539015" ignored="false" />
+    <file path="/example16.3.Unlit.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1367558568312" ignored="false" />
     <option name="TRACKING_ENABLED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
   </component>
   <component name="DebuggerManager">
     <line_breakpoints default_suspend_policy="SuspendAll" default_condition_enabled="true" />
-    <ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
     <breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true">
       <breakpoint>
         <option name="NOTIFY_CAUGHT" value="true" />
         <option name="LOG_MESSAGE" value="&#13;&#13;JAVA" />
       </breakpoint>
     </breakpoint_any>
+    <ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
     <breakpoint_rules />
     <ui_properties />
   </component>
     <favorites_list name="OpenGL" />
   </component>
   <component name="FileEditorManager">
-    <leaf />
+    <leaf>
+      <file leaf-file-name="Example16_3.java" pinned="false" current="true" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="205" column="4" selection-start="7566" selection-end="7566" vertical-scroll-proportion="0.4247159">
+              <folding>
+                <element signature="imports" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
   </component>
   <component name="FindManager">
     <FindUsagesManager>
   <component name="IdeDocumentHistory">
     <option name="changedFiles">
       <list>
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/testdata/Test.java" />
-        <option value="$PROJECT_DIR$/src/rosick/jglsdk/glimg/DdsUtil.java" />
-        <option value="$PROJECT_DIR$/src/rosick/jglsdk/glimg/ImageCreator.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.ScreenCoords.vert" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureGamma.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureNoGamma.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Example16_1.java" />
-        <option value="$PROJECT_DIR$/src/rosick/jglsdk/glimg/TextureGenerator.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Matrix4.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Matrix3.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.PT.vert" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureGamma.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureNoGamma.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.Corridor.xml" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.BigPlane.xml" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/Example16_2.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example3/Example11_3.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example1/Example9_1.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example2/Example9_2.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter9/example3/Example9_3.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector4.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector2.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector3.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.terrain.xml" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.UnitSphere.xml" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.vert" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.frag" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.PNT.vert" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.LitTexture.frag" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/LightEnv.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java" />
       </list>
     </option>
   </component>
       <sortByType />
     </navigator>
     <panes>
-      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <PATH>
               <option name="myItemId" value="chapter16" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="example3" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
           </PATH>
           <PATH>
             <PATH_ELEMENT>
               <option name="myItemId" value="chapter16" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
-            <PATH_ELEMENT>
-              <option name="myItemId" value="example2" />
-              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
-            </PATH_ELEMENT>
           </PATH>
           <PATH>
             <PATH_ELEMENT>
       <pane id="PackagesPane">
         <subPane />
       </pane>
+      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
-    <property name="project.structure.last.edited" value="Facets" />
+    <property name="project.structure.last.edited" value="Libraries" />
     <property name="project.structure.proportion" value="0.15" />
     <property name="options.splitter.main.proportions" value="0.3" />
+    <property name="recentsLimit" value="5" />
+    <property name="MemberChooser.sorted" value="false" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeWidth1" value="285" />
-    <property name="MemberChooser.sorted" value="false" />
-    <property name="recentsLimit" value="5" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeWidth2" value="292" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/.idea/workspace.xml" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/files/XPP3-javadoc.zip!/" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeWidth0" value="296" />
     <property name="GoToClass.includeJavaFiles" value="false" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeOrder0" value="0" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatWidth2" value="293" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatWidth1" value="292" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatWidth0" value="292" />
-    <property name="options.lastSelected" value="appearance" />
+    <property name="options.lastSelected" value="reference.settingsdialog.IDE.editor.colors.Font" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder1" value="1" />
+    <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder0" value="0" />
     <property name="project.structure.side.proportion" value="0.2" />
-    <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder0" value="0" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder3" value="3" />
+    <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder2" value="2" />
     <property name="MemberChooser.copyJavadoc" value="false" />
-    <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_flatOrder2" value="2" />
     <property name="restartRequiresConfirmation" value="true" />
+    <property name="options.searchVisible" value="true" />
     <property name="dynamic.classpath" value="false" />
-    <property name="options.searchVisible" value="true" />
   </component>
   <component name="RecentsManager">
     <key name="CopyClassDialog.RECENTS_KEY">
       <recent name="com.ra4king.opengl.arcsynthesis.gl33.chapter12.example2" />
     </key>
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\files\natives" />
+      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\files" />
       <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter15" />
       <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util" />
       <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter14\example3" />
-      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter14\example1" />
-      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter13\example2" />
-    </key>
-    <key name="MoveFile.RECENT_KEYS">
-      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter16\example2" />
-      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\testdata" />
     </key>
     <key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
       <recent name="rosick.jglsdk" />
       <recent name="roFsick.jglsdk" />
       <recent name="rosick.jglsdk.glimg" />
     </key>
+    <key name="MoveFile.RECENT_KEYS">
+      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter16\example3" />
+      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\arcsynthesis\gl33\chapter16\example2" />
+      <recent name="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\testdata" />
+    </key>
   </component>
-  <component name="RunManager" selected="Application.Example16_2">
-    <configuration default="false" name="Example14_3" type="Application" factoryName="Application" temporary="true">
-      <option name="MAIN_CLASS_NAME" value="com.ra4king.opengl.arcsynthesis.gl33.chapter14.example3.Example14_3" />
-      <option name="VM_PARAMETERS" value="-Djava.library.path=files/natives/" />
-      <option name="PROGRAM_PARAMETERS" value="" />
-      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" value="" />
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
-      <option name="ENV_VARIABLES" />
-      <option name="PASS_PARENT_ENVS" value="true" />
-      <module name="OpenGL" />
-      <envs />
-      <RunnerSettings RunnerId="Debug">
-        <option name="DEBUG_PORT" value="" />
-        <option name="TRANSPORT" value="0" />
-        <option name="LOCAL" value="true" />
-      </RunnerSettings>
-      <RunnerSettings RunnerId="Run" />
-      <ConfigurationWrapper RunnerId="Debug" />
-      <ConfigurationWrapper RunnerId="Run" />
-      <method />
-    </configuration>
+  <component name="RunManager" selected="Application.Example16_3">
     <configuration default="false" name="Example16_1" type="Application" factoryName="Application" temporary="true">
       <option name="MAIN_CLASS_NAME" value="com.ra4king.opengl.arcsynthesis.gl33.chapter16.example1.Example16_1" />
       <option name="VM_PARAMETERS" value="-Djava.library.path=files/natives/" />
       <ConfigurationWrapper RunnerId="Run" />
       <method />
     </configuration>
+    <configuration default="false" name="Example16_3" type="Application" factoryName="Application" temporary="true">
+      <option name="MAIN_CLASS_NAME" value="com.ra4king.opengl.arcsynthesis.gl33.chapter16.example3.Example16_3" />
+      <option name="VM_PARAMETERS" value="-Djava.library.path=files/natives/" />
+      <option name="PROGRAM_PARAMETERS" value="" />
+      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" value="" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <option name="ENV_VARIABLES" />
+      <option name="PASS_PARENT_ENVS" value="true" />
+      <module name="OpenGL" />
+      <envs />
+      <RunnerSettings RunnerId="Debug">
+        <option name="DEBUG_PORT" value="" />
+        <option name="TRANSPORT" value="0" />
+        <option name="LOCAL" value="true" />
+      </RunnerSettings>
+      <RunnerSettings RunnerId="Run" />
+      <ConfigurationWrapper RunnerId="Debug" />
+      <ConfigurationWrapper RunnerId="Run" />
+      <method />
+    </configuration>
     <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
       <module name="" />
       <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
       <option name="PROGRAM_PARAMETERS" />
       <method />
     </configuration>
+    <configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
+      <module name="" />
+      <option name="TESTING_TYPE" value="0" />
+      <option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="PACKAGE_NAME" value="" />
+      <option name="TARGET_SELECTION_MODE" value="EMULATOR" />
+      <option name="PREFERRED_AVD" value="" />
+      <option name="USE_COMMAND_LINE" value="true" />
+      <option name="COMMAND_LINE" value="" />
+      <option name="WIPE_USER_DATA" value="false" />
+      <option name="DISABLE_BOOT_ANIMATION" value="false" />
+      <option name="NETWORK_SPEED" value="full" />
+      <option name="NETWORK_LATENCY" value="none" />
+      <option name="CLEAR_LOGCAT" value="false" />
+      <method />
+    </configuration>
     <configuration default="true" type="MavenRunConfiguration" factoryName="Maven">
       <MavenSettings>
         <option name="myGeneralSettings" />
       </MavenSettings>
       <method />
     </configuration>
-    <configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
-      <module name="" />
-      <option name="TESTING_TYPE" value="0" />
-      <option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="CLASS_NAME" value="" />
-      <option name="PACKAGE_NAME" value="" />
-      <option name="TARGET_SELECTION_MODE" value="EMULATOR" />
-      <option name="PREFERRED_AVD" value="" />
-      <option name="USE_COMMAND_LINE" value="true" />
-      <option name="COMMAND_LINE" value="" />
-      <option name="WIPE_USER_DATA" value="false" />
-      <option name="DISABLE_BOOT_ANIMATION" value="false" />
-      <option name="NETWORK_SPEED" value="full" />
-      <option name="NETWORK_LATENCY" value="none" />
-      <option name="CLEAR_LOGCAT" value="false" />
-      <method />
-    </configuration>
     <configuration default="true" type="Remote" factoryName="Remote">
       <option name="USE_SOCKET_TRANSPORT" value="true" />
       <option name="SERVER_MODE" value="false" />
       <option name="PORT" value="5005" />
       <method />
     </configuration>
-    <configuration default="true" type="Applet" factoryName="Applet">
-      <module name="" />
-      <option name="MAIN_CLASS_NAME" />
-      <option name="HTML_FILE_NAME" />
-      <option name="HTML_USED" value="false" />
-      <option name="WIDTH" value="400" />
-      <option name="HEIGHT" value="300" />
-      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
-      <option name="VM_PARAMETERS" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-      <method />
-    </configuration>
     <configuration default="true" type="TestNG" factoryName="TestNG">
       <module name="" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
       <listeners />
       <method />
     </configuration>
+    <configuration default="true" type="Applet" factoryName="Applet">
+      <module name="" />
+      <option name="MAIN_CLASS_NAME" />
+      <option name="HTML_FILE_NAME" />
+      <option name="HTML_USED" value="false" />
+      <option name="WIDTH" value="400" />
+      <option name="HEIGHT" value="300" />
+      <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+      <option name="VM_PARAMETERS" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <method />
+    </configuration>
     <configuration default="true" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="" />
       <option name="VM_PARAMETERS" value="-Djava.library.path=files/natives/" />
       <item index="2" class="java.lang.String" itemvalue="Application.Example12_3" />
       <item index="3" class="java.lang.String" itemvalue="Application.Example13_1" />
       <item index="4" class="java.lang.String" itemvalue="Application.Example13_2" />
-      <item index="5" class="java.lang.String" itemvalue="Application.Example14_3" />
-      <item index="6" class="java.lang.String" itemvalue="Application.Example16_1" />
-      <item index="7" class="java.lang.String" itemvalue="Application.Example16_2" />
-      <item index="8" class="java.lang.String" itemvalue="Application.Example2_1" />
-      <item index="9" class="java.lang.String" itemvalue="Application.Example2_3" />
+      <item index="5" class="java.lang.String" itemvalue="Application.Example16_1" />
+      <item index="6" class="java.lang.String" itemvalue="Application.Example16_2" />
+      <item index="7" class="java.lang.String" itemvalue="Application.Example2_1" />
+      <item index="8" class="java.lang.String" itemvalue="Application.Example2_3" />
+      <item index="9" class="java.lang.String" itemvalue="Application.Example16_3" />
     </list>
     <recent_temporary>
       <list size="5">
-        <item index="0" class="java.lang.String" itemvalue="Application.Example16_2" />
-        <item index="1" class="java.lang.String" itemvalue="Application.Example16_1" />
-        <item index="2" class="java.lang.String" itemvalue="Application.Example2_3" />
-        <item index="3" class="java.lang.String" itemvalue="Application.Example2_1" />
-        <item index="4" class="java.lang.String" itemvalue="Application.Example14_3" />
+        <item index="0" class="java.lang.String" itemvalue="Application.Example16_3" />
+        <item index="1" class="java.lang.String" itemvalue="Application.Example16_2" />
+        <item index="2" class="java.lang.String" itemvalue="Application.Example16_1" />
+        <item index="3" class="java.lang.String" itemvalue="Application.Example2_3" />
+        <item index="4" class="java.lang.String" itemvalue="Application.Example2_1" />
       </list>
     </recent_temporary>
     <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
       <created>1364718928997</created>
       <updated>1364718928997</updated>
     </task>
-    <option name="localTasksCounter" value="30" />
+    <task id="LOCAL-00030" summary="Fully ported Example 16.2.">
+      <created>1367045813067</created>
+      <updated>1367045813067</updated>
+    </task>
+    <option name="localTasksCounter" value="31" />
     <servers />
   </component>
   <component name="TodoView" selected-index="4">
     <frame x="1912" y="-8" width="1936" height="1096" extended-state="6" />
     <editor active="false" />
     <layout>
-      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.23987207" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.23878787" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
       <window_info id="JetGradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977587" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.34754798" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2707889" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
-      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29530916" sideWeight="0.51387405" order="8" side_tool="true" content_ui="tabs" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.67803836" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.40405118" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29333332" sideWeight="0.51387405" order="8" side_tool="true" content_ui="tabs" />
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.18366013" sideWeight="0.14915694" order="2" side_tool="true" content_ui="tabs" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29104477" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
       <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32822478" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.18366013" sideWeight="0.17250325" order="1" side_tool="true" content_ui="tabs" />
       <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977587" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.36819637" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
-      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20971185" sideWeight="0.75692964" order="0" side_tool="true" content_ui="combo" x="2394" y="136" width="397" height="768" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24307036" sideWeight="0.4823906" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2113127" sideWeight="0.7782516" order="0" side_tool="true" content_ui="combo" x="2394" y="136" width="397" height="768" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2217484" sideWeight="0.4823906" order="2" side_tool="false" content_ui="tabs" />
       <window_info id="Documentation" active="true" anchor="right" auto_hide="false" internal_type="SLIDING" type="FLOATING" visible="true" weight="0.32977587" sideWeight="0.80490404" order="3" side_tool="false" content_ui="combo" x="2005" y="108" width="1736" height="896" />
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
       <window_info id="Problems" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32978722" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
     <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="false" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
     <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Moved PNGDecoder back to util." />
+    <option name="LAST_COMMIT_MESSAGE" value="Fully ported Example 16.2." />
     <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
     <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
     <option name="UPDATE_FILTER_BY_SCOPE" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-    <MESSAGE value="Workspace.xml being weird." />
     <MESSAGE value="Silly typo." />
     <MESSAGE value="*HUGE* error in my Matrix4.toQuaternion class that caused  buggy 3D movement in Example12.1. Also, completely reformat with Eclipse Formatter plugin for IDEA." />
     <MESSAGE value="Example 12.2 fully ported." />
     <MESSAGE value="Fully ported Example 16.1. Also moved the 'dds' classes to their original packaging for better credit to author." />
     <MESSAGE value="Forgot to add files." />
     <MESSAGE value="Moved PNGDecoder back to util." />
+    <MESSAGE value="Fully ported Example 16.2." />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
     <option name="FILTER_TARGETS" value="false" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb5/chapter2/example2/example2.2.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="5" column="0" selection-start="67" selection-end="67" vertical-scroll-proportion="0.10504202" />
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb5/chapter2/example1/example2.1.vert">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb5/chapter2/example3/Example2_3.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="81" column="4" selection-start="2036" selection-end="2036" vertical-scroll-proportion="0.6302521" />
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb5/chapter2/example3/example2.3.vert">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureNoGamma.frag">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="12" column="0" selection-start="157" selection-end="157" vertical-scroll-proportion="0.19736843">
+        <state line="23" column="0" selection-start="263" selection-end="263" vertical-scroll-proportion="0.43178973">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureGamma.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector4.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="14" column="0" selection-start="216" selection-end="216" vertical-scroll-proportion="0.23026316">
+        <state line="199" column="4" selection-start="3203" selection-end="3203" vertical-scroll-proportion="0.58698374">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.ScreenCoords.vert">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector2.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="19" column="0" selection-start="293" selection-end="293" vertical-scroll-proportion="0.3125">
+        <state line="158" column="4" selection-start="2334" selection-end="2334" vertical-scroll-proportion="0.68085104">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Example16_1.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector3.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="106" column="8" selection-start="3364" selection-end="3364" vertical-scroll-proportion="0.5263158">
+        <state line="180" column="4" selection-start="2863" selection-end="2863" vertical-scroll-proportion="0.6433041">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.UnitSphere.xml">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="225" column="8" selection-start="7412" selection-end="7634" vertical-scroll-proportion="0.5427632">
+        <state line="415" column="7" selection-start="20282" selection-end="20282" vertical-scroll-proportion="0.96245307">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.PT.vert">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.vert">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="21" column="0" selection-start="345" selection-end="345" vertical-scroll-proportion="0.34539473">
+        <state line="17" column="0" selection-start="260" selection-end="260" vertical-scroll-proportion="0.31914893">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureGamma.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Unlit.frag">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="14" column="0" selection-start="216" selection-end="216" vertical-scroll-proportion="0.23026316">
+        <state line="8" column="30" selection-start="105" selection-end="105" vertical-scroll-proportion="0.15018773">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.TextureNoGamma.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.Terrain.xml">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="12" column="0" selection-start="157" selection-end="157" vertical-scroll-proportion="0.19736843">
+        <state line="51634" column="0" selection-start="1151490" selection-end="1151490" vertical-scroll-proportion="0.0">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/Mesh.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.PNT.vert">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="43" column="0" selection-start="1006" selection-end="1006" vertical-scroll-proportion="0.0">
+        <state line="11" column="0" selection-start="234" selection-end="234" vertical-scroll-proportion="0.234375">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.Corridor.xml">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.LitTexture.frag">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="58" column="0" selection-start="828" selection-end="828" vertical-scroll-proportion="0.8684211">
+        <state line="23" column="0" selection-start="324" selection-end="324" vertical-scroll-proportion="0.4900568">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/example16.2.BigPlane.xml">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/DdsLoader.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="38" column="0" selection-start="659" selection-end="659" vertical-scroll-proportion="0.8333333">
+        <state line="22" column="8" selection-start="732" selection-end="732" vertical-scroll-proportion="0.2556818">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example2/Example16_2.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/GLProgram.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="90" column="8" selection-start="2585" selection-end="2585" vertical-scroll-proportion="0.68421054">
+        <state line="105" column="12" selection-start="2065" selection-end="2065" vertical-scroll-proportion="0.3536932">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/example16.3.LightEnv.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="38" column="12" selection-start="1776" selection-end="1776" vertical-scroll-proportion="0.5738636">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/LightEnv.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="362" column="12" selection-start="11726" selection-end="11726" vertical-scroll-proportion="0.765625">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/MousePoles.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="514" column="8" selection-start="13364" selection-end="13364" vertical-scroll-proportion="0.28977272">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="205" column="4" selection-start="7566" selection-end="7566" vertical-scroll-proportion="0.4247159">
           <folding>
             <element signature="imports" expanded="true" />
           </folding>

Binary file modified.

Binary file modified.

Add a comment to this file

files/natives/liblwjgl.jnilib

Binary file modified.

Add a comment to this file

files/natives/liblwjgl.so

Binary file modified.

Add a comment to this file

files/natives/liblwjgl64.so

Binary file modified.

Add a comment to this file

files/natives/lwjgl.dll

Binary file modified.

Add a comment to this file

files/natives/lwjgl64.dll

Binary file modified.

src/com/ra4king/opengl/GLProgram.java

 	}
 	
 	public final void run(boolean core) {
+		run(core, new PixelFormat());
+	}
+	
+	public final void run(boolean core, PixelFormat format) {
 		try {
-			Display.create(new PixelFormat(), core ? new ContextAttribs(3, 3) : new ContextAttribs());
+			Display.create(format, core ? new ContextAttribs(3, 3).withProfileCore(true) : new ContextAttribs());
 		} catch(Exception exc) {
 			exc.printStackTrace();
 			System.exit(1);

src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example1/Example10_1.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		whiteDiffuseColor = loadLitShader("example10.1.VertexLighting_PN.vert", "example10.1.frag");
 		vertexDiffuseColor = loadLitShader("example10.1.VertexLighting_PCN.vert", "example10.1.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example2/Example10_2.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		whiteDiffuseColor = loadLitShader("example10.2.VertexLighting_PN.vert", "example10.2.frag");
 		vertexDiffuseColor = loadLitShader("example10.2.VertexLighting_PCN.vert", "example10.2.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/Example10_3.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		fragWhiteDiffuseColor = loadLitShader("example10.3.FragLightAtten_PN.vert", "example10.3.FragLightAtten.frag");
 		fragVertexDiffuseColor = loadLitShader("example10.3.FragLightAtten_PCN.vert", "example10.3.FragLightAtten.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example1/Example11_1.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		whiteNoPhong = loadLitProgram("example11.1.PN.vert", "example11.1.NoPhong.frag");
 		colorNoPhong = loadLitProgram("example11.1.PCN.vert", "example11.1.NoPhong.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example2/Example11_2.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		for(int a = 0; a < shaderFiles.length; a++)
 			programs[a] = new ProgramPair(loadLitProgram("example11.2." + shaderFiles[a].whiteVertexShader, "example11.2." + shaderFiles[a].fragmentShader),

src/com/ra4king/opengl/arcsynthesis/gl33/chapter11/example3/Example11_3.java

 		glClearColor(0, 0, 0, 0);
 		glClearDepth(1);
 		
-		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
+		ViewData viewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
 		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
-		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
+		ObjectData objectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
-		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		objectPole = new ObjectPole(objectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		for(int a = 0; a < shaderFiles.length; a++)
 			programs[a] = new ProgramPair(loadLitProgram("example11.3." + shaderFiles[a].whiteVertexShader, "example11.3." + shaderFiles[a].fragmentShader),

src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example1/Example12_1.java

 		ViewData viewData = new ViewData(new Vector3(-59.5f, 44, 95), new Quaternion(0.3826834f, 0.0f, 0.0f, 0.92387953f), 50, 0);
 		ViewScale viewScale = new ViewScale(3, 80, 4, 1, 5, 1, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		
 		String[] vertexShaders = { "PCN", "PCN", "PN", "PN" };
 		String[] fragmentShaders = { "DiffuseSpecular", "DiffuseOnly", "DiffuseSpecularMtl", "DiffuseOnlyMtl" };

src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example2/Example12_2.java

 		ViewData viewData = new ViewData(new Vector3(-59.5f, 44, 95), new Quaternion(0.3826834f, 0.0f, 0.0f, 0.92387953f), 50, 0);
 		ViewScale viewScale = new ViewScale(3, 80, 4, 1, 5, 1, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		
 		String[] vertexShaders = { "PCN", "PCN", "PN", "PN" };
 		String[] fragmentShaders = { "DiffuseSpecularHDR", "DiffuseOnlyHDR", "DiffuseSpecularMtlHDR", "DiffuseOnlyMtlHDR" };

src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example3/Example12_3.java

 		ViewData viewData = new ViewData(new Vector3(-59.5f, 44, 95), new Quaternion(0.3826834f, 0.0f, 0.0f, 0.92387953f), 50, 0);
 		ViewScale viewScale = new ViewScale(3, 80, 4, 1, 5, 1, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		
 		String[] vertexShaders = { "PCN", "PCN", "PN", "PN" };
 		String[] fragmentShaders = { "DiffuseSpecularGamma", "DiffuseOnlyGamma", "DiffuseSpecularMtlGamma", "DiffuseOnlyMtlGamma" };

src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/Example13_1.java

 		ViewData viewData = new ViewData(new Vector3(0, 30, 25), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 10, 0);
 		ViewScale viewScale = new ViewScale(3, 70, 3.5f, 1.5f, 5, 1, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		
 		litMeshProgram = loadLitMeshProgram("example13.1.PN.vert", "example13.1.Lighting.frag");
 		

src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.BasicImpostor.vert

 			mapping = vec2(1.0, 1.0);
 			offset = vec2(sphereRadius, sphereRadius);
 			break;
+		default:
+			offset = vec2(0);
+			break;
 	}
 	
 	vec4 cameraCornerPos = vec4(cameraSpherePos, 1.0);

src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.DepthImpostor.vert

 			mapping = vec2(1.0, 1.0) * g_boxCorrection;
 			offset = vec2(sphereRadius, sphereRadius);
 			break;
+		default:
+			offset = vec2(0);
+			break;
 	}
 	
 	vec4 cameraCornerPos = vec4(cameraSpherePos, 1.0);
 	cameraCornerPos.xy += offset * g_boxCorrection;
-
+	
 	gl_Position = cameraToClipMatrix * cameraCornerPos;
 }

src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example1/example13.1.PerspImpostor.vert

 	vec2 offset;
 	switch(gl_VertexID)
 	{
-	case 0:
-		mapping = vec2(-1.0, -1.0) * g_boxCorrection;
-		offset = vec2(-sphereRadius, -sphereRadius);
-		break;
-	case 1:
-		mapping = vec2(-1.0, 1.0) * g_boxCorrection;
-		offset = vec2(-sphereRadius, sphereRadius);
-		break;
-	case 2:
-		mapping = vec2(1.0, -1.0) * g_boxCorrection;
-		offset = vec2(sphereRadius, -sphereRadius);
-		break;
-	case 3:
-		mapping = vec2(1.0, 1.0) * g_boxCorrection;
-		offset = vec2(sphereRadius, sphereRadius);
-		break;
+		case 0:
+			mapping = vec2(-1.0, -1.0) * g_boxCorrection;
+			offset = vec2(-sphereRadius, -sphereRadius);
+			break;
+		case 1:
+			mapping = vec2(-1.0, 1.0) * g_boxCorrection;
+			offset = vec2(-sphereRadius, sphereRadius);
+			break;
+		case 2:
+			mapping = vec2(1.0, -1.0) * g_boxCorrection;
+			offset = vec2(sphereRadius, -sphereRadius);
+			break;
+		case 3:
+			mapping = vec2(1.0, 1.0) * g_boxCorrection;
+			offset = vec2(sphereRadius, sphereRadius);
+			break;
+		default:
+			offset = vec2(0);
+			break;
 	}
-
+	
 	vec4 cameraCornerPos = vec4(cameraSpherePos, 1.0);
 	cameraCornerPos.xy += offset * g_boxCorrection;
-
+	
 	gl_Position = cameraToClipMatrix * cameraCornerPos;
 }

src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example2/Example13_2.java

 		ViewData viewData = new ViewData(new Vector3(0, 30, 25), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 10, 0);
 		ViewScale viewScale = new ViewScale(3, 70, 3.5f, 1.5f, 5, 1, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		
 		litMeshProgram = loadLitMeshProgram("example13.2.PN.vert", "example13.2.Lighting.frag");
 		litImpProgram = loadLitImposProgram("example13.2.GeomImpostor.vert", "example13.2.GeomImpostor.geom", "example13.2.GeomImpostor.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example1/Example14_1.java

 		ViewData viewData = new ViewData(objectData.position, new Quaternion(0.3826834f, 0, 0, 0.92387953f), 10, 0);
 		ViewScale viewScale = new ViewScale(1.5f, 70, 1.5f, 0.5f, 0, 0, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		objectPole = new ObjectPole(objectData, 90 / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		litShaderProgram = loadStandardProgram("example14.1.PN.vert", "example14.1.ShaderGaussian.frag");

src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java

 		ViewData viewData = new ViewData(objectData.position, new Quaternion(0.3826834f, 0, 0, 0.92387953f), 10, 0);
 		ViewScale viewScale = new ViewScale(1.5f, 70, 1.5f, 0.5f, 0, 0, 90 / 250f);
 		
-		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON, false);
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
 		objectPole = new ObjectPole(objectData, 90 / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		for(int a = 0; a < shaderPairs.length; a++)

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/Example16_3.java

 package com.ra4king.opengl.arcsynthesis.gl33.chapter16.example3;
 
+import static org.lwjgl.opengl.EXTTextureFilterAnisotropic.*;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL12.*;
+import static org.lwjgl.opengl.GL13.*;
+import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
+import static org.lwjgl.opengl.GL21.*;
+import static org.lwjgl.opengl.GL30.*;
+import static org.lwjgl.opengl.GL31.*;
+import static org.lwjgl.opengl.GL32.*;
+import static org.lwjgl.opengl.GL33.*;
+
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.PixelFormat;
+
+import rosick.jglsdk.glimg.DdsLoader;
+import rosick.jglsdk.glimg.ImageSet;
+import rosick.jglsdk.glimg.ImageSet.Dimensions;
+import rosick.jglsdk.glimg.ImageSet.SingleImage;
+import rosick.jglsdk.glimg.TextureGenerator;
+import rosick.jglsdk.glimg.TextureGenerator.OpenGLPixelTransferParams;
+
+import com.ra4king.opengl.GLProgram;
+import com.ra4king.opengl.arcsynthesis.gl33.chapter16.example3.LightEnv.LightBlock;
+import com.ra4king.opengl.util.Mesh;
+import com.ra4king.opengl.util.MousePoles.MouseButton;
+import com.ra4king.opengl.util.MousePoles.ViewData;
+import com.ra4king.opengl.util.MousePoles.ViewPole;
+import com.ra4king.opengl.util.MousePoles.ViewScale;
+import com.ra4king.opengl.util.ShaderProgram;
+import com.ra4king.opengl.util.Utils;
+import com.ra4king.opengl.util.math.Matrix4;
+import com.ra4king.opengl.util.math.MatrixStack;
+import com.ra4king.opengl.util.math.Quaternion;
+import com.ra4king.opengl.util.math.Vector3;
+import com.ra4king.opengl.util.math.Vector4;
+
 /**
  * @author ra4king
  */
-public class Example16_3 {}
+public class Example16_3 extends GLProgram {
+	public static void main(String[] args) {
+		new Example16_3().run(true, new PixelFormat().withSRGB(true));
+	}
+	
+	private ProgramData standard;
+	private UnlitProgramData unlit;
+	
+	private Mesh terrain;
+	private Mesh sphere;
+	
+	private ViewPole viewPole;
+	
+	private LightEnv lightEnv;
+	
+	private int projectionUniformBuffer;
+	private int lightUniformBuffer;
+	private int linearTexture;
+	
+	private final int NUM_SAMPLERS = 2;
+	private int[] samplers = new int[NUM_SAMPLERS];
+	
+	private int currSampler = 0;
+	
+	private boolean drawCameraPos, useGammaDisplay = true;
+	
+	private final int projectionBlockIndex = 0;
+	private final int lightBlockIndex = 1;
+	private final int colorTexUnit = 2;
+	
+	public Example16_3() {
+		super("Example 16.3 - Gamma Landscape", 800, 600, true);
+	}
+	
+	@Override
+	public void init() {
+		glClearDepth(1);
+		
+		ViewData viewData = new ViewData(new Vector3(-60.257084f, 10.947238f, 62.636356f), new Quaternion(-0.099283f, -0.211198f, -0.020028f, -0.972817f), 30, 0);
+		ViewScale viewScale = new ViewScale(5, 90, 2, 0.5f, 4, 1, 90f / 250f);
+		
+		viewPole = new ViewPole(viewData, viewScale, MouseButton.LEFT_BUTTON);
+		
+		try {
+			lightEnv = new LightEnv(getClass().getResource("example16.3.LightEnv.xml"));
+			
+			terrain = new Mesh(getClass().getResource("example16.3.Terrain.xml"));
+			sphere = new Mesh(getClass().getResource("example16.3.UnitSphere.xml"));
+		} catch(Exception exc) {
+			exc.printStackTrace();
+			destroy();
+		}
+		
+		standard = loadProgram("example16.3.PNT.vert", "example16.3.LitTexture.frag");
+		unlit = loadUnlitProgram("example16.3.Unlit.vert", "example16.3.Unlit.frag");
+		
+		glEnable(GL_CULL_FACE);
+		glCullFace(GL_BACK);
+		glFrontFace(GL_CW);
+		
+		glEnable(GL_DEPTH_TEST);
+		glDepthMask(true);
+		glDepthFunc(GL_LEQUAL);
+		glDepthRange(0, 1);
+		glEnable(GL_DEPTH_CLAMP);
+		
+		projectionUniformBuffer = glGenBuffers();
+		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
+		glBufferData(GL_UNIFORM_BUFFER, 16 * 4, GL_DYNAMIC_DRAW);
+		
+		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16 * 4);
+		
+		lightUniformBuffer = glGenBuffers();
+		glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
+		glBufferData(GL_UNIFORM_BUFFER, LightBlock.SIZE, GL_STREAM_DRAW);
+		
+		glBindBufferRange(GL_UNIFORM_BUFFER, lightBlockIndex, lightUniformBuffer, 0, LightBlock.SIZE);
+		
+		glBindBuffer(GL_UNIFORM_BUFFER, 0);
+		
+		loadTextures();
+		createSamplers();
+	}
+	
+	private ProgramData loadProgram(String vertexShader, String fragmentShader) {
+		ProgramData data = new ProgramData(new ShaderProgram(readFromFile(vertexShader), readFromFile(fragmentShader)));
+		data.modelToCameraMatrixUniform = glGetUniformLocation(data.program.getProgram(), "modelToCameraMatrix");
+		data.numberOfLightsUniform = glGetUniformLocation(data.program.getProgram(), "numberOfLights");
+		
+		int projectionBlock = glGetUniformBlockIndex(data.program.getProgram(), "Projection");
+		glUniformBlockBinding(data.program.getProgram(), projectionBlock, projectionBlockIndex);
+		
+		int lightBlock = glGetUniformBlockIndex(data.program.getProgram(), "Light");
+		glUniformBlockBinding(data.program.getProgram(), lightBlock, lightBlockIndex);
+		
+		int colorTextureUniform = glGetUniformLocation(data.program.getProgram(), "diffuseColorTex");
+		data.program.begin();
+		glUniform1i(colorTextureUniform, colorTexUnit);
+		data.program.end();
+		
+		return data;
+	}
+	
+	private UnlitProgramData loadUnlitProgram(String vertexShader, String fragmentShader) {
+		UnlitProgramData data = new UnlitProgramData(new ShaderProgram(readFromFile(vertexShader), readFromFile(fragmentShader)));
+		data.modelToCameraMatrixUniform = glGetUniformLocation(data.program.getProgram(), "modelToCameraMatrix");
+		data.objectColorUniform = glGetUniformLocation(data.program.getProgram(), "objectColor");
+		
+		int projectionBlock = glGetUniformBlockIndex(data.program.getProgram(), "Projection");
+		glUniformBlockBinding(data.program.getProgram(), projectionBlock, projectionBlockIndex);
+		
+		return data;
+	}
+	
+	private void loadTextures() {
+		try {
+			ImageSet imageSet = DdsLoader.load(getClass().getResourceAsStream("example16.3.Terrain_tex.dds"));
+			
+			linearTexture = glGenTextures();
+			glBindTexture(GL_TEXTURE_2D, linearTexture);
+			
+			OpenGLPixelTransferParams xfer = TextureGenerator.getUploadFormatType(imageSet.getFormat(), 0);
+			
+			for(int mipmapLevel = 0; mipmapLevel < imageSet.getMipmapCount(); mipmapLevel++) {
+				SingleImage image = imageSet.getImage(mipmapLevel, 0, 0);
+				Dimensions dims = image.getDimensions();
+				
+				glTexImage2D(GL_TEXTURE_2D, mipmapLevel, GL_SRGB8_ALPHA8, dims.width, dims.height, 0, xfer.format, xfer.type, image.getImageData());
+			}
+			
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, imageSet.getMipmapCount() - 1);
+		} catch(Exception exc) {
+			exc.printStackTrace();
+			destroy();
+		}
+	}
+	
+	private void createSamplers() {
+		for(int a = 0; a < samplers.length; a++) {
+			samplers[a] = glGenSamplers();
+			
+			glSamplerParameteri(samplers[a], GL_TEXTURE_WRAP_S, GL_REPEAT);
+			glSamplerParameteri(samplers[a], GL_TEXTURE_WRAP_T, GL_REPEAT);
+		}
+		
+		glSamplerParameteri(samplers[0], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		glSamplerParameteri(samplers[0], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+		
+		float maxAniso = glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+		glSamplerParameteri(samplers[1], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+		glSamplerParameteri(samplers[1], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+		glSamplerParameterf(samplers[1], GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAniso);
+	}
+	
+	@Override
+	public void resized() {
+		super.resized();
+		
+		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
+		glBufferSubData(GL_UNIFORM_BUFFER, 0, new Matrix4().clearToPerspectiveDeg(60, getWidth(), getHeight(), 1, 1000).toBuffer());
+		glBindBuffer(GL_UNIFORM_BUFFER, 0);
+	}
+	
+	@Override
+	public void update(long deltaTime) {
+		Utils.updateMousePoles(viewPole, null);
+		
+		lightEnv.updateTime(deltaTime);
+		
+		viewPole.charPress(deltaTime);
+	}
+	
+	@Override
+	public void keyPressed(int key, char c) {
+		switch(key) {
+			case Keyboard.KEY_SPACE:
+				useGammaDisplay = !useGammaDisplay;
+				break;
+			case Keyboard.KEY_MINUS:
+				lightEnv.rewindTime(1);
+				break;
+			case Keyboard.KEY_EQUALS:
+				lightEnv.fastForwardTime(1);
+				break;
+			case Keyboard.KEY_T:
+				drawCameraPos = !drawCameraPos;
+				break;
+			case Keyboard.KEY_P:
+				lightEnv.togglePause();
+				break;
+		}
+		
+		if(c >= '1' && c <= '9') {
+			int number = c - '1';
+			if(number < NUM_SAMPLERS)
+				currSampler = number;
+		}
+	}
+	
+	@Override
+	public void render() {
+		if(useGammaDisplay)
+			glEnable(GL_FRAMEBUFFER_SRGB);
+		else
+			glDisable(GL_FRAMEBUFFER_SRGB);
+		
+		Vector4 bgColor = lightEnv.getBackgroundColor();
+		glClearColor(bgColor.x(), bgColor.y(), bgColor.z(), bgColor.w());
+		
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+		
+		MatrixStack modelMatrix = new MatrixStack();
+		modelMatrix.setTop(viewPole.calcMatrix());
+		
+		LightBlock lightData = lightEnv.getLightBlock(modelMatrix.getTop());
+		
+		glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
+		glBufferData(GL_UNIFORM_BUFFER, lightData.toBuffer(), GL_STREAM_DRAW);
+		glBindBuffer(GL_UNIFORM_BUFFER, 0);
+		
+		modelMatrix.pushMatrix();
+		modelMatrix.getTop().rotateDeg(-90, 1, 0, 0);
+		
+		standard.program.begin();
+		glUniformMatrix4(standard.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+		glUniform1i(standard.numberOfLightsUniform, lightEnv.getNumLights());
+		
+		glActiveTexture(GL_TEXTURE0 + colorTexUnit);
+		glBindTexture(GL_TEXTURE_2D, linearTexture);
+		glBindSampler(colorTexUnit, samplers[currSampler]);
+		
+		terrain.render("lit-tex");
+		
+		glBindSampler(colorTexUnit, 0);
+		glBindTexture(GL_TEXTURE_2D, 0);
+		standard.program.end();
+		modelMatrix.popMatrix();
+		
+		{
+			modelMatrix.pushMatrix();
+			
+			Vector3 sunlightDir = new Vector3(lightEnv.getSunlightDirection());
+			modelMatrix.getTop().translate(sunlightDir.mult(500));
+			modelMatrix.getTop().scale(30, 30, 30);
+			
+			unlit.program.begin();
+			glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+			glUniform4(unlit.objectColorUniform, lightEnv.getSunlightScaledIntensity().toBuffer());
+			sphere.render("flat");
+			unlit.program.end();
+			
+			modelMatrix.popMatrix();
+		}
+		
+		for(int light = 0; light < lightEnv.getNumPointLights(); light++) {
+			modelMatrix.pushMatrix();
+			
+			modelMatrix.getTop().translate(lightEnv.getPointLightWorldPos(light));
+			
+			unlit.program.begin();
+			glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+			glUniform4(unlit.objectColorUniform, lightEnv.getPointLightScaledIntensity(light).toBuffer());
+			sphere.render("flat");
+			unlit.program.end();
+			
+			modelMatrix.popMatrix();
+		}
+		
+		if(drawCameraPos) {
+			modelMatrix.pushMatrix();
+			
+			modelMatrix.getTop().clearToIdentity();
+			modelMatrix.getTop().translate(0, 0, -viewPole.getView().radius);
+			
+			unlit.program.begin();
+			
+			glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+			
+			glDepthMask(false);
+			glDisable(GL_DEPTH_TEST);
+			glUniform4f(unlit.objectColorUniform, 0.25f, 0.25f, 0.25f, 1);
+			sphere.render("flat");
+			
+			glDepthMask(true);
+			glEnable(GL_DEPTH_TEST);
+			glUniform4f(unlit.objectColorUniform, 1, 1, 1, 1);
+			sphere.render("flat");
+			
+			unlit.program.end();
+			
+			modelMatrix.popMatrix();
+		}
+	}
+	
+	private static class ProgramData {
+		private ShaderProgram program;
+		
+		private int modelToCameraMatrixUniform;
+		private int numberOfLightsUniform;
+		
+		public ProgramData(ShaderProgram program) {
+			this.program = program;
+		}
+	}
+	
+	private static class UnlitProgramData {
+		private ShaderProgram program;
+		
+		private int modelToCameraMatrixUniform;
+		private int objectColorUniform;
+		
+		public UnlitProgramData(ShaderProgram program) {
+			this.program = program;
+		}
+	}
+}

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example3/LightEnv.java

+package com.ra4king.opengl.arcsynthesis.gl33.chapter16.example3;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.FloatBuffer;
+import java.util.ArrayList;
+
+import org.lwjgl.BufferUtils;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import com.ra4king.opengl.util.StringUtil;
+import com.ra4king.opengl.util.Timer;
+import com.ra4king.opengl.util.Timer.Type;
+import com.ra4king.opengl.util.interpolators.ConstVelLinearInterpolatorVector;
+import com.ra4king.opengl.util.interpolators.TimedLinearInterpolatorVector;
+import com.ra4king.opengl.util.interpolators.TimedLinearInterpolatorf;
+import com.ra4king.opengl.util.interpolators.WeightedLinearInterpolatorVector;
+import com.ra4king.opengl.util.math.Matrix4;
+import com.ra4king.opengl.util.math.Vector3;
+import com.ra4king.opengl.util.math.Vector4;
+
+/**
+ * @author ra4king
+ */
+public class LightEnv {
+	private static final int MAX_NUMBER_OF_LIGHTS = 4;
+	
+	private float lightAttenuation;
+	
+	private Timer sunTimer;
+	private TimedLinearInterpolatorVector<Vector4> ambientInterpolator;
+	private TimedLinearInterpolatorVector<Vector4> backgroundInterpolator;
+	private TimedLinearInterpolatorVector<Vector4> sunlightInterpolator;
+	private TimedLinearInterpolatorf maxIntensityInterpolator;
+	
+	private ArrayList<ConstVelLinearInterpolatorVector<Vector3>> lightPos;
+	private ArrayList<Vector4> lightIntensity;
+	private ArrayList<Timer> lightTimers;
+	
+	public LightEnv(URL url) throws Exception {
+		lightAttenuation = 40;
+		
+		try(InputStream is = url.openStream()) {
+			XmlPullParser xml = XmlPullParserFactory.newInstance().newPullParser();
+			xml.setInput(is, "UTF-8");
+			
+			xml.next();
+			
+			xml.require(XmlPullParser.START_TAG, null, "lightenv");
+			
+			try {
+				lightAttenuation = Float.parseFloat(xml.getAttributeValue(null, "atten"));
+			} catch(NumberFormatException exc) {
+				System.err.println("'atten' attribute at 'lightenv' tag is invalid value");
+				throw exc;
+			}
+			
+			lightAttenuation = 1.0f / (lightAttenuation * lightAttenuation);
+			
+			xml.nextTag();
+			xml.require(XmlPullParser.START_TAG, null, "sun");
+			
+			try {
+				sunTimer = new Timer(Type.LOOP, Float.parseFloat(xml.getAttributeValue(null, "time")));
+			} catch(NumberFormatException exc) {
+				System.err.println("'time' attribute at 'sun' tag is invalid value");
+				throw exc;
+			}
+			
+			ambientInterpolator = new TimedLinearInterpolatorVector<>();
+			sunlightInterpolator = new TimedLinearInterpolatorVector<>();
+			backgroundInterpolator = new TimedLinearInterpolatorVector<>();
+			maxIntensityInterpolator = new TimedLinearInterpolatorf();
+			
+			ArrayList<WeightedLinearInterpolatorVector<Vector4>.Data> ambient = new ArrayList<>();
+			ArrayList<WeightedLinearInterpolatorVector<Vector4>.Data> light = new ArrayList<>();
+			ArrayList<WeightedLinearInterpolatorVector<Vector4>.Data> background = new ArrayList<>();
+			ArrayList<TimedLinearInterpolatorf.Data> maxIntensity = new ArrayList<>();
+			
+			while(xml.nextTag() == XmlPullParser.START_TAG) {
+				xml.require(XmlPullParser.START_TAG, null, "key");
+				
+				float keyTime;
+				try {
+					keyTime = Float.parseFloat(xml.getAttributeValue(null, "time")) / 24f;
+				} catch(Exception exc) {
+					System.err.println("'time' attribute at 'key' tag is invalid value");
+					throw exc;
+				}
+				
+				try {
+					ambient.add(ambientInterpolator.new Data(parseVector4(xml.getAttributeValue(null, "ambient")), keyTime));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'ambient' attribute at 'key' tag is invalid value");
+					throw exc;
+				}
+				
+				try {
+					light.add(sunlightInterpolator.new Data(parseVector4(xml.getAttributeValue(null, "intensity")), keyTime));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'intensity' attribute at 'key' tag is invalid value");
+					throw exc;
+				}
+				
+				try {
+					background.add(backgroundInterpolator.new Data(parseVector4(xml.getAttributeValue(null, "background")), keyTime));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'background' attribute at 'key' tag is invalid value");
+					throw exc;
+				}
+				
+				try {
+					maxIntensity.add(maxIntensityInterpolator.new Data(Float.parseFloat(xml.getAttributeValue(null, "max-intensity")), keyTime));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'max-intensity' attribute at 'key' tag is invalid value");
+					throw exc;
+				}
+				
+				xml.nextTag();
+				xml.require(XmlPullParser.END_TAG, null, "key");
+			}
+			
+			xml.require(XmlPullParser.END_TAG, null, "sun");
+			
+			if(ambient.isEmpty())
+				throw new IllegalArgumentException("'sun' element must have at least one 'key' element child");
+			
+			ambientInterpolator.setValues(ambient);
+			sunlightInterpolator.setValues(light);
+			backgroundInterpolator.setValues(background);
+			maxIntensityInterpolator.setValues(maxIntensity);
+			
+			lightTimers = new ArrayList<>();
+			lightIntensity = new ArrayList<>();
+			
+			lightPos = new ArrayList<>();
+			
+			while(xml.nextTag() == XmlPullParser.START_TAG) {
+				xml.require(XmlPullParser.START_TAG, null, "light");
+				
+				if(lightPos.size() + 1 == MAX_NUMBER_OF_LIGHTS)
+					throw new RuntimeException("Too many lights specified.");
+				
+				try {
+					lightTimers.add(new Timer(Type.LOOP, Float.parseFloat(xml.getAttributeValue(null, "time"))));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'time' attribute in 'light' tag is invalid value");
+					throw exc;
+				}
+				
+				try {
+					lightIntensity.add(parseVector4(xml.getAttributeValue(null, "intensity")));
+				} catch(IllegalArgumentException exc) {
+					System.err.println("'intensity' attribute in 'light' tag is invalid value");
+					throw exc;
+				}
+				
+				ArrayList<Vector3> posValues = new ArrayList<>();
+				
+				while(xml.nextTag() == XmlPullParser.START_TAG && xml.getName().equals("key")) {
+					xml.next();
+					xml.require(XmlPullParser.TEXT, null, null);
+					
+					try {
+						posValues.add(parseVector3(xml.getText()));
+					} catch(IllegalArgumentException exc) {
+						System.err.println("contents of 'key' tag invalid value");
+						throw exc;
+					}
+					
+					xml.next();
+					xml.require(XmlPullParser.END_TAG, null, "key");
+				}
+				
+				if(posValues.isEmpty())
+					throw new RuntimeException("'light' elements must have at least one 'key' element child");
+				
+				ConstVelLinearInterpolatorVector<Vector3> interpolator = new ConstVelLinearInterpolatorVector<>();
+				interpolator.setValues(posValues);
+				lightPos.add(interpolator);
+				
+				xml.require(XmlPullParser.END_TAG, null, "light");
+			}
+		}
+	}
+	
+	private Vector4 parseVector4(String s) {
+		String[] comp = StringUtil.split(s, ' ');
+		if(comp.length != 4)
+			throw new IllegalArgumentException("invalid Vector4");
+		
+		Vector4 vec = new Vector4();
+		vec.x(Float.parseFloat(comp[0]));
+		vec.y(Float.parseFloat(comp[1]));
+		vec.z(Float.parseFloat(comp[2]));
+		vec.w(Float.parseFloat(comp[3]));
+		
+		return vec;
+	}
+	
+	private Vector3 parseVector3(String s) throws NumberFormatException {
+		String[] comp = StringUtil.split(s, ' ');
+		if(comp.length != 3)
+			throw new IllegalArgumentException("invalid Vector3");
+		
+		Vector3 vec = new Vector3();
+		vec.x(Float.parseFloat(comp[0]));
+		vec.y(Float.parseFloat(comp[1]));
+		vec.z(Float.parseFloat(comp[2]));
+		
+		return vec;
+	}
+	
+	public void updateTime(long deltaTime) {
+		sunTimer.update(deltaTime);
+		
+		for(Timer t : lightTimers)
+			t.update(deltaTime);
+	}
+	
+	public void togglePause() {
+		boolean isPaused = sunTimer.togglePause();
+		
+		for(Timer t : lightTimers)
+			t.setPause(isPaused);
+	}
+	
+	public void setPause() {
+		setPause(true);
+	}
+	
+	public void setPause(boolean pause) {
+		sunTimer.setPause(pause);
+		
+		for(Timer t : lightTimers)
+			t.setPause(pause);
+	}
+	
+	public boolean isPaused() {
+		return sunTimer.isPaused();
+	}
+	
+	public void rewindTime(float secRewind) {
+		sunTimer.rewind(secRewind);
+		
+		for(Timer t : lightTimers)
+			t.rewind(secRewind);
+	}
+	
+	public void fastForwardTime(float secFF) {
+		sunTimer.fastForward(secFF);
+		
+		for(Timer t : lightTimers)
+			t.fastForward(secFF);
+	}
+	
+	public Vector4 getBackgroundColor() {
+		return backgroundInterpolator.interpolate(sunTimer.getAlpha());
+	}
+	
+	public float getMaxIntensity() {
+		return maxIntensityInterpolator.interpolate(sunTimer.getAlpha());
+	}
+	
+	public Vector4 getSunlightDirection() {
+		float angle = (float)(2 * Math.PI * sunTimer.getAlpha());
+		Vector4 sunDirection = new Vector4((float)Math.sin(angle), (float)Math.cos(angle), 0, 0);
+		return new Matrix4().clearToIdentity().rotateDeg(5, 0, 1, 0).mult(sunDirection);
+	}
+	
+	public Vector4 getSunlightIntensity() {
+		return sunlightInterpolator.interpolate(sunTimer.getAlpha());
+	}
+	
+	public Vector4 getSunlightScaledIntensity() {
+		return sunlightInterpolator.interpolate(sunTimer.getAlpha()).divide(maxIntensityInterpolator.interpolate(sunTimer.getAlpha()));
+	}
+	
+	public float getElapsedTime() {
+		return sunTimer.getProgression();
+	}
+	
+	public int getNumLights() {
+		return getNumPointLights() + 1;
+	}
+	
+	public LightBlock getLightBlock(Matrix4 worldToCamera) {
+		LightBlock lightData = new LightBlock(ambientInterpolator.interpolate(sunTimer.getAlpha()), lightAttenuation, maxIntensityInterpolator.interpolate(sunTimer.getAlpha()));
+		lightData.lights[0] = new PerLight(worldToCamera.mult(getSunlightDirection()), sunlightInterpolator.interpolate(sunTimer.getAlpha()));
+		
+		for(int light = 0; light < lightPos.size(); light++)
+			lightData.lights[light + 1] = new PerLight(worldToCamera.mult(new Vector4(getPointLightWorldPos(light), 1)), lightIntensity.get(light).copy());
+		
+		return lightData;
+	}
+	
+	public int getNumPointLights() {
+		return lightPos.size();
+	}
+	
+	public Vector4 getPointLightIntensity(int pointLightIdx) {
+		return lightIntensity.get(pointLightIdx).copy();
+	}
+	
+	public Vector4 getPointLightScaledIntensity(int pointLightIdx) {
+		return lightIntensity.get(pointLightIdx).copy().divide(maxIntensityInterpolator.interpolate(sunTimer.getAlpha()));
+	}
+	
+	public Vector3 getPointLightWorldPos(int pointLightIdx) {
+		return lightPos.get(pointLightIdx).interpolate(lightTimers.get(pointLightIdx).getAlpha());
+	}
+	
+	public static class PerLight {
+		private Vector4 cameraSpaceLightPos;
+		private Vector4 lightIntensity;
+		
+		public static final int SIZE = 2 * 4 * 4;
+		
+		public PerLight(Vector4 cameraSpaceLightPos, Vector4 lightIntensity) {
+			this.cameraSpaceLightPos = cameraSpaceLightPos;
+			this.lightIntensity = lightIntensity;
+		}
+		
+		private static final FloatBuffer buffer = BufferUtils.createFloatBuffer(SIZE / 4);
+		
+		public FloatBuffer toBuffer() {
+			buffer.clear();
+			buffer.put(cameraSpaceLightPos.toBuffer());
+			buffer.put(lightIntensity.toBuffer());
+			buffer.flip();
+			return buffer;
+		}
+	}
+	
+	public static class LightBlock {
+		private Vector4 ambientIntensity;
+		private float lightAttenuation;
+		private float maxIntensity;
+		private float[] padding = new float[2];
+		private PerLight[] lights = new PerLight[MAX_NUMBER_OF_LIGHTS];