-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model.cpp
71 lines (50 loc) · 1.16 KB
/
Model.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Model.cpp
*
* Created on: 2011-11-12
* Author: zapo
*/
#include "Model.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
namespace Bomber {
const unsigned int Model::ordering[24] = {
0, 1, 2,
0, 2, 3,
0, 3, 4,
0, 4, 5,
0, 5, 6,
0, 6, 7,
0, 7, 8,
0, 8, 1
};
Model::Model() {
// TODO Auto-generated constructor stub
}
Model::~Model() {
// TODO Auto-generated destructor stub
}
void Model::Render() {
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
mainTexture.Bind();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
for(shaders_it = shaders.begin(); shaders_it != shaders.end(); shaders_it ++) {
if(shaders_it->second->enabled) {
shaders_it->second->Use();
}
}
glPushMatrix();
for(buffers_it = buffers.begin(); buffers_it != buffers.end(); buffers_it++) {
buffers_it->second->Render();
}
glPopMatrix();
glUseProgram(0);
glDisable(GL_TEXTURE_2D);
}
}