I want to display different matrices on screen. Therefore I create one window for each matrix, which works just fine, but now I have the problem that glutDisplayFunc() doesn’t take parameters. Currently I’m using a global variable holding the id of the matrix to use, but this works just at the first drawing, when resizeing the window the id is incorrect.
So how can I distinguish between different windows within one DisplayFunc?
I mean is there a possibilty to query the window name or id?
Ah, well, you can start by checking the docs for glutCreateWindow, which returns an identifier int. I’ve never used multiple windows,
but according to the docs, glutGetWindow() is probably what you want.
If that doesn’t work, you can always wrap your display function. Have display_mat_points take an integer for the the window idea and instead of passing glutDisplayFunc(display_mat_points), give it a wrapper like glutDisplayFunc(wrapDisplayMatPoints0)
where
void wrapDisplayMapPoints0(void) {
display_mat_points(0); // tells display_mat_points it is rendering is window 0
}