Changeset 772d8c7 in opengl-game for new-game.cpp
- Timestamp:
- Aug 3, 2017, 3:03:21 AM (7 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- c40990d
- Parents:
- be246ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
rbe246ad r772d8c7 9 9 using namespace std; 10 10 11 const bool FULLSCREEN = true; 12 13 void glfw_error_callback(int error, const char* description) { 14 gl_log_err("GLFW ERROR: code %i msg: %s\n", error, description); 15 } 16 11 17 int main(int argc, char* argv[]) { 12 18 cout << "New OpenGL Game" << endl; 13 19 14 restart_gl_log(); 20 if (!restart_gl_log()) {} 21 gl_log("starting GLFW\n%s\n", glfwGetVersionString()); 15 22 23 glfwSetErrorCallback(glfw_error_callback); 16 24 if (!glfwInit()) { 17 25 fprintf(stderr, "ERROR: could not start GLFW3\n"); … … 26 34 #endif 27 35 28 GLFWwindow* window = glfwCreateWindow(640, 480, "Hello Triangle", NULL, NULL); 36 glfwWindowHint(GLFW_SAMPLES, 4); 37 38 GLFWwindow* window = NULL; 39 40 if (FULLSCREEN) { 41 GLFWmonitor* mon = glfwGetPrimaryMonitor(); 42 const GLFWvidmode* vmode = glfwGetVideoMode(mon); 43 window = glfwCreateWindow(vmode->width, vmode->height, "Extended GL Init", mon, NULL); 44 } else { 45 window = glfwCreateWindow(640, 480, "Hello Triangle", NULL, NULL); 46 } 47 29 48 if (!window) { 30 49 fprintf(stderr, "ERROR: could not open window with GLFW3\n"); … … 93 112 glBindVertexArray(vao); 94 113 glDrawArrays(GL_TRIANGLES, 0, 3); 114 95 115 glfwPollEvents(); 96 116 glfwSwapBuffers(window); 117 118 if (GLFW_PRESS == glfwGetKey(window, GLFW_KEY_ESCAPE)) { 119 glfwSetWindowShouldClose(window, 1); 120 } 97 121 } 98 122
Note:
See TracChangeset
for help on using the changeset viewer.