Changeset 155a7cf in opengl-game for new-game.cpp


Ignore:
Timestamp:
May 10, 2019, 7:42:17 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
bae0911
Parents:
e6bc0f4
Message:

Replace printf with cout and cerr in new-game.cpp and logger.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    re6bc0f4 r155a7cf  
    306306   glfwSetErrorCallback(glfw_error_callback);
    307307   if (!glfwInit()) {
    308       fprintf(stderr, "ERROR: could not start GLFW3\n");
     308      cerr << "ERROR: could not start GLFW3" << endl;
    309309      return 1;
    310310   }
     
    337337
    338338   if (!window) {
    339       fprintf(stderr, "ERROR: could not open window with GLFW3\n");
     339      cerr << "ERROR: could not open window with GLFW3" << endl;;
    340340      glfwTerminate();
    341341      return 1;
     
    414414   // glFrontFace(GL_CW);
    415415
    416    /*
    417    int x, y;
    418    unsigned char* texImage = loadImage("test.png", &x, &y);
    419    if (texImage) {
    420      cout << "Yay, I loaded an image!" << endl;
    421      cout << x << endl;
    422      cout << y << endl;
    423      printf("first 4 bytes are: %i %i %i %i\n", texImage[0], texImage[1], texImage[2], texImage[3]);
    424    }
    425 
    426    GLuint testTex = 0;
    427    glGenTextures(1, &testTex);
    428    glActiveTexture(GL_TEXTURE0);
    429    glBindTexture(GL_TEXTURE_2D, testTex);
    430    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, texImage);
    431 
    432    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    433    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    434    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    435    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    436    */
    437 
    438416   int x, y;
    439417   unsigned char* texImage = loadImage("laser.png", &x, &y);
    440418   if (texImage) {
    441419      cout << "Laser texture loaded successfully!" << endl;
    442       cout << x << endl;
    443       cout << y << endl;
    444       printf("first 4 bytes are: %i %i %i %i\n", texImage[0], texImage[1], texImage[2], texImage[3]);
     420      cout << x << ", " << y << endl;
     421      cout << "first 4 bytes are: " << texImage[0] << " " << texImage[1] << " " << texImage[2] << " " << texImage[3] << endl;
    445422   }
    446423
     
    12401217
    12411218  if (!image_data) {
    1242     fprintf(stderr, "ERROR: could not load %s\n", file_name.c_str());
     1219    cerr << "ERROR: could not load " << file_name << endl;
    12431220  }
    12441221
    12451222  // Not Power-of-2 check
    12461223  if ((*x & (*x - 1)) != 0 || (*y & (*y - 1)) != 0) {
    1247      fprintf(stderr, "WARNING: texture %s is not power-of-2 dimensions\n", file_name.c_str());
     1224     cerr << "WARNING: texture " << file_name << " is not power-of-2 dimensions" << endl;
    12481225  }
    12491226
Note: See TracChangeset for help on using the changeset viewer.