Está en la página 1de 3

seis.

c 11/6/2020 11:12

1 #include <GL/glut.h>
2 #define ancho 640
3 #define alto 480
4 #define profundidad 500
5
6 void dibuja();
7 void ejes();
8 void tecladoNormal(unsigned char tecla, int x, int y);
9 void tecladoEspecial(int tecla, int x, int y);
10 void texto(int x, int y, char *palabra);
11 void desocupado();
12 void redimensionado(int width, int height);
13 void luces();
14 void crear_menu();
15 void menu(int opcion);
16 void menupoligono(int opcion);
17 void menutipo(int opcion);
18 void alterna_movimiento();
19 void alterna_pantalla();
20
21 int posx=0, posy=0;
22 float angulo=0;
23 float esc=1;
24 unsigned int figura=1;
25 GLfloat material_ambient[] = {0.05, 0.05, 0.05, 1.0f};
26 GLfloat material_diffuse[] = { 0.8, 0.0, 0.0, 1.0f};
27 GLfloat material_specular[] = {0.9, 0.8, 0.8, 1.0f};
28 GLfloat luz_ambient[] = { 0.75, 0.75, 0.75, 0.0 };
29 GLfloat luz_diffuse[] = { 1.0, 1.0, 1.0, 0.0 };
30 GLfloat luz_specular[] = { 1.0, 1.0, 1.0, 0.0 };
31 GLfloat luz_position[] = { 1.0, 1.0, 1.0, 0.0 };
32 unsigned int luz=1;
33 unsigned int movimiento=1;
34 unsigned int pantalla=0;
35
36 int main(int argc, char** argv) {
37 glutInitDisplayMode(GLUT_STENCIL | GLUT_DOUBLE | GLUT_DEPTH);

Page 1 of 3
seis.c 11/6/2020 11:12

38 glutInitWindowPosition(100, 0);
39 glutInitWindowSize(ancho, alto);
40 glutCreateWindow("Menu");
41 glOrtho(-(ancho/2), (ancho/2), -(alto/2), (alto/2), -profundid
42 glClearColor(1, 1, 1, 0);
43 crear_menu();
44 glutDisplayFunc(dibuja);
45 glutKeyboardFunc(tecladoNormal);
46 glutSpecialFunc(tecladoEspecial);
47 glutIdleFunc(desocupado);
48 glutReshapeFunc(redimensionado);
49 glutMainLoop();
50 return 0;
51 }
52
53 void dibuja() {
54 glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH
55 ejes();
56 luces();
57 glPushMatrix();
58 glTranslatef(posx, posy, 0);
59 glRotatef(angulo, 1, 0, 0);
60 glRotatef(angulo, 0, 1, 0);
61 glRotatef(angulo, 0, 0, 1);
62
63
64
65
66
67
68
69
70
71
72
73
74

Page 2 of 3
seis.c 11/6/2020 11:12

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

Page 3 of 3

También podría gustarte