put everything into one class,
Bug: still nothing displayed
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <gl\glew.h>
|
||||
#include <gl\glfw3.h>
|
||||
#include <glm\glm.hpp>
|
||||
#include <vector>
|
||||
#include "Camera.h"
|
||||
#include "Object.h"
|
||||
|
||||
class OpenGLController
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructor/destructor
|
||||
public:
|
||||
static OpenGLController& getInstance(int oglMajor = 4, int oglMinor = 5);
|
||||
~OpenGLController();
|
||||
@@ -15,59 +17,90 @@ private:
|
||||
OpenGLController() {};
|
||||
OpenGLController(int oglMajor, int oglMinor);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// member
|
||||
private:
|
||||
int iOglMajorVersion;
|
||||
int iOglMinorVersion;
|
||||
int iAntiAliasingLevel;
|
||||
std::string sWindowName;
|
||||
|
||||
// window
|
||||
GLFWwindow* pWindow;
|
||||
|
||||
std::string sWindowName;
|
||||
int iWidth;
|
||||
int iHeight;
|
||||
|
||||
// init glfw
|
||||
int iOglMajorVersion;
|
||||
int iOglMinorVersion;
|
||||
int iAntiAliasingLevel;
|
||||
|
||||
GLuint gluiMatrixID;
|
||||
// IDs ==========================
|
||||
//object data
|
||||
GLuint gluiVertexArrayID;
|
||||
GLuint gluiVertexBufferID;
|
||||
|
||||
//obj color
|
||||
GLuint gluiUVBufferID;
|
||||
GLuint gluiTextureID;
|
||||
GLuint gluiShaderPrgmID;
|
||||
GLuint gluiSamplerID;
|
||||
|
||||
//obj transformation
|
||||
GLuint gluiMatrixID;
|
||||
// ==============================
|
||||
|
||||
// data
|
||||
std::vector<GLfloat> vfVertices;
|
||||
std::vector<GLfloat> vfUV;
|
||||
|
||||
// transformation ===============
|
||||
//values
|
||||
float fRotationX;
|
||||
float fRotationY;
|
||||
float fRotationZ;
|
||||
double dTranslationX;
|
||||
double dTranslationY;
|
||||
double dTranslationZ;
|
||||
|
||||
//matrices
|
||||
glm::mat4 m4x4Model;
|
||||
glm::mat4 m4x4MVP;
|
||||
glm::mat4 m4x4View;
|
||||
glm::mat4 m4x4Projection;
|
||||
// ==============================
|
||||
|
||||
Camera* camera;
|
||||
Object* object;
|
||||
|
||||
struct {
|
||||
double posX;
|
||||
double posY;
|
||||
bool leftHold;
|
||||
bool middleHold;
|
||||
bool rightHold;
|
||||
double speed;
|
||||
} stcMouse;
|
||||
// camera
|
||||
float fFOV;
|
||||
float fMinView;
|
||||
float fMaxView;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// private functions
|
||||
private:
|
||||
void initDefault();
|
||||
void processInit();
|
||||
|
||||
void initDefault();
|
||||
void startGLFW();
|
||||
void startGLEW();
|
||||
void createWindow();
|
||||
void startGLEW();
|
||||
void setCallbackFunctions();
|
||||
|
||||
public:
|
||||
glm::mat4 getMVPMatrix();
|
||||
GLFWwindow* getWindow() const;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// public functions
|
||||
public:
|
||||
|
||||
// callback
|
||||
void resize(int width, int height);
|
||||
|
||||
void addRotX(float value);
|
||||
void addRotY(float value);
|
||||
|
||||
void addTransX(double value);
|
||||
void addTransY(double value);
|
||||
void addTransZ(double value);
|
||||
|
||||
// main routine
|
||||
GLFWwindow* getWindow() const;
|
||||
void updateScene();
|
||||
void loadMsh(const char* path);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user