MCPcopy Create free account
hub / github.com/cginternals/globjects / main

Function main

source/examples/programpipelines/main.cpp:137–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137int main(int /*argc*/, char * /*argv*/[])
138{
139 // Initialize GLFW
140 if (!glfwInit())
141 return 1;
142
143 glfwSetErrorCallback(error);
144 glfwDefaultWindowHints();
145 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
146 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
147 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true);
148
149 // Create a context and, if valid, make it current
150 GLFWwindow * window = glfwCreateWindow(640, 480, "globjects Progam Pipelines", NULL, NULL);
151 if (window == nullptr)
152 {
153 globjects::critical() << "Context creation failed. Terminate execution.";
154
155 glfwTerminate();
156 return -1;
157 }
158 glfwSetKeyCallback(window, key_callback);
159 glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
160
161 glfwMakeContextCurrent(window);
162
163 // Initialize globjects (internally initializes glbinding, and registers the current context)
164 globjects::init();
165
166 std::cout << std::endl
167 << "OpenGL Version: " << glbinding::ContextInfo::version() << std::endl
168 << "OpenGL Vendor: " << glbinding::ContextInfo::vendor() << std::endl
169 << "OpenGL Renderer: " << glbinding::ContextInfo::renderer() << std::endl << std::endl;
170
171 glfwGetFramebufferSize(window, &g_size[0], &g_size[1]);
172 initialize();
173
174 // Main loop
175 while (!glfwWindowShouldClose(window))
176 {
177 glfwPollEvents();
178 draw();
179 glfwSwapBuffers(window);
180 }
181 deinitialize();
182
183 // Properly shutdown GLFW
184 glfwTerminate();
185
186 return 0;
187}

Callers

nothing calls this directly

Calls 8

criticalFunction · 0.85
initFunction · 0.85
versionFunction · 0.85
vendorFunction · 0.85
rendererFunction · 0.85
initializeFunction · 0.70
drawFunction · 0.70
deinitializeFunction · 0.70

Tested by

no test coverage detected