Added window positioning to sharing test.

This commit is contained in:
Camilla Berglund 2010-10-04 21:08:42 +02:00
Родитель 4da3bf7827
Коммит 2899e8765c
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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]);