瀏覽代碼

Fixed memory leak caused by glutMainLoop() not returning.

Fixed memory leak by allowing glutMainLoop() to return to allow for the scene and streams to be released.
Marc-Antoine Lortie 5 年之前
父節點
當前提交
c620e9a2ac
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      samples/SimpleOpenGL/Sample_SimpleOpenGL.c

+ 3 - 2
samples/SimpleOpenGL/Sample_SimpleOpenGL.c

@@ -15,9 +15,9 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
-#include <glut.h>
+#include <freeglut.h>
 #else
 #else
-#include <GL/glut.h>
+#include <GL/freeglut.h>
 #endif
 #endif
 
 
 /* assimp include files. These three are usually needed. */
 /* assimp include files. These three are usually needed. */
@@ -392,6 +392,7 @@ int main(int argc, char **argv)
 	glutInitWindowPosition(100,100);
 	glutInitWindowPosition(100,100);
 	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
 	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
 	glutInit(&argc, argv);
 	glutInit(&argc, argv);
+	glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
 
 
 	glutCreateWindow("Assimp - Very simple OpenGL sample");
 	glutCreateWindow("Assimp - Very simple OpenGL sample");
 	glutDisplayFunc(display);
 	glutDisplayFunc(display);