Commits

Roi Atalla committed 7734441

Fully ported Example 16.1. Also moved the 'dds' classes to their original packaging for better credit to author.

Comments (0)

Files changed (15)

.idea/workspace.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ChangeListManager">
-    <list default="true" id="3bd3582b-975a-4915-888d-8e2c52d85938" name="Default" comment="">
+    <list default="true" id="3bd3582b-975a-4915-888d-8e2c52d85938" name="Default" comment="Fully ported Example 16.1.">
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Example16_1.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/testdata/Test.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/rosick/jglsdk/glimg/TextureGenerator.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.ScreenCoords.vert" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureGamma.frag" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureNoGamma.frag" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/testdata/test.txt" />
+      <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util\img\dds\DdsUtil.java" afterPath="" />
+      <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util\img\dds\ImageSet.java" afterPath="" />
+      <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util\img\dds\DdsLoader.java" afterPath="" />
+      <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util\img\dds\ImageCreator.java" afterPath="" />
+      <change type="DELETED" beforePath="E:\Roi Atalla\Documents\Programming Files\Java Files\Personal Projects\OpenGL\src\com\ra4king\opengl\util\img\dds\ImageFormat.java" afterPath="" />
+      <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/chapter15/Example15_1.java" afterPath="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java" />
       <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="1364267011003" ignored="false" />
-    <file path="/fragment.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364011370638" ignored="false" />
+    <file path="/fragment.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364713394646" 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="1364269275134" ignored="false" />
+    <file path="/Dummy.txt" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364718519267" 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="$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb4/chapter3/Example3_14.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb4/chapter3/Example3_2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/superbible/osb4/chapter3/Example3_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362804214555" ignored="false" />
-    <file path="/Test.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363753313655" ignored="false" />
+    <file path="/Test.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364338289944" ignored="false" />
     <file path="/Example14_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364191851973" ignored="false" />
     <file path="/Example11_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362977099998" ignored="false" />
     <file path="/Example11_2.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1362977123654" ignored="false" />
     <file path="$PROJECT_DIR$/src/com/ra4king/opengl/util/img/DDSLoader.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363584604777" ignored="false" />
     <file path="/DdsLoader.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364103074334" ignored="false" />
     <file path="/Util.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363584889897" ignored="false" />
-    <file path="/ImageCreator.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363585211375" ignored="false" />
+    <file path="/ImageCreator.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364714093483" ignored="false" />
     <file path="/README.md" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1363656075446" ignored="false" />
     <file path="/Example14_3.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364187193461" ignored="false" />
     <file path="/example14.3.PN.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364105197945" ignored="false" />
     <file path="/Loader.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364255179581" ignored="false" />
     <file path="/example15.1.PT.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364267795813" ignored="false" />
     <file path="/example15.1.Tex.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364267846777" ignored="false" />
+    <file path="/Example16_1.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364718474718" ignored="false" />
+    <file path="/TextureGenerator.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364718641897" ignored="false" />
+    <file path="/DdsUtil.java" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364713961538" ignored="false" />
+    <file path="/example16.1.ScreenCoords.vert" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364715031160" ignored="false" />
+    <file path="/example16.1.TextureGamma.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364715074572" ignored="false" />
+    <file path="/example16.1.TextureNoGamma.frag" changelist="3bd3582b-975a-4915-888d-8e2c52d85938" time="1364715133787" ignored="false" />
     <option name="TRACKING_ENABLED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
     <disable_hints />
   </component>
   <component name="DebuggerManager">
+    <ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
+    <line_breakpoints 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" />
-    <line_breakpoints default_suspend_policy="SuspendAll" default_condition_enabled="true" />
     <breakpoint_rules />
     <ui_properties />
   </component>
   <component name="IdeDocumentHistory">
     <option name="changedFiles">
       <list>
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.TextureCompute.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.UnitPlane.xml" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.TextureShininess.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.PNT.vert" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.FixedShininess.frag" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example1/Example14_1.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/Model.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/Loader.java" />
-        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.BigPlane.xml" />
         <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.Corridor.xml" />
         <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.PT.vert" />
         <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.Tex.frag" />
         <option value="$PROJECT_DIR$/src/com/ra4king/opengl/util/Utils.java" />
         <option value="$PROJECT_DIR$/README.md" />
         <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/test.txt" />
+        <option value="$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Test.java" />
+        <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" />
       </list>
     </option>
   </component>
       <pane id="PackagesPane">
         <subPane />
       </pane>
+      <pane id="Scope" />
       <pane id="ProjectPane">
         <subPane>
           <PATH>
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
             <PATH_ELEMENT>
+              <option name="myItemId" value="glimg" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="src" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
               <option name="myItemId" value="opengl" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
             <PATH_ELEMENT>
+              <option name="myItemId" value="util" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="src" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="opengl" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="util" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="img" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="OpenGL" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="src" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="opengl" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
               <option name="myItemId" value="gl33" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
             <PATH_ELEMENT>
-              <option name="myItemId" value="chapter15" />
+              <option name="myItemId" value="chapter16" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="example1" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
           </PATH>
           </PATH>
         </subPane>
       </pane>
-      <pane id="Scope" />
     </panes>
   </component>
   <component name="PropertiesComponent">
     <property name="MemberChooser.sorted" value="false" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeWidth1" value="285" />
     <property name="FileHistory.org.zmlx.hg4idea.provider.HgHistoryProvider_treeWidth2" value="292" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/out/production/OpenGL/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example2" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/.idea/workspace.xml" />
     <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="editor.preferences.smartKeys" />
+    <property name="options.lastSelected" value="project.propVCSSupport.Ignored.Files" />
     <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" />
       <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="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\testdata" />
+    </key>
   </component>
-  <component name="RunManager" selected="Application.Example15_1">
+  <component name="RunManager" selected="Application.Example16_1">
     <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/" />
       <ConfigurationWrapper RunnerId="Run" />
       <method />
     </configuration>
+    <configuration default="false" name="Test" type="Application" factoryName="Application" temporary="true">
+      <option name="MAIN_CLASS_NAME" value="com.ra4king.opengl.arcsynthesis.gl33.chapter16.example1.Test" />
+      <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="Run" />
+      <ConfigurationWrapper RunnerId="Run" />
+      <method />
+    </configuration>
+    <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/" />
+      <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" />
       <ConfigurationWrapper RunnerId="Run" />
       <method />
     </configuration>
-    <list size="7">
+    <list size="9">
       <item index="0" class="java.lang.String" itemvalue="Application.Example14_1" />
       <item index="1" class="java.lang.String" itemvalue="Application.Example14_2" />
       <item index="2" class="java.lang.String" itemvalue="Application.Example12_3" />
       <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.Example15_1" />
+      <item index="7" class="java.lang.String" itemvalue="Application.Test" />
+      <item index="8" class="java.lang.String" itemvalue="Application.Example16_1" />
     </list>
     <recent_temporary>
-      <list size="2">
-        <item index="0" class="java.lang.String" itemvalue="Application.Example15_1" />
+      <list size="4">
+        <item index="0" class="java.lang.String" itemvalue="Application.Example16_1" />
         <item index="1" class="java.lang.String" itemvalue="Application.Example14_3" />
+        <item index="2" class="java.lang.String" itemvalue="Application.Example15_1" />
+        <item index="3" class="java.lang.String" itemvalue="Application.Test" />
       </list>
     </recent_temporary>
     <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
     </configuration>
   </component>
   <component name="ShelveChangesManager" show_recycled="false" />
+  <component name="SliceManager">
+    <option name="analysisUIOptions">
+      <AnalysisUIOptions />
+    </option>
+  </component>
   <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
     <option name="USER" value="" />
     <option name="PASSWORD" value="" />
       <created>1364269274674</created>
       <updated>1364269274674</updated>
     </task>
-    <option name="localTasksCounter" value="26" />
+    <task id="LOCAL-00026" summary="Forgot to remove the call to setFPS(0) in Example 15.1.">
+      <created>1364273508722</created>
+      <updated>1364273508722</updated>
+    </task>
+    <option name="localTasksCounter" value="27" />
     <servers />
   </component>
-  <component name="TodoView" selected-index="0">
+  <component name="TodoView" selected-index="4">
     <todo-panel id="selected-file">
       <are-packages-shown value="false" />
       <are-modules-shown value="false" />
       <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.36886993" sideWeight="0.5" order="3" 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="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.32978722" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3283582" sideWeight="0.5" order="6" 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.32942432" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
