1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Added window positioning to sharing test.

This commit is contained in:
Camilla Berglund 2010-10-04 21:08:42 +02:00
parent 4da3bf7827
commit 2899e8765c

View File

@ -32,11 +32,14 @@
#include <stdio.h>
#include <stdlib.h>
#define WIDTH 400
#define HEIGHT 400
static GLFWwindow open_window(const char* title, GLFWwindow share)
{
GLFWwindow window;
window = glfwOpenWindow(400, 400, GLFW_WINDOWED, title, share);
window = glfwOpenWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share);
if (!window)
return NULL;
@ -100,6 +103,7 @@ int main(int argc, char** argv)
{
GLFWwindow windows[2];
GLuint texture;
int x, y;
if (!glfwInit())
{
@ -114,6 +118,8 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
glfwGetWindowPos(windows[0], &x, &y);
// This is the one and only time we create a texture
// It is created inside the first context created above
// It will then be shared with the second context created below
@ -126,6 +132,8 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
glfwSetWindowPos(windows[1], x + WIDTH + 50, y);
while (glfwIsWindow(windows[0]) && glfwIsWindow(windows[1]))
{
glfwMakeWindowCurrent(windows[0]);