PDA

View Full Version : multi windows at multi-display environment



tgbt
11-08-2006, 11:38 PM
Hi.

I have a Linux(FC6) PC having two GeForce video cards and using them as a multi-display environment.
There, the DISPLAY environment value in terminal of first display is :0.0, and the value in terminal of second display is :0.1.
So, I want to show tow windows, one window is in first display, and another one windows is in second display.
From document, glutInit function's argument can control the output display, so I wrote program as below:

GLuint glutWindowHandle[2];

void display0(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

void display1(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

int main()
{
{
int argc = 3;
char *argv[] = {"test_0", "-display", ":0.0"};
glutInit ( &argc, argv );
glutWindowHandle[0] = glutCreateWindow("test 0");
glutInitDisplayMode(GLUT_RGBA);
glutDisplayFunc(display0);
glClearColor(0.0, 0.0, 1.0, 1.0);
}
{
int argc = 3;
char *argv[] = {"test_1", "-display", ":0.1"};
glutInit ( &argc, argv );
glutWindowHandle[1] = glutCreateWindow("test 1");
glutInitDisplayMode(GLUT_RGBA);
glutDisplayFunc(display1);
glClearColor(0.0, 1.0, 0.0, 1.0);
}
glutMainLoop();
return 0;
}but I got the message:

freeglut (./test_0): illegal glutInit() reinitialization attempt Are there any solutions to resolve this problem ?


Thanks.