Add base structure for openGL playground
This commit is contained in:
16
include/opengl-playground/mainwindow.hpp
Normal file
16
include/opengl-playground/mainwindow.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
|
||||
class MainWindow
|
||||
{
|
||||
public:
|
||||
MainWindow();
|
||||
virtual ~MainWindow() = default;
|
||||
void virtual show() = 0;
|
||||
void virtual activateGlContext() = 0;
|
||||
void virtual swapBuffer();
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
23
include/opengl-playground/openglshader.hpp
Normal file
23
include/opengl-playground/openglshader.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef OPENGL_SHADER_H
|
||||
#define OPENGL_SHADER_H
|
||||
|
||||
#include <string>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
class OpenGlShaderProgram
|
||||
{
|
||||
public:
|
||||
OpenGlShaderProgram(std::string vertex_file, std::string geometry_file, std::string fragment_file);
|
||||
~OpenGlShaderProgram();
|
||||
int compile();
|
||||
void unload();
|
||||
int use();
|
||||
private:
|
||||
bool compiled;
|
||||
GLuint shader_program;
|
||||
std::string vertex_file;
|
||||
std::string geometry_file;
|
||||
std::string fragment_file;
|
||||
};
|
||||
|
||||
#endif // OPENGL_SHADER_H
|
23
include/opengl-playground/sdlmainwindow.hpp
Normal file
23
include/opengl-playground/sdlmainwindow.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef SDL_MAINWINDOW_H
|
||||
#define SDL_MAINWINDOW_H
|
||||
|
||||
#include <opengl-playground/mainwindow.hpp>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
class SdlMainWindow : public MainWindow
|
||||
{
|
||||
public:
|
||||
SdlMainWindow(int height, int width);
|
||||
~SdlMainWindow();
|
||||
void show();
|
||||
void swapBuffer();
|
||||
void activateGlContext();
|
||||
private:
|
||||
SDL_Window *window;
|
||||
SDL_GLContext context;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
};
|
||||
|
||||
#endif // SDL_MAINWINDOW_H
|
Reference in New Issue
Block a user