2 MiniGLUT - minimal GLUT subset without dependencies
3 Copyright (C) 2020 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
22 #define WIN32_LEAN_AND_MEAN 1
26 #pragma comment (lib, "opengl32")
27 #pragma comment (lib, "winmm")
33 /* mode flags for glutInitDisplayMode */
36 #define GLUT_INDEX 0x001
38 #define GLUT_DOUBLE 0x002
39 #define GLUT_ACCUM 0x004
40 #define GLUT_ALPHA 0x008
41 #define GLUT_DEPTH 0x010
42 #define GLUT_STENCIL 0x020
43 #define GLUT_STEREO 0x040
44 #define GLUT_MULTISAMPLE 0x100
45 #define GLUT_SRGB 0x200
47 enum { GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_RIGHT_BUTTON };
48 enum { GLUT_UP, GLUT_DOWN };
49 enum { GLUT_NOT_VISIBLE, GLUT_VISIBLE };
50 enum { GLUT_LEFT, GLUT_ENTERED };
55 GLUT_CURSOR_LEFT_ARROW,
65 GLUT_WINDOW_BUFFER_SIZE,
66 GLUT_WINDOW_STENCIL_SIZE,
67 GLUT_WINDOW_DEPTH_SIZE,
69 GLUT_WINDOW_GREEN_SIZE,
70 GLUT_WINDOW_BLUE_SIZE,
71 GLUT_WINDOW_ALPHA_SIZE,
72 GLUT_WINDOW_DOUBLEBUFFER,
74 GLUT_WINDOW_NUM_SAMPLES,
80 GLUT_INIT_DISPLAY_MODE,
83 GLUT_INIT_WINDOW_WIDTH,
84 GLUT_INIT_WINDOW_HEIGHT,
88 /* returned by glutGetModifiers */
89 #define GLUT_ACTIVE_SHIFT 1
90 #define GLUT_ACTIVE_CTRL 4
91 #define GLUT_ACTIVE_ALT 8
93 typedef void (*glut_cb)(void);
94 typedef void (*glut_cb_reshape)(int x, int y);
95 typedef void (*glut_cb_state)(int state);
96 typedef void (*glut_cb_keyb)(unsigned char key, int x, int y);
97 typedef void (*glut_cb_special)(int key, int x, int y);
98 typedef void (*glut_cb_mouse)(int bn, int state, int x, int y);
99 typedef void (*glut_cb_motion)(int x, int y);
100 typedef void (*glut_cb_sbmotion)(int x, int y, int z);
101 typedef void (*glut_cb_sbbutton)(int bn, int state);
104 void glutInit(int *argc, char **argv);
105 void glutInitWindowPosition(int x, int y);
106 void glutInitWindowSize(int xsz, int ysz);
107 void glutInitDisplayMode(unsigned int mode);
108 void glutCreateWindow(const char *title);
111 void glutMainLoop(void);
112 void glutMainLoopEvent(void);
114 void glutPostRedisplay(void);
115 void glutSwapBuffers(void);
116 void glutPositionWindow(int x, int y);
117 void glutReshapeWindow(int xsz, int ysz);
118 void glutFullScreen(void);
119 void glutSetWindowTitle(const char *title);
120 void glutSetIconTitle(const char *title);
121 void glutSetCursor(int cursor);
123 void glutIdleFunc(glut_cb func);
124 void glutDisplayFunc(glut_cb func);
125 void glutReshapeFunc(glut_cb_reshape func);
126 void glutVisibilityFunc(glut_cb_state func);
127 void glutEntryFunc(glut_cb_state func);
128 void glutKeyboardFunc(glut_cb_keyb func);
129 void glutKeyboardUpFunc(glut_cb_keyb func);
130 void glutSpecialFunc(glut_cb_special func);
131 void glutSpecialUpFunc(glut_cb_special func);
132 void glutMouseFunc(glut_cb_mouse func);
133 void glutMotionFunc(glut_cb_motion func);
134 void glutPassiveMotionFunc(glut_cb_motion func);
135 void glutSpaceballMotionFunc(glut_cb_sbmotion func);
136 void glutSpaceballRotateFunc(glut_cb_sbmotion func);
137 void glutSpaceballBittonFunc(glut_cb_sbbutton func);
139 int glutGet(unsigned int s);
140 int glutGetModifiers(void);
141 int glutExtensionSupported(char *ext);
143 void glutSolidSphere(float rad, int slices, int stacks);
144 void glutWireSphere(float rad, int slices, int stacks);
145 void glutSolidCube(float sz);
146 void glutWireCube(float sz);
147 void glutSolidCone(float base, float height, int slices, int stacks);
148 void glutWireCone(float base, float height, int slices, int stacks);
149 void glutSolidCylinder(float rad, float height, int slices, int stacks);
150 void glutSolidTorus(float inner_rad, float outer_rad, int sides, int rings);
151 void glutWireTorus(float inner_rad, float outer_rad, int sides, int rings);
152 void glutSolidTeapot(float size);
153 void glutWireTeapot(float size);
155 #endif /* MINIGLUT_H_ */