|
@@ -5,6 +5,8 @@
|
5
|
5
|
* \author xythobuz
|
6
|
6
|
*/
|
7
|
7
|
|
|
8
|
+#include <cstdio>
|
|
9
|
+#include <cstring>
|
8
|
10
|
#include <assert.h>
|
9
|
11
|
|
10
|
12
|
#ifdef __APPLE__
|
|
@@ -21,6 +23,78 @@
|
21
|
23
|
Window::~Window() {
|
22
|
24
|
}
|
23
|
25
|
|
|
26
|
+int Window::initializeGL() {
|
|
27
|
+ // Print driver support information
|
|
28
|
+ printf("GL Vendor : %s\n", glGetString(GL_VENDOR));
|
|
29
|
+ printf("GL Renderer: %s\n", glGetString(GL_RENDERER));
|
|
30
|
+ printf("GL Version : %s\n", glGetString(GL_VERSION));
|
|
31
|
+
|
|
32
|
+ // Testing for goodies
|
|
33
|
+ const char *s = (const char *)glGetString(GL_EXTENSIONS);
|
|
34
|
+ if ((s != NULL) && (s[0] != '\0')) {
|
|
35
|
+ //if (strstr(s, "GL_ARB_multitexture"))
|
|
36
|
+ //mFlags |= Render::fMultiTexture;
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+ // Set up Z buffer
|
|
40
|
+ glEnable(GL_DEPTH_TEST);
|
|
41
|
+ glDepthFunc(GL_LESS);
|
|
42
|
+
|
|
43
|
+ // Set up culling
|
|
44
|
+ glEnable(GL_CULL_FACE);
|
|
45
|
+ glFrontFace(GL_CW);
|
|
46
|
+ //glFrontFace(GL_CCW);
|
|
47
|
+ //glCullFace(GL_FRONT);
|
|
48
|
+
|
|
49
|
+ // Set background to black
|
|
50
|
+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
51
|
+
|
|
52
|
+ // Disable lighting
|
|
53
|
+ glDisable(GL_LIGHTING);
|
|
54
|
+
|
|
55
|
+ // Set up alpha blending
|
|
56
|
+ glEnable(GL_BLEND);
|
|
57
|
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
|
58
|
+
|
|
59
|
+ //glEnable(GL_ALPHA_TEST); // Disable per pixel alpha blending
|
|
60
|
+ glAlphaFunc(GL_GREATER, 0);
|
|
61
|
+
|
|
62
|
+ glPointSize(5.0);
|
|
63
|
+
|
|
64
|
+ // Setup shading
|
|
65
|
+ glShadeModel(GL_SMOOTH);
|
|
66
|
+
|
|
67
|
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
|
68
|
+ glHint(GL_FOG_HINT, GL_NICEST);
|
|
69
|
+ glEnable(GL_COLOR_MATERIAL);
|
|
70
|
+ glEnable(GL_DITHER);
|
|
71
|
+
|
|
72
|
+ // AA polygon edges
|
|
73
|
+ glEnable(GL_POLYGON_SMOOTH);
|
|
74
|
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
|
75
|
+
|
|
76
|
+ glDisable(GL_LINE_SMOOTH);
|
|
77
|
+ glDisable(GL_POINT_SMOOTH);
|
|
78
|
+ glDisable(GL_AUTO_NORMAL);
|
|
79
|
+ glDisable(GL_LOGIC_OP);
|
|
80
|
+ glDisable(GL_TEXTURE_1D);
|
|
81
|
+ glDisable(GL_STENCIL_TEST);
|
|
82
|
+ glDisable(GL_FOG);
|
|
83
|
+
|
|
84
|
+ glDisable(GL_NORMALIZE);
|
|
85
|
+
|
|
86
|
+ glEnableClientState(GL_VERTEX_ARRAY);
|
|
87
|
+ glDisableClientState(GL_EDGE_FLAG_ARRAY);
|
|
88
|
+ glDisableClientState(GL_COLOR_ARRAY);
|
|
89
|
+ glDisableClientState(GL_NORMAL_ARRAY);
|
|
90
|
+
|
|
91
|
+ glPolygonMode(GL_FRONT, GL_FILL);
|
|
92
|
+
|
|
93
|
+ glMatrixMode(GL_MODELVIEW);
|
|
94
|
+
|
|
95
|
+ return 0;
|
|
96
|
+}
|
|
97
|
+
|
24
|
98
|
void Window::resizeGL(unsigned int w, unsigned int h) {
|
25
|
99
|
float fovY = 45.0f;
|
26
|
100
|
float clipNear = 4.0f;
|