-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathon_display.c
95 lines (76 loc) · 1.96 KB
/
on_display.c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <math.h>
#include "on_display.h"
#include "constante.h"
#include "object.h"
unsigned int kamen;
unsigned int pozadina;
unsigned int bum;
void on_display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(0,0,1);
glMatrixMode(GL_PROJECTION );
glLoadIdentity();
glOrtho(0,1,0,1,-1,1);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDepthMask(GL_FALSE);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, 1, 0.1, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(
-2, 10, sin(animation_parameter/50),
3, 0, 0,
0, 1, 0
);
//mapa
glBindTexture(GL_TEXTURE_2D,pozadina);
glDisable(GL_LIGHTING);
mapa();
glEnable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D,0);
//svemirski brod
spaceShip(-2,levodesno);
//crtanje bureta
bure(bureX,0,bureZ);
//polje asteroida
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glBindTexture(GL_TEXTURE_2D,kamen);
int i;
for(i=0;i< BR_ASTEROIDA;i++){
asteroid(asteroidX[i],0,asteroidZ[i]);
}
glBindTexture(GL_TEXTURE_2D,0);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
//kraj
if(abs(kraj_parametar) == 1){
glBindTexture(GL_TEXTURE_2D,bum);
glDisable(GL_LIGHTING);
kraj();
glEnable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D,0);
}
//skor
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,500,0,500);
glMatrixMode(GL_MODELVIEW);
glDisable(GL_DEPTH_TEST);
poeni();
glutSwapBuffers();
}