Browse code

Standardize OpenGL-related #includes and #defines

We use glXGetProcAddress to load glXCreateContextAttribsARB ourselves,
so GLX_GLXEXT_PROTOTYPES is not needed.

Robert Cranston authored on 27/02/2024 02:27:47
Showing 1 changed files
... ...
@@ -9,7 +9,6 @@ extern "C" {
9 9
 #ifndef __APPLE__
10 10
 	ERROR! This is the Mac version of the MicroGlut header which will not work on other platforms!
11 11
 #endif
12
-#define GL_SILENCE_DEPRECATION
13 12
 
14 13
 // Same or similar to old GLUT calls
15 14
 void glutMainLoop();
Browse code

Remove executable bit on files

find . -type f -exec chmod -x {} +

Robert Cranston authored on 27/02/2024 02:27:27
Showing 1 changed files
1 1
old mode 100755
2 2
new mode 100644
Browse code

Add cpp-v1

Ingemar Ragnemalm authored on 21/02/2024 20:24:28 • Robert Cranston committed on 21/02/2024 20:24:28
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,175 @@
1
+#ifndef _MICROGLUT_
2
+#define _MICROGLUT_
3
+
4
+#ifdef __cplusplus
5
+extern "C" {
6
+#endif
7
+
8
+// If this is not compiled on the Mac, tell me!
9
+#ifndef __APPLE__
10
+	ERROR! This is the Mac version of the MicroGlut header which will not work on other platforms!
11
+#endif
12
+#define GL_SILENCE_DEPRECATION
13
+
14
+// Same or similar to old GLUT calls
15
+void glutMainLoop();
16
+void glutCheckLoop();
17
+void glutInit(int *argcp, char **argv);
18
+void glutPostRedisplay();
19
+
20
+void glutReshapeFunc(void (*func)(int width, int height));
21
+void glutDisplayFunc(void (*func)(void));
22
+void glutKeyboardFunc(void (*func)(unsigned char key, int x, int y));
23
+void glutKeyboardUpFunc(void (*func)(unsigned char key, int x, int y));
24
+void glutSpecialFunc(void (*func)(unsigned char key, int x, int y));
25
+void glutSpecialUpFunc(void (*func)(unsigned char key, int x, int y));
26
+
27
+void glutMouseFunc(void (*func)(int button, int state, int x, int y));
28
+void glutPassiveMotionFunc(void (*func)(int x, int y));
29
+void glutMotionFunc(void (*func)(int x, int y));
30
+
31
+void glutInitWindowPosition (int x, int y);
32
+void glutInitWindowSize (int width, int height);
33
+int glutCreateWindow (const char *windowTitle);
34
+
35
+void glutSwapBuffers();
36
+
37
+// glutGet constants
38
+#define GLUT_ELAPSED_TIME		(700)
39
+#define GLUT_WINDOW_WIDTH		102
40
+#define GLUT_WINDOW_HEIGHT		103
41
+#define GLUT_QUIT_FLAG			801
42
+#define GLUT_MOUSE_POSITION_X	802
43
+#define GLUT_MOUSE_POSITION_Y	803
44
+// This looks less than perfect...
45
+#define GLUT_SCREEN_WIDTH GLUT_WINDOW_WIDTH
46
+#define GLUT_SCREEN_HEIGHT GLUT_WINDOW_HEIGHT
47
+int glutGet(int type);
48
+
49
+void glutInitDisplayMode(unsigned int mode);
50
+void glutIdleFunc(void (*func)(void));
51
+
52
+// Standard GLUT timer
53
+void glutTimerFunc(int millis, void (*func)(int arg), int arg);
54
+// Ingemar's version
55
+void glutRepeatingTimerFunc(int millis); // Old name, will be removed
56
+void glutRepeatingTimer(int millis);
57
+// New call for polling the keyboard, good for games
58
+char glutKeyIsDown(unsigned char c);
59
+// And for the mouse button(s):
60
+char glutMouseIsDown(unsigned char c);
61
+
62
+void glutReshapeWindow(int width, int height);
63
+void glutPositionWindow(int x, int y);
64
+void glutSetWindowTitle(char *title);
65
+void glutInitContextVersion(int major, int minor);
66
+
67
+/* Mouse buttons. */
68
+#define GLUT_LEFT_BUTTON		0
69
+// No support for middle yet
70
+#define GLUT_MIDDLE_BUTTON		1
71
+#define GLUT_RIGHT_BUTTON		2
72
+
73
+/* Mouse button  state. */
74
+#define GLUT_DOWN			0
75
+#define GLUT_UP				1
76
+
77
+// Only some modes supported
78
+#define GLUT_STENCIL			32
79
+#define GLUT_MULTISAMPLE		128
80
+//#define GLUT_STEREO			256
81
+#define GLUT_RGB			0
82
+#define GLUT_RGBA			GLUT_RGB
83
+#define GLUT_ALPHA			GLUT_RGB
84
+#define GLUT_SINGLE			0
85
+#define GLUT_DOUBLE			2
86
+#define GLUT_DEPTH			16
87
+
88
+// Special keys.
89
+#define GLUT_KEY_F1			1
90
+#define GLUT_KEY_F2			2
91
+#define GLUT_KEY_F3			3
92
+#define GLUT_KEY_F4			4
93
+#define GLUT_KEY_F5			5
94
+#define GLUT_KEY_F6			6
95
+#define GLUT_KEY_F7			7
96
+// F8 and up ignored since they are not possible on some keyboards - like mine
97
+//#define GLUT_KEY_LEFT			100
98
+//#define GLUT_KEY_UP				101
99
+//#define GLUT_KEY_RIGHT			102
100
+//#define GLUT_KEY_DOWN			103
101
+//#define GLUT_KEY_PAGE_UP		104
102
+//#define GLUT_KEY_PAGE_DOWN		105
103
+//#define GLUT_KEY_HOME			106
104
+//#define GLUT_KEY_END			107
105
+//#define GLUT_KEY_INSERT			108
106
+// Re-mapped 2015-09-23: Make EVERYTHING "ordinary", no need for "special!"
107
+// I know that these codes mean something else, but none of them mean any keys!
108
+#define GLUT_KEY_LEFT			28
109
+#define GLUT_KEY_UP				29
110
+#define GLUT_KEY_RIGHT			30
111
+#define GLUT_KEY_DOWN			31
112
+#define GLUT_KEY_PAGE_UP		22
113
+#define GLUT_KEY_PAGE_DOWN		23
114
+#define GLUT_KEY_HOME			24
115
+#define GLUT_KEY_END			25
116
+#define GLUT_KEY_INSERT			26
117
+// Visibility
118
+#define GLUT_NOT_VISIBLE		0
119
+#define GLUT_VISIBLE			1
120
+
121
+// These feel less important to me
122
+#define GLUT_KEY_ESC			 27
123
+#define GLUT_KEY_TAB			  9
124
+#define GLUT_KEY_RETURN			 13
125
+#define GLUT_KEY_SPACE			' ' 
126
+#define GLUT_KEY_SEMICOLON		';'
127
+#define GLUT_KEY_COMMA			','
128
+#define GLUT_KEY_DECIMAL		'.'
129
+#define GLUT_KEY_GRAVE			'`'
130
+#define GLUT_KEY_QUOTE			'\''
131
+#define GLUT_KEY_LBRACKET		'['
132
+#define GLUT_KEY_RBRACKET		']'
133
+#define GLUT_KEY_BACKSLASH		'\\'
134
+#define GLUT_KEY_SLASH			'/'
135
+#define GLUT_KEY_EQUAL			'='
136
+
137
+
138
+// Menu support
139
+int glutCreateMenu(void (*func)(int value));
140
+void glutAddMenuEntry(char *name, int value);
141
+void glutAttachMenu(int button);
142
+void glutDetachMenu(int button);
143
+void glutAddSubMenu(char *name, int menu);
144
+void glutSetMenu(int menu);
145
+int glutGetMenu(void);
146
+void glutChangeToMenuEntry(int index, char *name, int value);
147
+
148
+// Visibility not-really-support
149
+void glutVisibilityFunc(void (*visibility)(int status));
150
+
151
+// Move mouse pointer, conforms with GLUT
152
+void glutWarpPointer(int x, int y);
153
+
154
+// New calls: Show/hide mouse pointer. Great for mouse controlled games.
155
+// (Untested and so far missing in Linux/Windows API)
156
+// Rename to GLUT-conforming glutSetCursor?
157
+void glutShowCursor();
158
+void glutHideCursor();
159
+
160
+void glutFullScreen();
161
+void glutExitFullScreen();
162
+void glutToggleFullScreen();
163
+
164
+void glutExit();
165
+
166
+// Placeholders, we only support one window, unlike FreeGlut.
167
+void glutSetWindow(int win);
168
+int glutGetWindow(void);
169
+
170
+#ifdef __cplusplus
171
+}
172
+#endif
173
+
174
+
175
+#endif