the marked line A in the following codes makes the the marked line B ineffective, i.e., the antialiasing doesn’t work for the third monitor. What causes this problem?
int MakeContexForSubjectMonitors(int DisplayToWhom)
// DisplayToWhom: SUBJECT1 , SUBJECT2
{
BOOL doubleBuffer = TRUE;
if (MonitorNum == 3) //we have 3 monitors, the last 2 were shown to 2 subjects
{
if (DisplayToWhom == SUBJECT1)
{
glfwWindowHint(GLFW_RED_BITS, moninfo[2].redbits); // moninfo: monitor information
glfwWindowHint(GLFW_GREEN_BITS, moninfo[2].bluebits);
glfwWindowHint(GLFW_BLUE_BITS, moninfo[2].greenbits);
glfwWindowHint(GLFW_REFRESH_RATE, moninfo[2].refrate);
glfwWindowHint(GLFW_DOUBLEBUFFER, doubleBuffer);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);//**********marked line A
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
glfwWindowHint(GLFW_CENTER_CURSOR, GLFW_FALSE);
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
window1 = glfwCreateWindow(moninfo[2].width_pixel, moninfo[2].height_pixel, "To Subject1", NULL, NULL);
glfwSetWindowPos(window1, moninfo[2].virtualPos[0], moninfo[2].virtualPos[1]);
else
{
glfwWindowHint(GLFW_RED_BITS, moninfo[3].redbits);
glfwWindowHint(GLFW_GREEN_BITS, moninfo[3].bluebits);
glfwWindowHint(GLFW_BLUE_BITS, moninfo[3].greenbits);
glfwWindowHint(GLFW_REFRESH_RATE, moninfo[3].refrate);
glfwWindowHint(GLFW_DOUBLEBUFFER, doubleBuffer);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
glfwWindowHint(GLFW_SAMPLES, 4);//********marked line B
glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
glfwWindowHint(GLFW_CENTER_CURSOR, GLFW_FALSE);
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
window2 = glfwCreateWindow(moninfo[3].width_pixel, moninfo[3].height_pixel, "To Subject2", NULL, NULL);
glfwSetWindowPos(window2, moninfo[3].virtualPos[0], moninfo[3].virtualPos[1]);
}
}
if (DisplayToWhom == SUBJECT1)
{
glfwMakeContextCurrent(window1);
}
else
glfwMakeContextCurrent(window2);
glewExperimental = true;
int initcode = glewInit();
if (DisplayToWhom == SUBJECT1)
{
glViewport(0, 0, Monitor2_HorizontalResolution, Monitor2_VerticalResolution);
}
else
{
glViewport(0, 0, Monitor3_HorizontalResolution, Monitor3_VerticalResolution);
}
glEnable(GL_MULTISAMPLE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_PROGRAM_POINT_SIZE);
//simple demonstration
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex2f(0, 0);
glVertex2f(0.3, 0.3);
glVertex2f(0.3*tan(5.0 * PI / 180.0), 1);
glEnd();
if (DisplayToWhom == SUBJECT1)
glfwSwapBuffers(window1);
else
glfwSwapBuffers(window2);
return 1;
}