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
|
#include <stdio.h>
#include <mgl/mgl.h>
#include <mgl/window.h>
#include <GL/gl.h>
#include <GL/glu.h>
static void draw(mgl_window *window, void *userdata) {
glBegin(GL_QUADS);
glColor3f(1., 0., 0.); glVertex3f(-.75, -.75, 0.);
glColor3f(0., 1., 0.); glVertex3f( .75, -.75, 0.);
glColor3f(0., 0., 1.); glVertex3f( .75, .75, 0.);
glColor3f(1., 1., 0.); glVertex3f(-.75, .75, 0.);
glEnd();
}
int main(int argc, char **argv) {
if(mgl_init() != 0)
return 1;
mgl_window_callback window_callback;
window_callback.draw = draw;
mgl_window window;
if(mgl_window_create(&window, "mgl", 1280, 720, &window_callback, NULL) != 0)
return 1;
mgl_window_show(&window);
for(;;) {
mgl_window_event_poll(&window, 500);
}
mgl_window_deinit(&window);
mgl_deinit();
return 0;
}
|