Merge branch 'master' into multi-monitor

This commit is contained in:
Camilla Berglund
2012-09-23 14:44:56 +02:00
8 changed files with 98 additions and 106 deletions
+16 -16
View File
@@ -35,7 +35,7 @@
#include "getopt.h"
static GLFWwindow window = NULL;
static GLFWwindow window_handle = NULL;
enum Mode
{
@@ -68,25 +68,25 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description);
}
static void window_size_callback(GLFWwindow in_window, int width, int height)
static void window_size_callback(GLFWwindow window, int width, int height)
{
printf("Window resized to %ix%i\n", width, height);
glViewport(0, 0, width, height);
}
static int window_close_callback(GLFWwindow dummy)
static int window_close_callback(GLFWwindow window)
{
window = NULL;
window_handle = NULL;
return GL_TRUE;
}
static void key_callback(GLFWwindow dummy, int key, int action)
static void key_callback(GLFWwindow window, int key, int action)
{
if (key == GLFW_KEY_ESCAPE)
{
glfwDestroyWindow(window);
window = NULL;
window_handle = NULL;
}
}
@@ -143,10 +143,10 @@ static void test_modes(GLFWmonitor monitor)
glfwGetMonitorString(monitor, GLFW_MONITOR_NAME),
format_mode(mode));
window = glfwCreateWindow(mode->width, mode->height,
GLFW_FULLSCREEN, "Video Mode Test",
NULL);
if (!window)
window_handle = glfwCreateWindow(mode->width, mode->height,
GLFW_FULLSCREEN, "Video Mode Test",
NULL);
if (!window_handle)
{
printf("Failed to enter mode %u: %s\n",
(unsigned int) i,
@@ -154,7 +154,7 @@ static void test_modes(GLFWmonitor monitor)
continue;
}
glfwMakeContextCurrent(window);
glfwMakeContextCurrent(window_handle);
glfwSwapInterval(1);
glfwSetTime(0.0);
@@ -162,10 +162,10 @@ static void test_modes(GLFWmonitor monitor)
while (glfwGetTime() < 5.0)
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwSwapBuffers(window_handle);
glfwPollEvents();
if (!window)
if (!window_handle)
{
printf("User terminated program\n");
exit(EXIT_SUCCESS);
@@ -176,7 +176,7 @@ static void test_modes(GLFWmonitor monitor)
glGetIntegerv(GL_GREEN_BITS, &current.greenBits);
glGetIntegerv(GL_BLUE_BITS, &current.blueBits);
glfwGetWindowSize(window, &current.width, &current.height);
glfwGetWindowSize(window_handle, &current.width, &current.height);
if (current.redBits != mode->redBits ||
current.greenBits != mode->greenBits ||
@@ -196,9 +196,9 @@ static void test_modes(GLFWmonitor monitor)
printf("Closing window\n");
glfwDestroyWindow(window);
glfwDestroyWindow(window_handle);
window_handle = NULL;
glfwPollEvents();
window = NULL;
}
}