Meshes can display textures

This commit is contained in:
Julian Nießner
2018-05-06 17:35:07 +02:00
parent aa9b1a1949
commit 7d616b6ce0
7 changed files with 74 additions and 25 deletions

View File

@@ -13,12 +13,20 @@ DarkRP2D::~DarkRP2D() {
void DarkRP2D::create () {
std::cout << "Hello World!" << std::endl;
assets = new Assets();
assets->loadTexture("bucket.png",false,"bucket");
assets->loadTexture("drop.png",false,"drop");
assets->loadTexture("police_officer.png",true,"police_officer");
assets->loadShader("vert.shader","frag.shader",nullptr,"defaultShader");
assets->loadShader("bitmapvert.shader","bitmapfrag.shader",nullptr,"bitmapShader");
obj = new Mesh();
std::vector<Vertex2D> vertices({
Vertex2D{glm::vec2(-0.5f,-0.5f), glm::vec2(0.0f,0.0f)},
Vertex2D{glm::vec2(0.5f,-0.5f), glm::vec2(1.0f,0.0f)},
Vertex2D{glm::vec2(0.0f,0.5f), glm::vec2(0.5f,1.0f)}
});
std::vector<unsigned int> indices({
0,1,2,0
});
obj = new Mesh(vertices,indices,assets->getTexture("police_officer"));
inputHandler = new InputHandler();
font = new BitmapFont("arial.ttf");