So the main question is: where the glut window number will be stored and how will be accessed?
To quickly add glut.DestroyWindow function do the following:
- Edit luaglut.c file.
- Add new line after all #include directives, such as:
int window;
- Prepend line in function glut_create_window with window= so it look like this:
window = glutCreateWindow((const char *)lua_tostring(L, 1));
- Add new function glut_destroy_window:
static int glut_destroy_window(lua_State *L) { glutDestroyWindow(window); return 0; }
- Add new constant into glutlib at the end of file
{"DestroyWindow", glut_destroy_window}
That is it.