+      <window_info id="TODO" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3283582" sideWeight="0.5" order="6" 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.14834578" sideWeight="0.80916846" 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.19083156" sideWeight="0.4823906" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20864461" sideWeight="0.67164177" 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="false" weight="0.2739872" 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="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
     <option name="MAXIMUM_HISTORY_ROWS" value="1000" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
     <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Updated README." />
+    <option name="LAST_COMMIT_MESSAGE" value="Fully ported Example 16.1." />
     <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_GROUP_BY_CHANGELIST" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-    <MESSAGE value="Reformat." />
     <MESSAGE value="Reformat and updated Example 12.1." />
     <MESSAGE value="Example 12.1 completely ported and fully working." />
     <MESSAGE value="Setup Example 12.2." />
     <MESSAGE value="Fully ported Example 14.3." />
     <MESSAGE value="Fully ported Example 15.1. Also added &quot;lookAt&quot; method to Utils." />
     <MESSAGE value="Updated README." />
+    <MESSAGE value="Forgot to remove the call to setFPS(0) in Example 15.1." />
+    <MESSAGE value="Fully ported Example 16.1." />
   </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/arcsynthesis/gl33/chapter14/example1/example14.1.ShaderGaussian.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/GLProgram.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
+        <state line="186" column="4" selection-start="3703" selection-end="3703" vertical-scroll-proportion="0.65460527">
+          <folding />
+        </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/example14.3.TextureShininess.frag">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="70" column="4" selection-start="1810" selection-end="1810" vertical-scroll-proportion="0.8039216" />
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example1/Example14_1.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="171" column="4" selection-start="6758" selection-end="6758" vertical-scroll-proportion="0.39215687">
+        <state line="43" column="13" selection-start="1729" selection-end="1729" vertical-scroll-proportion="0.08583691">
           <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter13/example2/Example13_2.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="72" column="4" selection-start="2310" selection-end="2310" vertical-scroll-proportion="0.7072368">
+        <state line="33" column="13" selection-start="1234" selection-end="1234" vertical-scroll-proportion="0.021428572">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="jar://$PROJECT_DIR$/files/lwjgl.jar!/org/lwjgl/opengl/GL12.class">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter12/example3/Example12_3.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="5" column="0" selection-start="145" selection-end="145" vertical-scroll-proportion="0.06764374">
+        <state line="66" column="4" selection-start="2508" selection-end="2508" vertical-scroll-proportion="0.6440367">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter14/example3/Example14_3.java">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/ImageCreator.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="286" column="4" selection-start="10854" selection-end="10854" vertical-scroll-proportion="0.5">
+        <state line="87" column="4" selection-start="2649" selection-end="2649" vertical-scroll-proportion="0.46929824">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.BigPlane.xml">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/DdsUtil.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="37" column="7" selection-start="658" selection-end="658" vertical-scroll-proportion="0.60855263">
+        <state line="186" column="4" selection-start="5007" selection-end="5007" vertical-scroll-proportion="0.88486844">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.Corridor.xml">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/DdsLoader.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="57" column="7" selection-start="827" selection-end="827" vertical-scroll-proportion="0.8881579">
+        <state line="326" column="8" selection-start="10398" selection-end="10398" vertical-scroll-proportion="0.37061402">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.PT.vert">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/ImageFormat.java">
       <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="313" column="12" selection-start="12828" selection-end="12828" vertical-scroll-proportion="0.37061402">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/example15.1.Tex.frag">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/ImageSet.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="11" column="0" selection-start="157" selection-end="157" vertical-scroll-proportion="0.28061223">
+        <state line="15" column="39" selection-start="336" selection-end="338" vertical-scroll-proportion="0.14982578">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Vector3.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="127" column="4" selection-start="1995" selection-end="1995" vertical-scroll-proportion="0.40986395">
+        <state line="225" column="8" selection-start="7412" selection-end="7634" vertical-scroll-proportion="0.44407895">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureGamma.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">
+          <folding />
+        </state>
+      </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">
           <folding />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/math/Matrix4.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="182" column="4" selection-start="4124" selection-end="4124" vertical-scroll-proportion="0.6904762">
+        <state line="13" column="4" selection-start="225" selection-end="225" vertical-scroll-proportion="0.16447368">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/Utils.java">
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Example16_1.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="41" column="4" selection-start="1250" selection-end="1250" vertical-scroll-proportion="0.6904762">
+        <state line="190" column="4" selection-start="6287" selection-end="6287" vertical-scroll-proportion="0.22137405">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.ScreenCoords.vert">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="19" column="0" selection-start="293" selection-end="293" vertical-scroll-proportion="0.4351145">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/README.md">
+    <entry file="file://$PROJECT_DIR$/src/rosick/jglsdk/glimg/TextureGenerator.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="22" column="0" selection-start="855" selection-end="855" vertical-scroll-proportion="0.45020464">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/util/Mesh.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="22" column="4" selection-start="563" selection-end="563" vertical-scroll-proportion="0.10231923">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="65" column="4" selection-start="1934" selection-end="1934" vertical-scroll-proportion="0.26603">
+        <state line="1193" column="8" selection-start="39740" selection-end="39740" vertical-scroll-proportion="-0.09813875">
           <folding>
             <element signature="imports" expanded="true" />
           </folding>

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

 import org.lwjgl.BufferUtils;
 import org.lwjgl.input.Keyboard;
 
+import rosick.jglsdk.glimg.DdsLoader;
+import rosick.jglsdk.glimg.ImageSet;
+import rosick.jglsdk.glimg.ImageSet.Dimensions;
+import rosick.jglsdk.glimg.ImageSet.SingleImage;
+
 import com.ra4king.opengl.GLProgram;
 import com.ra4king.opengl.util.Mesh;
 import com.ra4king.opengl.util.MousePoles.MouseButton;
 import com.ra4king.opengl.util.UniformBlockArray;
 import com.ra4king.opengl.util.UniformBlockArray.UniformBlockObject;
 import com.ra4king.opengl.util.Utils;
-import com.ra4king.opengl.util.img.dds.DdsLoader;
-import com.ra4king.opengl.util.img.dds.ImageSet;
-import com.ra4king.opengl.util.img.dds.ImageSet.Dimensions;
-import com.ra4king.opengl.util.img.dds.ImageSet.SingleImage;
 import com.ra4king.opengl.util.math.Matrix3;
 import com.ra4king.opengl.util.math.Matrix4;
 import com.ra4king.opengl.util.math.MatrixStack;

src/com/ra4king/opengl/arcsynthesis/gl33/chapter15/Example15_1.java

 import org.lwjgl.BufferUtils;
 import org.lwjgl.input.Keyboard;
 
+import rosick.jglsdk.glimg.DdsLoader;
+import rosick.jglsdk.glimg.ImageSet;
+import rosick.jglsdk.glimg.ImageSet.Dimensions;
+import rosick.jglsdk.glimg.ImageSet.SingleImage;
+
 import com.ra4king.opengl.GLProgram;
 import com.ra4king.opengl.util.Mesh;
 import com.ra4king.opengl.util.ShaderProgram;
 import com.ra4king.opengl.util.Timer;
 import com.ra4king.opengl.util.Timer.Type;
 import com.ra4king.opengl.util.Utils;
-import com.ra4king.opengl.util.img.dds.DdsLoader;
-import com.ra4king.opengl.util.img.dds.ImageSet;
-import com.ra4king.opengl.util.img.dds.ImageSet.Dimensions;
-import com.ra4king.opengl.util.img.dds.ImageSet.SingleImage;
 import com.ra4king.opengl.util.math.Matrix4;
 import com.ra4king.opengl.util.math.MatrixStack;
 import com.ra4king.opengl.util.math.Vector3;

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/Example16_1.java

