forked from MATF-RG19/RG166-knock-it-down
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
51 lines (39 loc) · 995 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <GL/gl.h>
#include <GL/glut.h>
#include <string>
#include "libs/callbackFunctions.hpp"
void onDisplay ();
void onKeyboard (unsigned char key, int x, int y);
void onReshape (int width, int height);
void initEnables ();
auto
main (int argc, char **argv) -> int
{
const char *gameName = "Knock it down!";
// Glut initialization
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
// Creating the window
glutInitWindowPosition (100, 100);
glutInitWindowSize (1280, 768);
glutCreateWindow (gameName);
// Callback functions init
glutKeyboardFunc (onKeyboard);
glutReshapeFunc (onReshape);
glutDisplayFunc (onDisplay);
glutSpecialFunc (onKeyboardSpecial);
// OpenGL init
initEnables ();
glutMainLoop ();
return 0;
}
void
initEnables ()
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glEnable (GL_DEPTH_TEST);
glEnable (GL_NORMALIZE);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
srand (time (nullptr));
}