Viewport and other help needed please

I’m going to post my code but I will explain what I need help with first.

I’m currently trying to setup my project and have two wireframe teapots appear on the screen, one in orthographic view and one in perspective view.

I have drawn two windows and I think the code is right for the different type of viewports (ortho and perspective) but it is what I want to do after this that is stalling me.

In the orthographic view I want to be able to view the x,y,z axis by pressing their keys respectively without the teapot in the perspective window moving also, and in perspective view I want to be able to use the arrow keys to rotate around the teapot without the ortho teapot moving.

My main problem is that I dont know how to separate the teapots so I can do this, I think my windows are setup correctly but I’m just having a tonne of trouble. Code is posted below



#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>

static int WIN_H = 800; /* window height */
static int WIN_W = 800; /* window width */
static int WIN_POS_X = 200; /* window's x position */
static int WIN_POS_Y = 0; /* window's y position */

float xAngle;
float yAngle;
float zAngle;

void drawTeapot() 
{
	glRotatef(xAngle,1.0,0.0,0.0);
	glRotatef(yAngle,0.0,1.0,0.0);
	glColor3f(150.0,200.0,100.0);
	glutWireTeapot(0.5);
	glFlush ();
}

void display()
{
	glClearColor(0.0,1.0,0.0,1.0);
	glClear (GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	glViewport(0,0,WIN_W/2,WIN_H);
	gluPerspective(45.0,1.0* WIN_W/WIN_H,1.0,100.0);
	glTranslatef(0.0,0.0,-10.0);
	drawTeapot();
	

	glLoadIdentity();
	glOrtho(0.0,WIN_W,0.0,WIN_H,0.0,0.0);
	glMatrixMode(GL_MODELVIEW);
	glViewport(WIN_W/2,0,WIN_W/2,WIN_H);
	drawTeapot();
	glFlush();
}

void keyboard (unsigned char key, int x, int y) {
	
if (key=='q')
{
exit(1);
}

if(key == 'x')
{
	xAngle = 0.0;
	yAngle = 0.0;
	
	glutPostRedisplay();
}

if(key == 'y')
{
	
	xAngle = 90.0;
	yAngle = 0.0;
	
	glutPostRedisplay();
}
if(key == 'z')
{
	xAngle = 0.0;
	yAngle = 120.0;
	
	glutPostRedisplay();
	
}

}

int main(int argc, char* argv[])
{	
	
   glutInit(&argc,argv);
   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
   glutInitWindowSize(WIN_W,WIN_H);
   glutInitWindowPosition(WIN_POS_X, WIN_POS_Y);
   glutCreateWindow("OPENGL PROGRAM");

   
   glutDisplayFunc(display); 
   glutKeyboardFunc(keyboard);
   glutMainLoop();
	return 0;
}



help plz

nevermind, fixed it myslef lol