LesDingeriesDeDjalimSurOpenGL/include/engine.h

61 lines
1.2 KiB
C++

#ifndef ENGINE_H
#define ENGINE_H
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "ShaderProgram.h"
#include "Texture2D.h"
#include <map>
#include <string>
#include <vector>
#define NBCALLBACKS 1
typedef void (*KeyCallback)(GLFWwindow* window, int key, int scancode, int action, int mods);
struct Object3D {
Texture2D texture;
GLuint VBO;
GLuint VAO;
};
typedef std::map<std::string,Object3D> Objects3D;
static bool gWireframe = false;
namespace djalim {
class OpenGlEngine{
public:
void start();
OpenGlEngine( const char* title, int width, int height);
~OpenGlEngine();
GLFWwindow* window;
double previousSeconds = 0.0;
double elapsedSeconds;
int frameCount = 0;
std::map<std::string,Texture2D> textures;
ShaderProgram shaderProgram;
Objects3D objects;
unsigned int VBO;
unsigned int VAO;
bool gWireframe = false;
void onUpdate();
void loadHints();
void createObject(std::string name, std::string textures, std::vector<float>& vertices);
void loadCallbacks();
void showFps();
void onCreate();
void onDestroy();
};
}
#endif // ENGINE_H