Changeset 155a7cf in opengl-game for new-game.cpp
- Timestamp:
- May 10, 2019, 7:42:17 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- bae0911
- Parents:
- e6bc0f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.