I am trying to create 2 different rendering windows using OpenGL.
My code looks like:

void display1(){...}
void display2(){...}

void init(){... //some declarations and function calls pertaining to display2}

int main(){
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(1024,512);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("Window 1");
	glutDisplayFunc(display1);

	glutPositionWindow(520,20);
	glutCreateWindow("Window 2");
	init();
	glutDisplayFunc(display2);	

	glutMainLoop();
	return 0;
}

The code runs fine but my problem is that the both windows have same size i.e. 1024*512. I want the size of Window2 to be 512*512. I tried to insert the line "glutWindowSize(512,512);" before the line "glutPositionWindow(520,20);" but the program crashes if I do so. Is there any way to resize Window2?

Thanks in advance for your help

Is there a way of resizing the window through your program after it's been created?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.