Added context state copying to sharing test.

This commit is contained in:
Camilla Berglund 2012-02-06 16:27:56 +01:00
parent f6dfaf50ad
commit ba3a60523b

View File

@ -92,8 +92,6 @@ static void draw_quad(GLuint texture)
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor3f(0.6f, 0.f, 0.6f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2f(0.f, 0.f); glTexCoord2f(0.f, 0.f);
@ -142,6 +140,11 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Set drawing color for the first context and copy it to the second
glfwMakeContextCurrent(windows[0]);
glColor3f(0.6f, 0.f, 0.6f);
glfwCopyContext(windows[0], windows[1], GL_CURRENT_BIT);
// Put the second window to the right of the first one // Put the second window to the right of the first one
glfwGetWindowPos(windows[0], &x, &y); glfwGetWindowPos(windows[0], &x, &y);
glfwSetWindowPos(windows[1], x + WIDTH + 50, y); glfwSetWindowPos(windows[1], x + WIDTH + 50, y);