Skip to content

Commit 90bb759

Browse files
committed
funcionalidade triangulo quebrado
1 parent 7c29a8c commit 90bb759

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

include/triangle.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef TRIANGLES_H
2+
#define TRIANGLES_H
3+
4+
#include <vector>
5+
#include <map>
6+
using namespace std;
7+
namespace ijengine {
8+
struct Model{
9+
unsigned int vao;
10+
vector<unsigned int> vbos;
11+
Model(){}
12+
};
13+
class Triangles : public GameModels{
14+
public:
15+
Triangles();
16+
~Triangles();
17+
CreateTriangleModel(const string& gameModelName);
18+
DeleteModel(const string& gameModelName);
19+
unsigned int GetModel(const string& gameModelName);
20+
private:
21+
map<string,Model>GameModelList;
22+
};
23+
}
24+
25+
#endif

src/triangle.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <SDL2/SDL.h>
2+
#include <GL/glew.h>
3+
#include <GL/glext.h>
4+
#include <GL/gl.h>
5+
#include <GL/glu.h>
6+
#include <stdio.h>
7+
#include <stdlib.h>
8+
#include <string.h>
9+
#include <assert.h>
10+
#include <math.h>
11+
12+
#include "triangle.h"
13+
14+
namespace ijengine {
15+
16+
Triangle::CreateTriangleModel(const string& gameModelName){
17+
Vector3f Vertices[3];
18+
Vertices[0] = Vector3f(-1.0f, -1.0f, 0.0f);
19+
Vertices[1] = Vector3f(1.0f, -1.0f, 0.0f);
20+
Vertices[2] = Vector3f(0.0f, 1.0f, 0.0f);
21+
22+
23+
24+
glGenBuffers(1, &VBO);
25+
glBindBuffer(GL_ARRAY_BUFFER, VBO);
26+
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
27+
}
28+
29+
}

0 commit comments

Comments
 (0)