| 38 | |
| 39 | |
| 40 | int main(int, char *[]) |
| 41 | { |
| 42 | glfwSetErrorCallback(error); |
| 43 | |
| 44 | if (!glfwInit()) |
| 45 | return 1; |
| 46 | |
| 47 | glfwDefaultWindowHints(); |
| 48 | |
| 49 | #ifdef SYSTEM_DARWIN |
| 50 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
| 51 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
| 52 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true); |
| 53 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
| 54 | #endif |
| 55 | |
| 56 | // Initialize window 1 |
| 57 | |
| 58 | GLFWwindow * window1 = glfwCreateWindow(640, 480, "", nullptr, nullptr); |
| 59 | if (!window1) |
| 60 | { |
| 61 | glfwTerminate(); |
| 62 | return -1; |
| 63 | } |
| 64 | |
| 65 | glfwSetKeyCallback(window1, key_callback); |
| 66 | |
| 67 | glfwMakeContextCurrent(window1); |
| 68 | |
| 69 | glbinding::initialize(0, glfwGetProcAddress, true, false); // only resolve functions that are actually used (lazy) |
| 70 | glbinding::aux::enableGetErrorCallback(); |
| 71 | |
| 72 | // Initialize window 2 |
| 73 | |
| 74 | GLFWwindow * window2 = glfwCreateWindow(640, 480, "", nullptr, nullptr); |
| 75 | if (!window2) |
| 76 | { |
| 77 | glfwTerminate(); |
| 78 | return -1; |
| 79 | } |
| 80 | |
| 81 | glfwMakeContextCurrent(window2); |
| 82 | |
| 83 | glfwSetKeyCallback(window2, key_callback); |
| 84 | |
| 85 | glbinding::initialize(1, glfwGetProcAddress, true, false); // only resolve functions that are actually used (lazy) |
| 86 | glbinding::aux::enableGetErrorCallback(); |
| 87 | |
| 88 | // print some gl infos (query) |
| 89 | |
| 90 | std::cout << std::endl |
| 91 | << "OpenGL Version: " << aux::ContextInfo::version() << std::endl |
| 92 | << "OpenGL Vendor: " << aux::ContextInfo::vendor() << std::endl |
| 93 | << "OpenGL Renderer: " << aux::ContextInfo::renderer() << std::endl; |
| 94 | |
| 95 | // Rendering Loop |
| 96 | |
| 97 | int width, height; |
nothing calls this directly
no test coverage detected