4 glut windows in 1

Anyone know how to combine all 4 windows below into one that we can apply transformation to each windows individual or share(1 windows for xy plane, 1 windows for yz plane, 1 windows for xz plan, 1 windows for projection) but have on 1 windows, when you drag, it’s move all 4.

main_window1 = glutCreateWindow( “GLUT Example 1” );
main_window2 = glutCreateWindow( “GLUT Example 2” );
main_window3 = glutCreateWindow( “GLUT Example 3” );
main_window4 = glutCreateWindow( “GLUT Example 4” );

if im not mistaken this would be done using viewports not windows…

so how do I do it with viewport?

Create one large window, then use glViewport to tell OpenGL to draw only to a part of the window. Like this.

// Draw to lower left quarter
glViewport(0, 0, windowWidth / 2, windowHeight / 2);
DrawScene();

// Draw to lower right quarter
glViewport(windowWidth / 2, 0, windowWidth / 2, windowHeight / 2);
DrawScene();

And so on, for each quarter.