Index: NewOpenGLGame.vcxproj
===================================================================
--- NewOpenGLGame.vcxproj	(revision 267c4c5e5e67062740831e1060f06db06cef41f7)
+++ NewOpenGLGame.vcxproj	(revision e856d620188313a1569bd209e14af7b079e33894)
@@ -135,4 +135,5 @@
   <ItemGroup>
     <Text Include="gl.log" />
+    <Text Include="TODO.txt" />
   </ItemGroup>
   <ItemGroup>
Index: TODO.txt
===================================================================
--- TODO.txt	(revision e856d620188313a1569bd209e14af7b079e33894)
+++ TODO.txt	(revision e856d620188313a1569bd209e14af7b079e33894)
@@ -0,0 +1,13 @@
+TODO
+=====
+-Change the logger class to use cout instead of printf. Consider how easy variable argument support would be.
+-Change all error messages to use the logger class so they get printed to the log file as well.
+-Make sure fullscreen works correctly on OSX. Check the book to see how to handle Retina Display.
+-Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params
+-Add code to allow for resizing/maximizing the window
+-Move some common functions into a Utils class
+
+DONE
+=====
+-Print a warning if texture images don't sizes of 2^x
+-Fix the texture-mapping code to not flip the texture upside down.
Index: new-game.cpp
===================================================================
--- new-game.cpp	(revision 267c4c5e5e67062740831e1060f06db06cef41f7)
+++ new-game.cpp	(revision e856d620188313a1569bd209e14af7b079e33894)
@@ -147,17 +147,15 @@
 
    GLFWwindow* window = NULL;
+   GLFWmonitor* mon = NULL;
 
    if (FULLSCREEN) {
-      GLFWmonitor* mon = glfwGetPrimaryMonitor();
+      mon = glfwGetPrimaryMonitor();
       const GLFWvidmode* vmode = glfwGetVideoMode(mon);
-
-      cout << "Fullscreen resolution " << vmode->width << "x" << vmode->height << endl;
-      window = glfwCreateWindow(vmode->width, vmode->height, "Extended GL Init", mon, NULL);
 
       width = vmode->width;
       height = vmode->height;
-   } else {
-      window = glfwCreateWindow(width, height, "Hello Triangle", NULL, NULL);
+      cout << "Fullscreen resolution " << vmode->width << "x" << vmode->height << endl;
    }
+   window = glfwCreateWindow(width, height, "New OpenGL Game", mon, NULL);
 
    if (!window) {
@@ -172,8 +170,4 @@
    glewExperimental = GL_TRUE;
    glewInit();
-
-   // Check the extended initialization section of the book to learn how to use this
-   // Maybe move this and other OpenGL setup/settings code into a separate function
-   // glViewport(0, 0, width*2, height*2);
 
    const GLubyte* renderer = glGetString(GL_RENDERER);
@@ -195,5 +189,5 @@
      cout << x << endl;
      cout << y << endl;
-     printf ("first 4 bytes are: %i %i %i %i\n", texImage[0], texImage[1], texImage[2], texImage[3]);
+     printf("first 4 bytes are: %i %i %i %i\n", texImage[0], texImage[1], texImage[2], texImage[3]);
    }
 
@@ -560,5 +554,5 @@
     cout << "Loaded successfully" << endl;
   } else {
-    cout << "Failed to loade the file" << endl;
+    cout << "Failed to load the file" << endl;
   }
 
@@ -581,9 +575,35 @@
 unsigned char* loadImage(string file_name, int* x, int* y) {
   int n;
-  int force_channels = 4;
+  int force_channels = 4; // This forces RGBA (4 bytes per pixel)
   unsigned char* image_data = stbi_load(file_name.c_str(), x, y, &n, force_channels);
+
+  int width_in_bytes = *x * 4;
+  unsigned char *top = NULL;
+  unsigned char *bottom = NULL;
+  unsigned char temp = 0;
+  int half_height = *y / 2;
+
+  // flip image upside-down to account for OpenGL treating lower-left as (0, 0)
+  for (int row = 0; row < half_height; row++) {
+     top = image_data + row * width_in_bytes;
+     bottom = image_data + (*y - row - 1) * width_in_bytes;
+     for (int col = 0; col < width_in_bytes; col++) {
+        temp = *top;
+        *top = *bottom;
+        *bottom = temp;
+        top++;
+        bottom++;
+     }
+  }
+
   if (!image_data) {
     fprintf(stderr, "ERROR: could not load %s\n", file_name.c_str());
   }
+
+  // Not Power-of-2 check
+  if ((*x & (*x - 1)) != 0 || (*y & (*y - 1)) != 0) {
+     fprintf(stderr, "WARNING: texture %s is not power-of-2 dimensions\n", file_name.c_str());
+  }
+
   return image_data;
 }
