Changeset 155a7cf in opengl-game
- Timestamp:
- May 10, 2019, 7:42:17 PM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- bae0911
- Parents:
- e6bc0f4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
logger.cpp
re6bc0f4 r155a7cf 4 4 #include <ctime> 5 5 #include <cstdarg> 6 #include <iostream> 7 8 using namespace std; 6 9 7 10 bool restart_gl_log() { 8 11 FILE* file = fopen(GL_LOG_FILE, "w"); 9 12 if (!file) { 10 fprintf(stderr, "ERROR: could not open GL_LOG_FILE log file %s for writing\n", GL_LOG_FILE);13 cerr << "ERROR: could not open GL_LOG_FILE log file " << GL_LOG_FILE << " for writing" << endl; 11 14 return false; 12 15 } … … 22 25 FILE* file = fopen(GL_LOG_FILE, "a"); 23 26 if (!file) { 24 fprintf(stderr, "ERROR: could not open GL_LOG_FILE log file %s for appending\n", GL_LOG_FILE);27 cerr << "ERROR: could not open GL_LOG_FILE log file " << GL_LOG_FILE << " for appending" << endl; 25 28 return false; 26 29 } … … 37 40 FILE* file = fopen(GL_LOG_FILE, "a"); 38 41 if (!file) { 39 fprintf(stderr, "ERROR: could not open GL_LOG_FILE log file %s for appending\n", GL_LOG_FILE);42 cerr << "ERROR: could not open GL_LOG_FILE log file " << GL_LOG_FILE << " for appending" << endl; 40 43 return false; 41 44 } -
new-game.cpp
re6bc0f4 r155a7cf 306 306 glfwSetErrorCallback(glfw_error_callback); 307 307 if (!glfwInit()) { 308 fprintf(stderr, "ERROR: could not start GLFW3\n");308 cerr << "ERROR: could not start GLFW3" << endl; 309 309 return 1; 310 310 } … … 337 337 338 338 if (!window) { 339 fprintf(stderr, "ERROR: could not open window with GLFW3\n");339 cerr << "ERROR: could not open window with GLFW3" << endl;; 340 340 glfwTerminate(); 341 341 return 1; … … 414 414 // glFrontFace(GL_CW); 415 415 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 438 416 int x, y; 439 417 unsigned char* texImage = loadImage("laser.png", &x, &y); 440 418 if (texImage) { 441 419 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; 445 422 } 446 423 … … 1240 1217 1241 1218 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; 1243 1220 } 1244 1221 1245 1222 // Not Power-of-2 check 1246 1223 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; 1248 1225 } 1249 1226
Note:
See TracChangeset
for help on using the changeset viewer.