+package com.ra4king.opengl.arcsynthesis.gl33.chapter16.example1;
+
+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.GL33.*;
+
+import java.nio.ByteBuffer;
+import java.nio.ShortBuffer;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.input.Keyboard;
+
+import com.ra4king.opengl.GLProgram;
+import com.ra4king.opengl.util.ShaderProgram;
+import com.ra4king.opengl.util.img.PNGDecoder;
+import com.ra4king.opengl.util.img.PNGDecoder.Format;
+import com.ra4king.opengl.util.math.Matrix4;
+
+/**
+ * @author ra4king
+ */
+public class Example16_1 extends GLProgram {
+	public static void main(String[] args) {
+		new Example16_1().run(true);
+	}
+	
+	private ShaderProgram gammaProgram;
+	private ShaderProgram noGammaProgram;
+	
+	private int dataBufferObject;
+	private int vao;
+	
+	private int projectionUniformBuffer;
+	
+	private int[] textures = new int[2];
+	private int samplerObject;
+	
+	private boolean[] useGammaCorrect = new boolean[2];
+	
+	private final int projectionBlockIndex = 0;
+	private final int gammaRampTextureUnit = 0;
+	
+	public Example16_1() {
+		super("Example 16.1 - Gamma Ramp", 500, 192, false);
+	}
+	
+	@Override
+	public void init() {
+		glClearColor(0, 0.5f, 0.3f, 0);
+		glClearDepth(1);
+		
+		initializePrograms();
+		initializeVertexData();
+		loadTextures();
+		
+		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);
+		
+		glBindBuffer(GL_UNIFORM_BUFFER, 0);
+	}
+	
+	private void initializePrograms() {
+		String vertexShader = readFromFile("example16.1.ScreenCoords.vert");
+		noGammaProgram = new ShaderProgram(vertexShader, readFromFile("example16.1.TextureNoGamma.frag"));
+		
+		int projectionBlock = glGetUniformBlockIndex(noGammaProgram.getProgram(), "Projection");
+		glUniformBlockBinding(noGammaProgram.getProgram(), projectionBlock, projectionBlockIndex);
+		
+		int colorTextureUniform = glGetUniformLocation(noGammaProgram.getProgram(), "colorTexture");
+		noGammaProgram.begin();
+		glUniform1i(colorTextureUniform, gammaRampTextureUnit);
+		noGammaProgram.end();
+		
+		gammaProgram = new ShaderProgram(vertexShader, readFromFile("example16.1.TextureGamma.frag"));
+		projectionBlock = glGetUniformBlockIndex(gammaProgram.getProgram(), "Projection");
+		glUniformBlockBinding(gammaProgram.getProgram(), projectionBlock, projectionBlockIndex);
+		
+		colorTextureUniform = glGetUniformLocation(gammaProgram.getProgram(), "colorTexture");
+		gammaProgram.begin();
+		glUniform1i(colorTextureUniform, gammaRampTextureUnit);
+		gammaProgram.end();
+	}
+	
+	private void initializeVertexData() {
+		final short[] vertexData = {
+				90, 80, 0, 0,
+				90, 16, 0, (short)65535,
+				410, 80, (short)65535, 0,
+				410, 16, (short)65535, (short)65535,
+				
+				90, 176, 0, 0,
+				90, 112, 0, (short)65535,
+				410, 176, (short)65535, 0,
+				410, 112, (short)65535, (short)65535,
+		};
+		
+		ShortBuffer buffer = (ShortBuffer)BufferUtils.createShortBuffer(vertexData.length).put(vertexData).flip();
+		
+		dataBufferObject = glGenBuffers();
+		glBindBuffer(GL_ARRAY_BUFFER, dataBufferObject);
+		glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
+		glBindBuffer(GL_ARRAY_BUFFER, 0);
+		
+		vao = glGenVertexArrays();
+		glBindVertexArray(vao);
+		
+		glBindBuffer(GL_ARRAY_BUFFER, dataBufferObject);
+		glEnableVertexAttribArray(0);
+		glVertexAttribPointer(0, 2, GL_UNSIGNED_SHORT, false, 8, 0);
+		glEnableVertexAttribArray(5);
+		glVertexAttribPointer(5, 2, GL_UNSIGNED_SHORT, true, 8, 4);
+		glBindBuffer(GL_ARRAY_BUFFER, 0);
+		
+		glBindVertexArray(0);
+	}
+	
+	private void loadTextures() {
+		for(int a = 0; a < textures.length; a++)
+			textures[a] = glGenTextures();
+		
+		try {
+			PNGDecoder decoder = new PNGDecoder(getClass().getResourceAsStream("example16.1.gamma_ramp.png"));
+			ByteBuffer buffer = BufferUtils.createByteBuffer(decoder.getWidth() * decoder.getHeight() * 4);
+			decoder.decode(buffer, decoder.getWidth() * 4, Format.RGBA);
+			buffer.flip();
+			
+			glBindTexture(GL_TEXTURE_2D, textures[0]);
+			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, decoder.getWidth(), decoder.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+			
+			glBindTexture(GL_TEXTURE_2D, textures[1]);
+			glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8, decoder.getWidth(), decoder.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
+			
+			glBindTexture(GL_TEXTURE_2D, 0);
+		} catch(Exception exc) {
+			exc.printStackTrace();
+			destroy();
+		}
+		
+		samplerObject = glGenSamplers();
+		glSamplerParameteri(samplerObject, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+		glSamplerParameteri(samplerObject, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+		glSamplerParameteri(samplerObject, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+		glSamplerParameteri(samplerObject, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+	}
+	
+	@Override
+	public void resized() {
+		super.resized();
+		
+		Matrix4 perspectiveMatrix = new Matrix4().clearToIdentity();
+		perspectiveMatrix.translate(-1, 1, 0);
+		perspectiveMatrix.scale(2.0f / getWidth(), -2.0f / getHeight(), 1);
+		
+		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
+		glBufferSubData(GL_UNIFORM_BUFFER, 0, perspectiveMatrix.toBuffer());
+		glBindBuffer(GL_UNIFORM_BUFFER, 0);
+	}
+	
+	@Override
+	public void keyPressed(int key, char c) {
+		switch(key) {
+			case Keyboard.KEY_1:
+				useGammaCorrect[0] = !useGammaCorrect[0];
+				if(useGammaCorrect[0])
+					System.out.println("Top:\tsRGB texture.");
+				else
+					System.out.println("Top:\tlinear texture.");
+				break;
+			case Keyboard.KEY_2:
+				useGammaCorrect[1] = !useGammaCorrect[1];
+				if(useGammaCorrect[1])
+					System.out.println("Bottom:\tsRGB texture.");
+				else
+					System.out.println("Bottom:\tlinear texture.");
+				break;
+		}
+	}
+	
+	@Override
+	public void render() {
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+		
+		glActiveTexture(GL_TEXTURE0 + gammaRampTextureUnit);
+		glBindTexture(GL_TEXTURE_2D, textures[useGammaCorrect[0] ? 1 : 0]);
+		glBindSampler(gammaRampTextureUnit, samplerObject);
+		
+		glBindVertexArray(vao);
+		
+		noGammaProgram.begin();
+		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+		noGammaProgram.end();
+		
+		glBindTexture(GL_TEXTURE_2D, textures[useGammaCorrect[1] ? 1 : 0]);
+		
+		gammaProgram.begin();
+		glDrawArrays(GL_TRIANGLE_STRIP, 4, 4);
+		gammaProgram.end();
+		
+		glBindVertexArray(0);
+		
+		glActiveTexture(GL_TEXTURE0 + gammaRampTextureUnit);
+		glBindTexture(GL_TEXTURE_2D, 0);
+		glBindSampler(gammaRampTextureUnit, 0);
+	}
+}

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.ScreenCoords.vert

+#version 330
+
+layout(std140) uniform;
+
+layout(location = 0) in vec2 position;
+layout(location = 5) in vec2 texCoord;
+
+uniform Projection
+{
+	mat4 cameraToClipMatrix;
+};
+
+out vec2 colorCoord;
+
+void main()
+{
+	gl_Position = cameraToClipMatrix * vec4(position, 0.0, 1.0);
+	colorCoord = texCoord;
+}

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureGamma.frag

+#version 330
+
+in vec2 colorCoord;
+
+uniform sampler2D colorTexture;
+
+out vec4 outputColor;
+
+void main()
+{
+	vec4 gamma = vec4(1.0 / 2.2);
+	gamma.w = 1.0;
+	outputColor = pow(texture(colorTexture, colorCoord), gamma);
+}

src/com/ra4king/opengl/arcsynthesis/gl33/chapter16/example1/example16.1.TextureNoGamma.frag

+#version 330
+
+in vec2 colorCoord;
+
+uniform sampler2D colorTexture;
+
+out vec4 outputColor;
+
+void main()
+{
+	outputColor = texture(colorTexture, colorCoord);
+}

src/com/ra4king/opengl/testdata/Test.java

+package com.ra4king.opengl.testdata;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+/**
+ * @author ra4king
+ */
+public class Test {
+	public static void main(String[] args) {
+		boolean add = true;
+		
+		try(BufferedReader reader = new BufferedReader(new InputStreamReader(Test.class.getResourceAsStream("test.txt"), "UTF-8"))) {
+			String s;
+			while((s = reader.readLine()) != null) {
+				s = s.trim();
+				if(!add) {
+					if(s.startsWith("-"))
+						System.out.print(s.substring(1) + "+");
+				}
+				else if(Character.isDigit(s.charAt(0)))
+					System.out.print(s + "+");
+			}
+		} catch(Exception exc) {
+			exc.printStackTrace();
+		}
+	}
+}

src/com/ra4king/opengl/testdata/test.txt

+160.24	
+Show additional information for activity type transfer 150.00 Online Banking transfer from CHK 6628 Confirmation# 034143471303/18/2013	Show additional information for activity type transfer 150.00 Online Banking transfer from CHK 6628 Confirmation# 0341434713	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 150.00 Online Banking transfer from CHK 6628 Confirmation# 0341434713 as reconciled
+150.00	
+Show additional information for activity type transfer 200.00 Online Banking transfer from CHK 6628 Confirmation# 020333949203/11/2013	Show additional information for activity type transfer 200.00 Online Banking transfer from CHK 6628 Confirmation# 0203339492	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 200.00 Online Banking transfer from CHK 6628 Confirmation# 0203339492 as reconciled
+200.00	
+Show additional information for activity type deposit 168.93 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...03/04/2013	Show additional information for activity type deposit 168.93 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 168.93 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+168.93	
+Show additional information for activity type deposit 77.39 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...02/19/2013	Show additional information for activity type deposit 77.39 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 77.39 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+77.39	
+Show additional information for activity type deposit 48.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...02/04/2013	Show additional information for activity type deposit 48.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 48.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+48.08	
+Show additional information for activity type deposit 92.10 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...01/23/2013	Show additional information for activity type deposit 92.10 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 92.10 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+92.10	
+Show additional information for activity type transfer 295.00 Online Banking transfer from CHK 6628 Confirmation# 132001966901/14/2013	Show additional information for activity type transfer 295.00 Online Banking transfer from CHK 6628 Confirmation# 1320019669	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 295.00 Online Banking transfer from CHK 6628 Confirmation# 1320019669 as reconciled
+295.00	
+Show additional information for activity type deposit 3.95 CHECKCARD 0108 PUBLIX #155 MARIETTA GA 7444500300960027591696301/09/2013	Show additional information for activity type deposit 3.95 CHECKCARD 0108 PUBLIX #155 MARIETTA GA 74445003009600275916963	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 3.95 CHECKCARD 0108 PUBLIX #155 MARIETTA GA 74445003009600275916963 as reconciled
+3.95	
+Show additional information for activity type deposit 63.58 MICRO ELECTRON 01/07 #000128204 REFUND 1275 Powers Ferry Marietta GA01/07/2013	Show additional information for activity type deposit 63.58 MICRO ELECTRON 01/07 #000128204 REFUND 1275 Powers Ferry Marietta GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 63.58 MICRO ELECTRON 01/07 #000128204 REFUND 1275 Powers Ferry Marietta GA as reconciled
+63.58	
+Show additional information for activity type deposit 70.44 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...01/07/2013	Show additional information for activity type deposit 70.44 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 70.44 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+70.44	
+Show additional information for activity type deposit 3.18 MICRO ELECTRON 12/28 #000021702 REFUND 1275 Powers Ferry Marietta GA12/31/2012	Show additional information for activity type deposit 3.18 MICRO ELECTRON 12/28 #000021702 REFUND 1275 Powers Ferry Marietta GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 3.18 MICRO ELECTRON 12/28 #000021702 REFUND 1275 Powers Ferry Marietta GA as reconciled
+3.18	
+Show additional information for activity type deposit 128.09 MICRO ELECTRON 12/29 #000040787 REFUND 1275 Powers Ferry Marietta GA12/31/2012	Show additional information for activity type deposit 128.09 MICRO ELECTRON 12/29 #000040787 REFUND 1275 Powers Ferry Marietta GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 128.09 MICRO ELECTRON 12/29 #000040787 REFUND 1275 Powers Ferry Marietta GA as reconciled
+128.09	
+Show additional information for activity type deposit 137.79 MICRO ELECTRON 12/28 #000021709 REFUND 1275 Powers Ferry Marietta GA12/31/2012	Show additional information for activity type deposit 137.79 MICRO ELECTRON 12/28 #000021709 REFUND 1275 Powers Ferry Marietta GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 137.79 MICRO ELECTRON 12/28 #000021709 REFUND 1275 Powers Ferry Marietta GA as reconciled
+137.79	
+Show additional information for activity type deposit 159.99 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...12/26/2012	Show additional information for activity type deposit 159.99 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 159.99 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+159.99	
+Show additional information for activity type deposit 323.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...12/10/2012	Show additional information for activity type deposit 323.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 323.08 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+323.08	
+Show additional information for activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 267685701812/06/2012	Show additional information for activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 2676857018	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 2676857018 as reconciled
+20.00	
+Show additional information for activity type deposit 81.28 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...11/26/2012	Show additional information for activity type deposit 81.28 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 81.28 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+81.28	
+Show additional information for activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 143840548311/20/2012	Show additional information for activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 1438405483	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 20.00 Online Banking transfer from CHK 6628 Confirmation# 1438405483 as reconciled
+20.00	
+Show additional information for activity type deposit 38.45 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...11/13/2012	Show additional information for activity type deposit 38.45 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 38.45 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+38.45	
+Show additional information for activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 280889006811/05/2012	Show additional information for activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 2808890068	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 2808890068 as reconciled
+15.00	
+Show additional information for activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 371405399711/05/2012	Show additional information for activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 3714053997	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 3714053997 as reconciled
+25.00	
+Show additional information for activity type deposit 52.95 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...10/29/2012	Show additional information for activity type deposit 52.95 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 52.95 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+52.95	
+Show additional information for activity type transfer 85.00 Online Banking transfer from CHK 6628 Confirmation# 382694323810/26/2012	Show additional information for activity type transfer 85.00 Online Banking transfer from CHK 6628 Confirmation# 3826943238	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 85.00 Online Banking transfer from CHK 6628 Confirmation# 3826943238 as reconciled
+85.00	
+Show additional information for activity type deposit 107.47 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...10/16/2012	Show additional information for activity type deposit 107.47 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 107.47 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+107.47	
+Show additional information for activity type deposit 22.01 BKOFAMERICA ATM 10/14 #000008376 DEPOSIT PARKAIRE MARIETTA GA10/15/2012	Show additional information for activity type deposit 22.01 BKOFAMERICA ATM 10/14 #000008376 DEPOSIT PARKAIRE MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 22.01 BKOFAMERICA ATM 10/14 #000008376 DEPOSIT PARKAIRE MARIETTA GA as reconciled
+22.01	
+Show additional information for activity type deposit 162.61 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...10/10/2012	Show additional information for activity type deposit 162.61 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO...	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 162.61 Money Network DES:AUTOTRNSFR ID:682710502040505 INDN:ROI ATALLA CO... as reconciled
+162.61	
+Show additional information for activity type deposit 65.87 BKOFAMERICA ATM 09/24 #000007454 DEPOSIT PARKAIRE MARIETTA GA09/24/2012	Show additional information for activity type deposit 65.87 BKOFAMERICA ATM 09/24 #000007454 DEPOSIT PARKAIRE MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 65.87 BKOFAMERICA ATM 09/24 #000007454 DEPOSIT PARKAIRE MARIETTA GA as reconciled
+65.87	
+Show additional information for activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 380920024409/19/2012	Show additional information for activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 3809200244	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 25.00 Online Banking transfer from CHK 6628 Confirmation# 3809200244 as reconciled
+25.00	
+Show additional information for activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 189102844009/17/2012	Show additional information for activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 1891028440	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 15.00 Online Banking transfer from CHK 6628 Confirmation# 1891028440 as reconciled
+15.00	
+Show additional information for activity type transfer 10.00 Online Banking transfer from CHK 6628 Confirmation# 413681127109/11/2012	Show additional information for activity type transfer 10.00 Online Banking transfer from CHK 6628 Confirmation# 4136811271	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 10.00 Online Banking transfer from CHK 6628 Confirmation# 4136811271 as reconciled
+10.00	
+Show additional information for activity type deposit 11.16 PAYPAL DES:TRANSFER ID:5NX2268A9TWH4 INDN:ROI ATALLA CO ID:PAYPALSD11 PPD09/10/2012	Show additional information for activity type deposit 11.16 PAYPAL DES:TRANSFER ID:5NX2268A9TWH4 INDN:ROI ATALLA CO ID:PAYPALSD11 PPD	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 11.16 PAYPAL DES:TRANSFER ID:5NX2268A9TWH4 INDN:ROI ATALLA CO ID:PAYPALSD11 PPD as reconciled
+11.16	
+Show additional information for activity type deposit 103.33 BKOFAMERICA ATM 08/12 #000004244 DEPOSIT PARKAIRE MARIETTA GA08/13/2012	Show additional information for activity type deposit 103.33 BKOFAMERICA ATM 08/12 #000004244 DEPOSIT PARKAIRE MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 103.33 BKOFAMERICA ATM 08/12 #000004244 DEPOSIT PARKAIRE MARIETTA GA as reconciled
+103.33	
+Show additional information for activity type transfer 45.00 Online Banking transfer from CHK 6628 Confirmation# 026293143108/10/2012	Show additional information for activity type transfer 45.00 Online Banking transfer from CHK 6628 Confirmation# 0262931431	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 45.00 Online Banking transfer from CHK 6628 Confirmation# 0262931431 as reconciled
+45.00	
+Show additional information for activity type deposit 62.78 BKOFAMERICA ATM 07/15 #000004634 DEPOSIT EAST COBB MARIETTA GA07/16/2012	Show additional information for activity type deposit 62.78 BKOFAMERICA ATM 07/15 #000004634 DEPOSIT EAST COBB MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 62.78 BKOFAMERICA ATM 07/15 #000004634 DEPOSIT EAST COBB MARIETTA GA as reconciled
+62.78	
+Show additional information for activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 182131455207/13/2012	Show additional information for activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 1821314552	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 1821314552 as reconciled
+75.00	
+Show additional information for activity type transfer 50.00 Online Banking transfer from CHK 6628 Confirmation# 410302038707/11/2012	Show additional information for activity type transfer 50.00 Online Banking transfer from CHK 6628 Confirmation# 4103020387	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 50.00 Online Banking transfer from CHK 6628 Confirmation# 4103020387 as reconciled
+50.00	
+Show additional information for activity type transfer 100.00 Online Banking transfer from CHK 6628 Confirmation# 141454929207/02/2012	Show additional information for activity type transfer 100.00 Online Banking transfer from CHK 6628 Confirmation# 1414549292	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 100.00 Online Banking transfer from CHK 6628 Confirmation# 1414549292 as reconciled
+100.00	
+Show additional information for activity type deposit 64.19 BKOFAMERICA ATM 06/25 #000006685 DEPOSIT PEACHTREE BATTLE ATLANTA GA06/25/2012	Show additional information for activity type deposit 64.19 BKOFAMERICA ATM 06/25 #000006685 DEPOSIT PEACHTREE BATTLE ATLANTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 64.19 BKOFAMERICA ATM 06/25 #000006685 DEPOSIT PEACHTREE BATTLE ATLANTA GA as reconciled
+64.19	
+Show additional information for activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 023857432405/30/2012	Show additional information for activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 0238574324	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 75.00 Online Banking transfer from CHK 6628 Confirmation# 0238574324 as reconciled
+75.00	
+Show additional information for activity type deposit 70.30 BKOFAMERICA ATM 05/20 #000006216 DEPOSIT PARKAIRE MARIETTA GA05/21/2012	Show additional information for activity type deposit 70.30 BKOFAMERICA ATM 05/20 #000006216 DEPOSIT PARKAIRE MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 70.30 BKOFAMERICA ATM 05/20 #000006216 DEPOSIT PARKAIRE MARIETTA GA as reconciled
+70.30	
+Show additional information for activity type credit 25.00 MONTHLY SERVICE CHARGE REFUND FDES NMO 0006576 NBKOXRJ04/18/2012	Show additional information for activity type credit 25.00 MONTHLY SERVICE CHARGE REFUND FDES NMO 0006576 NBKOXRJ	activity type credit
+status type icon cleared
+Cleared. Select to mark activity type credit 25.00 MONTHLY SERVICE CHARGE REFUND FDES NMO 0006576 NBKOXRJ as reconciled
+25.00	
+Show additional information for activity type transfer 108.00 Online Banking transfer from CHK 6628 Confirmation# 296724024904/17/2012	Show additional information for activity type transfer 108.00 Online Banking transfer from CHK 6628 Confirmation# 2967240249	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 108.00 Online Banking transfer from CHK 6628 Confirmation# 2967240249 as reconciled
+108.00	
+Show additional information for activity type deposit 47.60 BKOFAMERICA ATM 04/14 #000005372 DEPOSIT PARKAIRE MARIETTA GA04/16/2012	Show additional information for activity type deposit 47.60 BKOFAMERICA ATM 04/14 #000005372 DEPOSIT PARKAIRE MARIETTA GA	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 47.60 BKOFAMERICA ATM 04/14 #000005372 DEPOSIT PARKAIRE MARIETTA GA as reconciled
+47.60	
+Show additional information for activity type transfer 134.00 Online Banking transfer from CHK 6628 Confirmation# 019761773003/28/2012	Show additional information for activity type transfer 134.00 Online Banking transfer from CHK 6628 Confirmation# 0197617730	activity type transfer
+status type icon cleared
+Cleared. Select to mark activity type transfer 134.00 Online Banking transfer from CHK 6628 Confirmation# 0197617730 as reconciled
+134.00	
+Show additional information for activity type deposit 54.98 PAYPAL DES:TRANSFER ID:5NX225QB5J4LA INDN:ROI ATALLA CO ID:PAYPALSD11 PPD03/21/2012	Show additional information for activity type deposit 54.98 PAYPAL DES:TRANSFER ID:5NX225QB5J4LA INDN:ROI ATALLA CO ID:PAYPALSD11 PPD	activity type deposit
+status type icon cleared
+Cleared. Select to mark activity type deposit 54.98 PAYPAL DES:TRANSFER ID:5NX225QB5J4LA INDN:ROI ATALLA CO ID:PAYPALSD11 PPD as reconciled
+54.98	

src/com/ra4king/opengl/util/img/dds/DdsLoader.java

-package com.ra4king.opengl.util.img.dds;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-
-import com.ra4king.opengl.util.img.dds.ImageFormat.BitDepth;
-import com.ra4king.opengl.util.img.dds.ImageFormat.ComponentOrder;
-import com.ra4king.opengl.util.img.dds.ImageFormat.PixelComponents;
-import com.ra4king.opengl.util.img.dds.ImageFormat.PixelDataType;
-import com.ra4king.opengl.util.img.dds.ImageFormat.UncheckedImageFormat;
-import com.ra4king.opengl.util.img.dds.ImageSet.Dimensions;
-
-/**
- * Visit https://github.com/integeruser/jglsdk for project info, updates and license terms.
- * 
- * @author integeruser
- */
-public class DdsLoader {
-	public static ImageSet load(InputStream dds) throws IOException {
-		byte[] ddsFile = readDdsFile(dds);
-		
-		// Check the first 4 bytes.
-		int magicTest = readDoubleWord(ddsFile, 0);
-		if(magicTest != MagicNumbers.DDS_MAGIC_NUMBER) {
-			throw new DdsFileMalformedException("The Magic number is missing from the file.");
-		}
-		
-		if(ddsFile.length < DdsHeader.SIZE + 4) {
-			throw new DdsFileMalformedException("The data is way too small to store actual information.");
-		}
-		
-		// Collect info from the DDS file.
-		DdsHeader ddsHeader = new DdsHeader(ddsFile);
-		Dds10Header dds10Header = getDds10Header(ddsFile, ddsHeader);
-		Dimensions ddsDimensions = getDimensions(ddsHeader);
-		UncheckedImageFormat ddsFormat = getFormat(ddsHeader, dds10Header);
-		
-		// Get image counts.
-		int numArrays = (dds10Header.arraySize > 1) ? dds10Header.arraySize : 1;
-		int numFaces = (dds10Header.miscFlag & Dds10MiscFlags.RESOURCE_MISC_TEXTURECUBE) != 0 ? 6 : 1;
-		int numMipmaps = (ddsHeader.flags & DdsFlags.MIPMAPCOUNT) != 0 ? ddsHeader.mipmapCount : 1;
-		
-		int baseOffset = getOffsetToData(ddsHeader);
-		
-		// Build the image creator.
-		ImageCreator imageCreator = new ImageCreator(new ImageFormat(ddsFormat), ddsDimensions, numMipmaps, numArrays, numFaces);
-		int cumulativeOffset = baseOffset;
-		
-		for(int arrayIx = 0; arrayIx < numArrays; arrayIx++) {
-			for(int faceIx = 0; faceIx < numFaces; faceIx++) {
-				for(int mipmapLevel = 0; mipmapLevel < numMipmaps; mipmapLevel++) {
-					int mipmapLevelSize = calcMipmapSize(ddsFormat, ddsDimensions, mipmapLevel);
-					
-					// Get specific data from ddsFile.
-					byte[] mipmapLevelData = Arrays.copyOfRange(ddsFile, cumulativeOffset, cumulativeOffset + mipmapLevelSize);
-					
-					// Set data for the current mipmap level in imageCreator.
-					imageCreator.setImageData(mipmapLevelData, true, mipmapLevel, arrayIx, faceIx);
-					
-					// Advance offset to read next mipmapLevelData from ddsFile.
-					cumulativeOffset += mipmapLevelSize;
-				}
-			}
-		}
-		
-		return imageCreator.createImage();
-	}
-	
-	private static class DdsFileMalformedException extends RuntimeException {
-		private static final long serialVersionUID = -1523221969465221880L;
-		
-		private DdsFileMalformedException(String message) {
-			super(message);
-		}
-	}
-	
-	private static class DdsFileUnsupportedException extends RuntimeException {
-		private static final long serialVersionUID = 377383320427260974L;
-		
-		private DdsFileUnsupportedException(String filename, String message) {
-			super(filename + ": " + message);
-		}
-	}
-	
-	private static class MagicNumbers {
-		static final int DDS_MAGIC_NUMBER = 0x20534444; // "DDS "
-		static final int DDS10_FOUR_CC = 0x30314458; // "DX10"
-		
-		static final int DDSFOURCC_DXT1 = 0x31545844; // "DXT1"
-		static final int DDSFOURCC_DXT3 = 0x33545844; // "DXT3"
-		static final int DDSFOURCC_DXT5 = 0x35545844; // "DXT5"
-	}
-	
-	@SuppressWarnings("unused")
-	private static class DdsFlags {
-		static final int CAPS = 0x00000001;
-		static final int HEIGHT = 0x00000002;
-		static final int WIDTH = 0x00000004;
-		static final int PITCH = 0x00000008;
-		static final int PIXELFORMAT = 0x00001000;
-		static final int MIPMAPCOUNT = 0x00020000;
-		static final int LINEARSIZE = 0x00080000;
-		static final int DEPTH = 0x00800000;
-		
-	}
-	
-	private static class Dds10MiscFlags {
-		static final int RESOURCE_MISC_TEXTURECUBE = 0x00000004;
-	}
-	
-	@SuppressWarnings("unused")
-	private static class Dds10ResourceDimensions {
-		static final int TEXTURE1D = 2;
-		static final int TEXTURE2D = 3;
-		static final int TEXTURE3D = 4;
-	}
-	
-	private static class DdsCaps2 {
-		static final int CUBEMAP = 0x00000200;
-		static final int CUBEMAP_POSITIVEX = 0x00000400;
-		static final int CUBEMAP_NEGATIVEX = 0x00000800;
-		static final int CUBEMAP_POSITIVEY = 0x00001000;
-		static final int CUBEMAP_NEGATIVEY = 0x00002000;
-		static final int CUBEMAP_POSITIVEZ = 0x00004000;
-		static final int CUBEMAP_NEGATIVEZ = 0x00008000;
-		static final int VOLUME = 0x00200000;
-		
-		static final int CUBEMAP_ALL = CUBEMAP |
-				CUBEMAP_POSITIVEX | CUBEMAP_NEGATIVEX |
-				CUBEMAP_POSITIVEY | CUBEMAP_NEGATIVEY |
-				CUBEMAP_POSITIVEZ | CUBEMAP_NEGATIVEZ;
-	}
-	
-	private static class DxgiFormat {
-		static final int UNKNOWN = 0;
-	}
-	
-	@SuppressWarnings("unused")
-	private static class DdsPixelFormat {
-		int size;
-		int flags;
-		int fourCC;
-		int rgbBitCount;
-		int rBitMask;
-		int gBitMask;
-		int bBitMask;
-		int aBitMask;
-	}
-	
-	@SuppressWarnings("unused")
-	private static class DdsPixelFormatFlags {
-		static final int ALPHAPIXELS = 0x00000001;
-		static final int ALPHA = 0x00000002;
-		static final int FOURCC = 0x00000004;
-		static final int RGB = 0x00000040;
-		static final int YUV = 0x00000200;
-		static final int LUMINANCE = 0x00020000;
-	}
-	
-	@SuppressWarnings("unused")
-	private static class DdsHeader {
-		static final int SIZE = (7 + 11 + 8 + 5) * (Integer.SIZE / 8);
-		
-		int size;
-		int flags;
-		int height;
-		int width;
-		int pitchOrLinearSize;
-		int depth;
-		int mipmapCount;
-		
-		int reserved1[] = new int[11];
-		
-		DdsPixelFormat ddsPixelFormat;
-		
-		int caps;
-		int caps2;
-		int caps3;
-		int caps4;
-		int reserved2;
-		
-		DdsHeader(byte[] ddsFile) {
-			size = readDoubleWord(ddsFile, 4);
-			flags = readDoubleWord(ddsFile, 8);
-			height = readDoubleWord(ddsFile, 12);
-			width = readDoubleWord(ddsFile, 16);
-			pitchOrLinearSize = readDoubleWord(ddsFile, 20);
-			depth = readDoubleWord(ddsFile, 24);
-			mipmapCount = readDoubleWord(ddsFile, 28);
-			
-			for(int i = 0; i < reserved1.length; i++) {
-				reserved1[i] = readDoubleWord(ddsFile, 32 + 4 * i);
-			}
-			
-			ddsPixelFormat = new DdsPixelFormat();
-			ddsPixelFormat.size = readDoubleWord(ddsFile, 76);
-			ddsPixelFormat.flags = readDoubleWord(ddsFile, 80);
-			ddsPixelFormat.fourCC = readDoubleWord(ddsFile, 84);
-			ddsPixelFormat.rgbBitCount = readDoubleWord(ddsFile, 88);
-			ddsPixelFormat.rBitMask = readDoubleWord(ddsFile, 92);
-			ddsPixelFormat.gBitMask = readDoubleWord(ddsFile, 96);
-			ddsPixelFormat.bBitMask = readDoubleWord(ddsFile, 100);
-			ddsPixelFormat.aBitMask = readDoubleWord(ddsFile, 104);
-			
-			caps = readDoubleWord(ddsFile, 108);
-			caps2 = readDoubleWord(ddsFile, 112);
-			caps3 = readDoubleWord(ddsFile, 116);
-			caps4 = readDoubleWord(ddsFile, 120);
-			reserved2 = readDoubleWord(ddsFile, 124);
-		}
-	}
-	
-	@SuppressWarnings("unused")
-	private static class Dds10Header {
-		static final int SIZE = 5 * (Integer.SIZE / 8);
-		
-		int dxgiFormat;
-		int resourceDimension;
-		int miscFlag;
-		int arraySize;
-		int reserved;
-	}
-	
-	private static byte[] readDdsFile(InputStream ddsInStream) throws IOException {
-		assert ddsInStream != null;
-		
-		ByteArrayOutputStream ddsOutStream = new ByteArrayOutputStream();
-		int bytesRead;
-		
-		byte[] buffer = new byte[4096];
-		
-		while((bytesRead = ddsInStream.read(buffer)) != -1) {
-			ddsOutStream.write(buffer, 0, bytesRead);
-		}
-		
-		return ddsOutStream.toByteArray();
-	}
-	
-	// Read four bytes.
-	private static int readDoubleWord(byte bytes[], int startIx) {
-		int dw = 0;
-		
-		// Read 4 bytes.
-		for(int i = startIx; i < startIx + 4; i++) {
-			dw += (bytes[i] & 0xff) << (8 * (i - startIx));
-		}
-		
-		return dw;
-	}
-	
-	// Will either generate this or return the actual one.
-	private static Dds10Header getDds10Header(byte[] ddsFile, DdsHeader ddsHeader) {
-		if(ddsHeader.ddsPixelFormat.fourCC == MagicNumbers.DDS10_FOUR_CC) {
-			Dds10Header dds10Header = new Dds10Header();
-			int offsetToNewHeader = DdsHeader.SIZE + 4;
-			
-			dds10Header.dxgiFormat = readDoubleWord(ddsFile, offsetToNewHeader);
-			dds10Header.resourceDimension = readDoubleWord(ddsFile, offsetToNewHeader + 4);
-			dds10Header.miscFlag = readDoubleWord(ddsFile, offsetToNewHeader + 8);
-			dds10Header.arraySize = readDoubleWord(ddsFile, offsetToNewHeader + 12);
-			dds10Header.reserved = readDoubleWord(ddsFile, offsetToNewHeader + 16);
-			
-			return dds10Header;
-		}
-		
-		// Compute the header manually. Namely, compute the DXGI_FORMAT for the given data.
-		Dds10Header dds10header = new Dds10Header();
-		
-		// Get dimensionality. Assume 2D unless otherwise stated.
-		dds10header.resourceDimension = Dds10ResourceDimensions.TEXTURE2D;
-		
-		if((ddsHeader.caps2 & DdsCaps2.VOLUME) != 0 && (ddsHeader.flags & DdsFlags.DEPTH) != 0) {
-			dds10header.resourceDimension = Dds10ResourceDimensions.TEXTURE3D;
-		}
-		
-		// Get cubemap.
-		int cubemapTest = ddsHeader.caps2 & DdsCaps2.CUBEMAP_ALL;
-		if(cubemapTest == 0) {
-			dds10header.miscFlag = 0;
-		} else {
-			// All faces must be specified or none. Otherwise unsupported.
-			if(cubemapTest != DdsCaps2.CUBEMAP_ALL) {
-				throw new DdsFileUnsupportedException("", "All cubemap faces must be specified.");
-			}
-			
-			dds10header.miscFlag = Dds10MiscFlags.RESOURCE_MISC_TEXTURECUBE;
-		}
-		
-		// Array size is... zero?
-		dds10header.arraySize = 0;
-		
-		// Use the old-style format.
-		dds10header.dxgiFormat = DxgiFormat.UNKNOWN;
-		
-		return dds10header;
-	}
-	
-	private static Dimensions getDimensions(DdsHeader ddsHeader) {
-		Dimensions ddsDimensions = new Dimensions();
-		ddsDimensions.numDimensions = 1;
-		ddsDimensions.width = ddsHeader.width;
-		
-		if((ddsHeader.flags & DdsFlags.HEIGHT) != 0) {
-			ddsDimensions.numDimensions = 2;
-			ddsDimensions.height = ddsHeader.height;
-		}
-		
-		if((ddsHeader.flags & DdsFlags.DEPTH) != 0) {
-			ddsDimensions.numDimensions = 3;
-			ddsDimensions.depth = ddsHeader.depth;
-		}
-		
-		return ddsDimensions;
-	}
-	
-	private static UncheckedImageFormat getFormat(DdsHeader ddsHeader, Dds10Header dds10Header) throws DdsFileUnsupportedException {
-		if(dds10Header.dxgiFormat != DxgiFormat.UNKNOWN) {
-			throw new IllegalArgumentException("Format is not unknown.");
-		}
-		
-		for(OldDdsFormatConv o : s_oldFormatConvert)
-			if(doesMatchFormat(o.ddsFmt, ddsHeader))
-				return o.uncheckedImageFormat;
-		
-		throw new DdsFileUnsupportedException("", "Could not use the DDS9's image format.");
-	}
-	
-	private static int getOffsetToData(DdsHeader ddsHeader) {
-		int byteOffset = DdsHeader.SIZE + 4;
-		
-		if(ddsHeader.ddsPixelFormat.fourCC == MagicNumbers.DDS10_FOUR_CC) {
-			byteOffset += Dds10Header.SIZE;
-		}
-		
-		return byteOffset;
-	}
-	
-	// Computes the bytesize of a single scanline of an image of the given format, with the given line width.
-	// For compressed textures, the value returned is the number of bytes for every 4 scanlines.
-	private static int calcLineSize(UncheckedImageFormat ddsFormat, int lineWidth) {
-		// This is from the DDS suggestions for line size computations.
-		if(ddsFormat.bitDepth == BitDepth.COMPRESSED) {
-			int blockSize = 16;
-			
-			if(ddsFormat.type == PixelDataType.COMPRESSED_BC1
-					|| ddsFormat.type == PixelDataType.COMPRESSED_UNSIGNED_BC4
-					|| ddsFormat.type == PixelDataType.COMPRESSED_SIGNED_BC4) {
-				blockSize = 8;
-			}
-			
-			return ((lineWidth + 3) / 4) * blockSize;
-		} else {
-			int bytesPerPixel = DdsUtil.calcBytesPerPixel(new ImageFormat(ddsFormat));
-			
-			return lineWidth * bytesPerPixel;
-		}
-	}
-	
-	private static int calcMipmapSize(UncheckedImageFormat ddsFormat, Dimensions ddsDimensions, int mipmapLevel) {
-		Dimensions mipmapDimensions = DdsUtil.calcMipmapLevelDimensions(ddsDimensions, mipmapLevel);
-		int lineSize = calcLineSize(ddsFormat, mipmapDimensions.width);
-		
-		int effectiveHeight = 1;
-		if(mipmapDimensions.numDimensions > 1) {
-			effectiveHeight = mipmapDimensions.height;
-			
-			if(ddsFormat.bitDepth == BitDepth.COMPRESSED) {
-				effectiveHeight = (effectiveHeight + 3) / 4;
-			}
-		}
-		
-		int effectiveDepth = 1;
-		if(mipmapDimensions.numDimensions > 2) {
-			effectiveDepth = mipmapDimensions.depth;
-			
-			if(ddsFormat.bitDepth == BitDepth.COMPRESSED) {
-				effectiveDepth = (effectiveDepth + 3) / 4;
-			}
-		}
-		
-		int numLines = effectiveHeight * effectiveDepth;
-		
-		return lineSize * numLines;
-	}
-	
-	private static OldDdsFormatConv s_oldFormatConvert[] = {
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGBA, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB | DdsPixelFormatFlags.ALPHAPIXELS,
-					32, 0xff, 0xff00, 0xff0000, 0xff000000, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGBA, ComponentOrder.BGRA,
-					BitDepth.PACKED_32_BIT_8888_REV, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB | DdsPixelFormatFlags.ALPHAPIXELS,
-					32, 0xff0000, 0xff00, 0xff, 0xff000000, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGBX, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 32, 0xff, 0xff00, 0xff0000, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGB, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 24, 0xff, 0xff00, 0xff0000, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGB, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 24, 0xff, 0xff00, 0xff0000, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGB, ComponentOrder.BGRA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 24, 0xff0000, 0xff00, 0xff, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGB, ComponentOrder.RGBA,
-					BitDepth.PACKED_16_BIT_565, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 16, 0xf800, 0x7e0, 0x1f, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGBA, ComponentOrder.BGRA,
-					BitDepth.PACKED_16_BIT_1555_REV, 1),
-					new OldDdsFmtMatch(DdsPixelFormatFlags.RGB, 16, 0x7c00,
-							0x3e0, 0x1f, 0x8000, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RGBA, ComponentOrder.BGRA,
-					BitDepth.PACKED_16_BIT_4444_REV, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 16, 0xf00, 0xf0, 0xf, 0xf000, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.COMPRESSED_BC1, PixelComponents.COLOR_RGB,
-					ComponentOrder.COMPRESSED, BitDepth.COMPRESSED, 1),
-					new OldDdsFmtMatch(DdsPixelFormatFlags.FOURCC, 0, 0, 0, 0,
-							0, MagicNumbers.DDSFOURCC_DXT1)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.COMPRESSED_BC2, PixelComponents.COLOR_RGBA,
-					ComponentOrder.COMPRESSED, BitDepth.COMPRESSED, 1),
-					new OldDdsFmtMatch(DdsPixelFormatFlags.FOURCC, 0, 0, 0, 0,
-							0, MagicNumbers.DDSFOURCC_DXT3)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.COMPRESSED_BC3, PixelComponents.COLOR_RGBA,
-					ComponentOrder.COMPRESSED, BitDepth.COMPRESSED, 1),
-					new OldDdsFmtMatch(DdsPixelFormatFlags.FOURCC, 0, 0, 0, 0,
-							0, MagicNumbers.DDSFOURCC_DXT5)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RG, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_16, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 32, 0xffff, 0xffff0000, 0, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RG, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.RGB, 16, 0xffff, 0xffff0000, 0, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RED, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_16, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.LUMINANCE, 16, 0xffff, 0, 0, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RED, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.LUMINANCE, 8, 0xff, 0, 0, 0, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RG, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_16, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.LUMINANCE
-							| DdsPixelFormatFlags.ALPHAPIXELS, 16, 0xffff, 0,
-					0, 0xffff0000, 0)),
-			
-			new OldDdsFormatConv(new UncheckedImageFormat(
-					PixelDataType.NORM_UNSIGNED_INTEGER,
-					PixelComponents.COLOR_RG, ComponentOrder.RGBA,
-					BitDepth.PER_COMP_8, 1), new OldDdsFmtMatch(
-					DdsPixelFormatFlags.LUMINANCE
-							| DdsPixelFormatFlags.ALPHAPIXELS, 8, 0xff, 0, 0,
-					0xff00, 0)), };
-	
-	private static class OldDdsFmtMatch {
-		int flags;
-		int bitDepth;
-		int rBitmask;
-		int gBitmask;
-		int bBitmask;
-		int aBitmask;
-		int fourCC;
-		
-		OldDdsFmtMatch(int flags, int bitDepth, int rBitmask, int gBitmask,
-				int bBitmask, int aBitmask, int fourCC) {
-			this.flags = flags;
-			this.bitDepth = bitDepth;
-			this.rBitmask = rBitmask;
-			this.gBitmask = gBitmask;
-			this.bBitmask = bBitmask;
-			this.aBitmask = aBitmask;
-			this.fourCC = fourCC;
-		}
-	}
-	
-	private static class OldDdsFormatConv {
-		UncheckedImageFormat uncheckedImageFormat;
-		OldDdsFmtMatch ddsFmt;
-		
-		OldDdsFormatConv(UncheckedImageFormat uncheckedImageFormat, OldDdsFmtMatch ddsFmt) {
-			this.uncheckedImageFormat = uncheckedImageFormat;
-			this.ddsFmt = ddsFmt;
-		}
-	}
-	
-	private static boolean doesMatchFormat(OldDdsFmtMatch ddsFmt, DdsHeader ddsHeader) {
-		if((ddsHeader.ddsPixelFormat.flags & ddsFmt.flags) == 0) {
-			return false;
-		}
-		
-		if((ddsFmt.flags & DdsPixelFormatFlags.FOURCC) != 0) {
-			// None of the bit counts matter. Just check the fourCC
-			if(ddsFmt.fourCC != ddsHeader.ddsPixelFormat.fourCC) {
-				return false;
-			}
-		} else {
-			// Check the bitcounts, not the fourCC.
-			if(ddsHeader.ddsPixelFormat.rgbBitCount != ddsFmt.bitDepth) {
-				return false;
-			}
-			
-			if((ddsFmt.rBitmask & ddsHeader.ddsPixelFormat.rBitMask) != ddsFmt.rBitmask) {
-				return false;
-			}
-			
-			if((ddsFmt.gBitmask & ddsHeader.ddsPixelFormat.gBitMask) != ddsFmt.gBitmask) {
-				return false;
-			}
-			
-			if((ddsFmt.bBitmask & ddsHeader.ddsPixelFormat.bBitMask) != ddsFmt.bBitmask) {
-				return false;
-			}
-			
-			if((ddsFmt.aBitmask & ddsHeader.ddsPixelFormat.aBitMask) != ddsFmt.aBitmask) {
-				return false;
-			}
-		}
-		
-		return true;
-	}
-}

