本文整理汇总了C++中Triangle::Cleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangle::Cleanup方法的具体用法?C++ Triangle::Cleanup怎么用?C++ Triangle::Cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangle
的用法示例。
在下文中一共展示了Triangle::Cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
// GLFW Initialization
if(!glfwInit()) {
fprintf(stderr, "Failed to initialize GLFW\n");
return EXIT_FAILURE;
}
glfwSetErrorCallback(ErrorCallback);
// hint GLFW that we would like an OpenGL 3 context (at least)
// http://www.glfw.org/faq.html#how-do-i-create-an-opengl-30-context
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// attempt to open the window: fails if required version unavailable
// note some Intel GPUs do not support OpenGL 3.2
// note update the driver of your graphic card
GLFWwindow* window = glfwCreateWindow(512, 512, "spiral", NULL, NULL);
if(!window) {
glfwTerminate();
return EXIT_FAILURE;
}
// makes the OpenGL context of window current on the calling thread
glfwMakeContextCurrent(window);
// set the callback for escape key
glfwSetKeyCallback(window, KeyCallback);
// GLEW Initialization (must have a context)
// https://www.opengl.org/wiki/OpenGL_Loading_Library
glewExperimental = GL_TRUE; // fixes glew error (see above link)
if(glewInit() != GLEW_NO_ERROR) {
fprintf( stderr, "Failed to initialize GLEW\n");
return EXIT_FAILURE;
}
cout << "OpenGL" << glGetString(GL_VERSION) << endl;
// initialize our OpenGL program
Init();
// render loop
while(!glfwWindowShouldClose(window)) {
Display();
glfwSwapBuffers(window);
glfwPollEvents();
}
triangle.Cleanup();
// close OpenGL window and terminate GLFW
glfwDestroyWindow(window);
glfwTerminate();
return EXIT_SUCCESS;
}