Merge branch 'master' into multi-monitor

Conflicts:
	include/GL/glfw3.h
	readme.html
	src/CMakeLists.txt
	src/win32_window.c
	src/window.c
	src/x11_window.c
	tests/clipboard.c
	tests/defaults.c
	tests/events.c
	tests/fsfocus.c
	tests/glfwinfo.c
	tests/joysticks.c
	tests/peter.c
	tests/sharing.c
	tests/tearing.c
	tests/title.c
	tests/windows.c
This commit is contained in:
Camilla Berglund
2012-11-27 16:55:04 +01:00
36 changed files with 1239 additions and 678 deletions
+10 -9
View File
@@ -51,10 +51,12 @@ static int window_close_callback(GLFWwindow window)
return GL_FALSE;
}
static GLFWwindow open_window(const char* title, GLFWwindow share)
static GLFWwindow open_window(const char* title, GLFWwindow share, int posX, int posY)
{
GLFWwindow window;
glfwWindowHint(GLFW_POSITION_X, posX);
glfwWindowHint(GLFW_POSITION_Y, posY);
window = glfwCreateWindow(WIDTH, HEIGHT, title, NULL, share);
if (!window)
return NULL;
@@ -125,7 +127,6 @@ static void draw_quad(GLuint texture)
int main(int argc, char** argv)
{
GLuint texture;
int x, y;
if (!glfwInit())
{
@@ -133,7 +134,7 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
windows[0] = open_window("First", NULL);
windows[0] = open_window("First", NULL, 0, 0);
if (!windows[0])
{
fprintf(stderr, "Failed to open first GLFW window: %s\n", glfwErrorString(glfwGetError()));
@@ -147,7 +148,8 @@ int main(int argc, char** argv)
// It will then be shared with the second context, created below
texture = create_texture();
windows[1] = open_window("Second", windows[0]);
// Put the second window to the right of the first one
windows[1] = open_window("Second", windows[0], WIDTH + 50, 0);
if (!windows[1])
{
fprintf(stderr, "Failed to open second GLFW window: %s\n", glfwErrorString(glfwGetError()));
@@ -156,14 +158,13 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
// Set drawing color for the first context and copy it to the second
// Set drawing color for both contexts
glfwMakeContextCurrent(windows[0]);
glColor3f(0.6f, 0.f, 0.6f);
glfwCopyContext(windows[0], windows[1], GL_CURRENT_BIT);
glfwMakeContextCurrent(windows[1]);
glColor3f(0.6f, 0.6f, 0.f);
// Put the second window to the right of the first one
glfwGetWindowPos(windows[0], &x, &y);
glfwSetWindowPos(windows[1], x + WIDTH + 50, y);
glfwMakeContextCurrent(windows[0]);
while (!closed)
{