Skip to content

Commit

Permalink
funcionalidade triangulo quebrado
Browse files Browse the repository at this point in the history
  • Loading branch information
RochaCarla committed Jun 2, 2016
1 parent 7c29a8c commit 90bb759
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
25 changes: 25 additions & 0 deletions include/triangle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef TRIANGLES_H
#define TRIANGLES_H

#include <vector>
#include <map>
using namespace std;
namespace ijengine {
struct Model{
unsigned int vao;
vector<unsigned int> vbos;
Model(){}
};
class Triangles : public GameModels{
public:
Triangles();
~Triangles();
CreateTriangleModel(const string& gameModelName);
DeleteModel(const string& gameModelName);
unsigned int GetModel(const string& gameModelName);
private:
map<string,Model>GameModelList;
};
}

#endif
29 changes: 29 additions & 0 deletions src/triangle.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <SDL2/SDL.h>
#include <GL/glew.h>
#include <GL/glext.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>

#include "triangle.h"

namespace ijengine {

Triangle::CreateTriangleModel(const string& gameModelName){
Vector3f Vertices[3];
Vertices[0] = Vector3f(-1.0f, -1.0f, 0.0f);
Vertices[1] = Vector3f(1.0f, -1.0f, 0.0f);
Vertices[2] = Vector3f(0.0f, 1.0f, 0.0f);



glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}

}

0 comments on commit 90bb759

Please sign in to comment.