Renamed GameObject to Mesh

This commit is contained in:
Julian Nießner
2018-05-06 14:21:37 +02:00
parent 661415b48f
commit aa9b1a1949
5 changed files with 24 additions and 25 deletions

View File

@@ -18,7 +18,7 @@ void DarkRP2D::create () {
assets->loadShader("vert.shader","frag.shader",nullptr,"defaultShader");
assets->loadShader("bitmapvert.shader","bitmapfrag.shader",nullptr,"bitmapShader");
obj = new GameObject();
obj = new Mesh();
inputHandler = new InputHandler();
font = new BitmapFont("arial.ttf");

View File

@@ -5,7 +5,7 @@ class Reassembly2;
#include <SDL.h>
#include <vector>
#include "Assets.h"
#include "GameObject.h"
#include "Mesh.h"
#include "InputHandler.h"
#include "BitmapFont.h"
@@ -13,7 +13,7 @@ class DarkRP2D {
private:
SDL_Window* gWindow;
Assets *assets;
GameObject *obj;
Mesh *obj;
InputHandler *inputHandler;
BitmapFont *font;

View File

@@ -1,17 +0,0 @@
#ifndef GAMEOBJECT_H
#define GAMEOBJECT_H
class GameObject {
private:
unsigned int VBO;
unsigned int VAO;
public:
GameObject();
~GameObject();
void draw();
};
#endif

View File

@@ -1,9 +1,9 @@
#include "GameObject.h"
#include "Mesh.h"
#include <GL/glew.h>
#include <iostream>
GameObject::GameObject() {
Mesh::Mesh() {
//Create VBO
glGenBuffers(1, &VBO);
float vertices[] = {
@@ -25,13 +25,13 @@ GameObject::GameObject() {
glBindVertexArray(0);
}
GameObject::~GameObject() {
std::cout << "Deleting GameObject" << std::endl;
Mesh::~Mesh() {
std::cout << "Deleting Mesh" << std::endl;
glDeleteBuffers(1,&VBO);
glDeleteBuffers(1,&VAO);
}
void GameObject::draw() {
void Mesh::draw() {
glBindVertexArray(this->VAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
}

16
src/Mesh.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef MESH_H
#define MESH_H
class Mesh {
private:
unsigned int VBO, VAO;
public:
Mesh();
~Mesh();
void draw();
};
#endif