src/com/ra4king/opengl/util/img/dds/DdsUtil.java

-package com.ra4king.opengl.util.img.dds;
-
-import com.ra4king.opengl.util.img.dds.ImageFormat.BitDepth;
-import com.ra4king.opengl.util.img.dds.ImageFormat.PixelComponents;
-import com.ra4king.opengl.util.img.dds.ImageFormat.PixelDataType;
-import com.ra4king.opengl.util.img.dds.ImageSet.Dimensions;
-
-/**
- * Visit https://github.com/integeruser/jglsdk for project info, updates and license terms.
- * 
- * @author integeruser
- */
-class DdsUtil {
-	
-	static <T> boolean isOneOfThese(T testValue, T[] testArray) {
-		for(T arrayElement : testArray) {
-			if(arrayElement.equals(testValue)) {
-				return true;
-			}
-		}
-		
-		return false;
-	}
-	
-	static Dimensions calcMipmapLevelDimensions(Dimensions ddsDimensions, int mipmapLevel) {
-		Dimensions mipmapLevelDimensions = new Dimensions(ddsDimensions);
-		
-		for(int i = 0; i < mipmapLevel; i++) {
-			mipmapLevelDimensions.width /= 2;
-			mipmapLevelDimensions.height /= 2;
-			mipmapLevelDimensions.depth /= 2;
-		}
-		
-		return mipmapLevelDimensions;
-	}
-	
-	static int calcBytesPerPixel(ImageFormat format) {
-		int bytesPerPixel = 0;
-		
-		switch(format.getBitDepth()) {
-			case COMPRESSED:
-				return 0;
-			case PER_COMP_8:
-				bytesPerPixel = 1;
-				break;
-			case PER_COMP_16:
-				bytesPerPixel = 2;
-				break;
-			case PER_COMP_32:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_16_BIT_565:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_16_BIT_5551:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_16_BIT_4444:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_32_BIT_8888:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_32_BIT_1010102:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_32_BIT_248:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_16_BIT_565_REV:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_16_BIT_1555_REV:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_16_BIT_4444_REV:
-				bytesPerPixel = 2;
-				break;
-			case PACKED_32_BIT_8888_REV:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_32_BIT_2101010_REV:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_32_BIT_101111_REV:
-				bytesPerPixel = 4;
-				break;
-			case PACKED_32_BIT_5999_REV:
-				bytesPerPixel = 4;
-				break;
-			default:
-				break;
-		}
-		
-		if(format.getBitDepth().ordinal() < BitDepth.NUM_PER_COMPONENT.ordinal()) {
-			bytesPerPixel *= calcComponentCount(format.getPixelComponents());
-		}
-		
-		return bytesPerPixel;
-	}
-	
-	static int calcComponentCount(PixelComponents component) {
-		PixelComponents[] twoCompFormats = { PixelComponents.COLOR_RG, PixelComponents.DEPTH_X };
-		PixelComponents[] threeCompFormats = { PixelComponents.COLOR_RGB, PixelComponents.COLOR_RGB_SRGB };
-		PixelComponents[] fourCompFormats = { PixelComponents.COLOR_RGBX, PixelComponents.COLOR_RGBA,
-				PixelComponents.COLOR_RGBX_SRGB, PixelComponents.COLOR_RGBA_SRGB };
-		
-		if(isOneOfThese(component, twoCompFormats)) {
-			return 2;
-		}
-		
-		if(isOneOfThese(component, threeCompFormats)) {
-			return 3;
-		}
-		
-		if(isOneOfThese(component, fourCompFormats)) {
-			return 4;
-		}
-		
-		return 1;
-	}
-	
-	static class CompressedBlockData {
-		Dimensions dimensions;
-		int byteCount;
-	}
-	
-	static CompressedBlockData getBlockCompressionData(PixelDataType pixelDataType) {
-		assert pixelDataType.ordinal() >= PixelDataType.NUM_UNCOMPRESSED_TYPES.ordinal();
-		
-		CompressedBlockData blockData = new CompressedBlockData();
-		blockData.dimensions = new Dimensions();
-		blockData.dimensions.numDimensions = 2;
-		blockData.dimensions.width = 4;
-		blockData.dimensions.height = 4;
-		
-		switch(pixelDataType) {
-			case COMPRESSED_BC1:
-			case COMPRESSED_UNSIGNED_BC4:
-			case COMPRESSED_SIGNED_BC4:
-				blockData.byteCount = 8;
-				break;
-			
-			default:
-				blockData.byteCount = 16;
-				break;
-		}
-		
-		return blockData;
-	}
-	
-	static int calcMipmapLevelSize(ImageFormat imageFormat, Dimensions mipmapLevelDimensions) {
-		if(imageFormat.getPixelDataType().ordinal() >= PixelDataType.NUM_UNCOMPRESSED_TYPES.ordinal()) {
-			
-			if(mipmapLevelDimensions.numDimensions == 3)
-				throw new IllegalArgumentException("No support for 3D compressed formats.");
-			
-			CompressedBlockData blockData = getBlockCompressionData(imageFormat.getPixelDataType());
-			int width = (mipmapLevelDimensions.width + (blockData.dimensions.width - 1)) / blockData.dimensions.width;
-			int height;
-			
-			if(mipmapLevelDimensions.numDimensions > 1) {
-				height = (mipmapLevelDimensions.height + (blockData.dimensions.height - 1)) / blockData.dimensions.height;
-			} else {
-				if(blockData.dimensions.numDimensions < 2)
-					throw new IllegalArgumentException("numDimensions must be greater than 2");
-				
-				height = blockData.dimensions.height;
-			}
-			
-			return width * height * blockData.byteCount;