-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c29a8c
commit 90bb759
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |