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

Function main

source/examples/transformfeedback/main.cpp:198–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197
198int main(int /*argc*/, char * /*argv*/[])
199{
200 // Initialize GLFW
201 if (!glfwInit())
202 return 1;
203
204 glfwSetErrorCallback(error);
205 glfwDefaultWindowHints();
206 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
207 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
208 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true);
209
210 // Create a context and, if valid, make it current
211 GLFWwindow * window = glfwCreateWindow(640, 480, "globjects Transform Feedback", NULL, NULL);
212 if (window == nullptr)
213 {
214 globjects::critical() << "Context creation failed. Terminate execution.";
215
216 glfwTerminate();
217 return -1;
218 }
219 glfwSetKeyCallback(window, key_callback);
220 glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
221
222 glfwMakeContextCurrent(window);
223
224 // Initialize globjects (internally initializes glbinding, and registers the current context)
225 globjects::init();
226
227 std::cout << std::endl
228 << "OpenGL Version: " << glbinding::ContextInfo::version() << std::endl
229 << "OpenGL Vendor: " << glbinding::ContextInfo::vendor() << std::endl
230 << "OpenGL Renderer: " << glbinding::ContextInfo::renderer() << std::endl << std::endl;
231
232 globjects::info() << "Press F5 to reload shaders." << std::endl << std::endl;
233
234 glfwGetFramebufferSize(window, &g_size[0], &g_size[1]);
235 initialize();
236
237 // Main loop
238 while (!glfwWindowShouldClose(window))
239 {
240 glfwPollEvents();
241 draw();
242 glfwSwapBuffers(window);
243 }
244 deinitialize();
245
246 // Properly shutdown GLFW
247 glfwTerminate();
248
249 return 0;
250}

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected