Changeset bae0911 in opengl-game for new-game.cpp


Ignore:
Timestamp:
May 10, 2019, 9:09:49 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
caa2359
Parents:
155a7cf
Message:

Update logging code to send all errors to the log file as well as the console

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    r155a7cf rbae0911  
    301301   cout << "New OpenGL Game" << endl;
    302302
    303    if (!restart_gl_log()) {}
    304    gl_log("starting GLFW\n%s\n", glfwGetVersionString());
     303   restart_gl_log();
     304   gl_log("starting GLFW\n%s", glfwGetVersionString());
    305305
    306306   glfwSetErrorCallback(glfw_error_callback);
    307307   if (!glfwInit()) {
    308       cerr << "ERROR: could not start GLFW3" << endl;
     308      gl_log_err("ERROR: could not start GLFW3");
    309309      return 1;
    310310   }
     
    337337
    338338   if (!window) {
    339       cerr << "ERROR: could not open window with GLFW3" << endl;;
     339      gl_log_err("ERROR: could not open window with GLFW3");
    340340      glfwTerminate();
    341341      return 1;
     
    403403   const GLubyte* version = glGetString(GL_VERSION);
    404404   cout << "Renderer: " << renderer << endl;
    405    cout << "OpenGL version supported " << version << endl;
     405   cout << "Supported OpenGL version: " << version << endl;
     406
     407   gl_log("Renderer: %s", renderer);
     408   gl_log("Supported OpenGL version: %s", version);
    406409
    407410   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     
    976979
    977980void glfw_error_callback(int error, const char* description) {
    978    gl_log_err("GLFW ERROR: code %i msg: %s\n", error, description);
     981   gl_log_err("GLFW ERROR: code %i msg: %s", error, description);
    979982}
    980983
     
    12171220
    12181221  if (!image_data) {
    1219     cerr << "ERROR: could not load " << file_name << endl;
     1222    gl_log_err("ERROR: could not load %s", file_name.c_str());
    12201223  }
    12211224
    12221225  // Not Power-of-2 check
    12231226  if ((*x & (*x - 1)) != 0 || (*y & (*y - 1)) != 0) {
    1224      cerr << "WARNING: texture " << file_name << " is not power-of-2 dimensions" << endl;
     1227     gl_log_err("WARNING: texture %s is not power-of-2 dimensions", file_name.c_str());
    12251228  }
    12261229
Note: See TracChangeset for help on using the changeset viewer.