-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFollowerHolder.cpp
More file actions
36 lines (30 loc) · 815 Bytes
/
FollowerHolder.cpp
File metadata and controls
36 lines (30 loc) · 815 Bytes
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
#include "FollowerHolder.h"
Follower* TheFollower;
FollowerHolder::FollowerHolder()
{
TheFollower = new Follower();
addObj(TheFollower);
}
FollowerHolder::~FollowerHolder()
{
}
GLuint FollowerHolder::setupGeometry(){
GLuint vbo;
const int count = 40;
float vertices[count * 2];
vertices[0] = 0.0f; vertices[1] = 0.0f;
int vertexNum = 2;
for (int i = 0; i < count-1; i += 1){
vertices[vertexNum++] = Dcos(i * 360 / (count-2))*((i % 2) * 20 + 10);
vertices[vertexNum++] = Dsin(i * 360 / (count-2))*((i % 2) * 20 + 10);
}
assert(vertexNum == count * 2);
glGenBuffers(1, &vbo); // Generate 1 buffer
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
return vbo;
}
void FollowerHolder::draw()
{
glDrawArrays(GL_TRIANGLE_FAN, 0, 40);
}