1 //========================================================================
2 // Dynamic linking test
3 // Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
4 //
5 // This software is provided 'as-is', without any express or implied
6 // warranty. In no event will the authors be held liable for any damages
7 // arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it
11 // freely, subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented; you must not
14 // claim that you wrote the original software. If you use this software
15 // in a product, an acknowledgment in the product documentation would
16 // be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such, and must not
19 // be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source
22 // distribution.
23 //
24 //========================================================================
25 //
26 // This test came about as the result of bug #3060461
27 //
28 //========================================================================
29
30 #define GLFW_DLL
31 #include <GL/glfw.h>
32
33 #include <stdio.h>
34 #include <stdlib.h>
35
window_size_callback(int width,int height)36 static void GLFWCALL window_size_callback(int width, int height)
37 {
38 glViewport(0, 0, width, height);
39 }
40
main(void)41 int main(void)
42 {
43 int major, minor, rev;
44 glfwGetVersion(&major, &minor, &rev);
45
46 if (major != GLFW_VERSION_MAJOR ||
47 minor != GLFW_VERSION_MINOR ||
48 rev != GLFW_VERSION_REVISION)
49 {
50 fprintf(stderr, "GLFW library version mismatch\n");
51 exit(EXIT_FAILURE);
52 }
53
54 if (!glfwInit())
55 {
56 fprintf(stderr, "Failed to initialize GLFW\n");
57 exit(EXIT_FAILURE);
58 }
59
60 if (!glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW))
61 {
62 fprintf(stderr, "Failed to open GLFW window\n");
63 exit(EXIT_FAILURE);
64 }
65
66 glfwSetWindowTitle("Dynamic Linking Test");
67 glfwSetWindowSizeCallback(window_size_callback);
68 glfwSwapInterval(1);
69
70 glClearColor(0, 0, 0, 0);
71
72 glMatrixMode(GL_MODELVIEW);
73 glLoadIdentity();
74
75 while (glfwGetWindowParam(GLFW_OPENED))
76 {
77 glClear(GL_COLOR_BUFFER_BIT);
78
79 glfwSwapBuffers();
80 }
81
82 glfwTerminate();
83 exit(EXIT_SUCCESS);
84 }
85
86