Index: TODO.txt
===================================================================
--- TODO.txt	(revision 155a7cf4493be840223cd052b50c47a118d2128c)
+++ TODO.txt	(revision bae0911ecc49d0e4a36b7cca47ca87dc1a86d693)
@@ -2,7 +2,9 @@
 ==========
 -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.
+ - What I really need to do is completely refactor the logger class to return an ofstream to the logger file
+   and use streaming to send output to it. The log file can be closed in the destructor.
 -Add code to allow for resizing/maximizing the window
--Add logic to make imgui element placement depedent on the window size so it works in fullscreen
+ - Doesn't seem to be necessary on OSX anymore, check that in works on Window and Linux, including removing
+   the window title bar in fullscreen mode and bringing it back in windowed mode
 -Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params
 -Move some common functions into a Utils class
@@ -13,4 +15,5 @@
 -Fix the texture-mapping code to not flip the texture upside down.
 -Make sure fullscreen works correctly on OSX. Check the book to see how to handle Retina Display.
+-Change all error messages to use the logger class so they get printed to the log file as well.
 
 NEW TODO
Index: logger.cpp
===================================================================
--- logger.cpp	(revision 155a7cf4493be840223cd052b50c47a118d2128c)
+++ logger.cpp	(revision bae0911ecc49d0e4a36b7cca47ca87dc1a86d693)
@@ -5,6 +5,4 @@
 #include <cstdarg>
 #include <iostream>
-
-using namespace std;
 
 bool restart_gl_log() {
@@ -15,11 +13,11 @@
    }
    time_t now = time(NULL);
-   char* date = ctime(&now);
-   fprintf(file, "GL_LOG_FILE log. local time %s\n", date);
+   string date(ctime(&now));
+   fprintf(file, "GL_LOG_FILE log. local time %s\n", date.c_str());
    fclose(file);
    return true;
 }
 
-bool gl_log(const char* message, ...) {
+bool gl_log(const string message, ...) {
    va_list argptr;
    FILE* file = fopen(GL_LOG_FILE, "a");
@@ -28,6 +26,6 @@
       return false;
    }
-   va_start(argptr, message);
-   vfprintf(file, message, argptr);
+   va_start(argptr, message.c_str());
+   vfprintf(file, message.c_str(), argptr);
    va_end(argptr);
    fprintf(file, "\n");
@@ -36,5 +34,5 @@
 }
 
-bool gl_log_err(const char* message, ...) {
+bool gl_log_err(const string message, ...) {
    va_list argptr;
    FILE* file = fopen(GL_LOG_FILE, "a");
@@ -43,10 +41,10 @@
       return false;
    }
-   va_start(argptr, message);
-   vfprintf(file, message, argptr);
+   va_start(argptr, message.c_str());
+   vfprintf(file, message.c_str(), argptr);
    va_end(argptr);
    fprintf(file, "\n");
-   va_start(argptr, message);
-   vfprintf(stderr, message, argptr);
+   va_start(argptr, message.c_str());
+   vfprintf(stderr, message.c_str(), argptr);
    va_end(argptr);
    fprintf(stderr, "\n");
Index: logger.h
===================================================================
--- logger.h	(revision 155a7cf4493be840223cd052b50c47a118d2128c)
+++ logger.h	(revision bae0911ecc49d0e4a36b7cca47ca87dc1a86d693)
@@ -1,10 +1,14 @@
 #ifndef LOGGER_H
 #define LOGGER_H
+
+#include <string>
+
+using namespace std;
 
 #define GL_LOG_FILE "gl.log"
 
 bool restart_gl_log();
-bool gl_log(const char* message, ...);
-bool gl_log_err(const char* message, ...);
+bool gl_log(const string message, ...);
+bool gl_log_err(const string message, ...);
 
 #endif
Index: new-game.cpp
===================================================================
--- new-game.cpp	(revision 155a7cf4493be840223cd052b50c47a118d2128c)
+++ new-game.cpp	(revision bae0911ecc49d0e4a36b7cca47ca87dc1a86d693)
@@ -301,10 +301,10 @@
    cout << "New OpenGL Game" << endl;
 
-   if (!restart_gl_log()) {}
-   gl_log("starting GLFW\n%s\n", glfwGetVersionString());
+   restart_gl_log();
+   gl_log("starting GLFW\n%s", glfwGetVersionString());
 
    glfwSetErrorCallback(glfw_error_callback);
    if (!glfwInit()) {
-      cerr << "ERROR: could not start GLFW3" << endl;
+      gl_log_err("ERROR: could not start GLFW3");
       return 1;
    }
@@ -337,5 +337,5 @@
 
    if (!window) {
-      cerr << "ERROR: could not open window with GLFW3" << endl;;
+      gl_log_err("ERROR: could not open window with GLFW3");
       glfwTerminate();
       return 1;
@@ -403,5 +403,8 @@
    const GLubyte* version = glGetString(GL_VERSION);
    cout << "Renderer: " << renderer << endl;
-   cout << "OpenGL version supported " << version << endl;
+   cout << "Supported OpenGL version: " << version << endl;
+
+   gl_log("Renderer: %s", renderer);
+   gl_log("Supported OpenGL version: %s", version);
 
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -976,5 +979,5 @@
 
 void glfw_error_callback(int error, const char* description) {
-   gl_log_err("GLFW ERROR: code %i msg: %s\n", error, description);
+   gl_log_err("GLFW ERROR: code %i msg: %s", error, description);
 }
 
@@ -1217,10 +1220,10 @@
 
   if (!image_data) {
-    cerr << "ERROR: could not load " << file_name << endl;
+    gl_log_err("ERROR: could not load %s", file_name.c_str());
   }
 
   // Not Power-of-2 check
   if ((*x & (*x - 1)) != 0 || (*y & (*y - 1)) != 0) {
-     cerr << "WARNING: texture " << file_name << " is not power-of-2 dimensions" << endl;
+     gl_log_err("WARNING: texture %s is not power-of-2 dimensions", file_name.c_str());
   }
 
