Initial OpenGL commit

This commit is contained in:
Corentin 2021-07-13 01:02:17 +09:00
commit 1ae16b306f
18 changed files with 25863 additions and 0 deletions

View file

@ -0,0 +1,13 @@
#pragma once
#include <string>
namespace uui
{
class Application
{
public:
virtual void run() = 0;
virtual void add_window(int width, int height, const std::string& title) = 0;
};
} // namespace uui

View file

@ -0,0 +1,43 @@
#pragma once
#include <memory>
#include <vector>
#include "graphic_context.hpp"
#include "uui/application.hpp"
#include "uui/window.hpp"
namespace uui
{
class GlWindow;
class GlApplication: public Application
{
friend class GlWindow;
public:
GlApplication();
~GlApplication();
void run();
void add_window(int width, int height, const std::string& title);
private:
std::vector<std::unique_ptr<GlWindow>> windows;
};
class GlWindow: public Window
{
friend class GlApplication;
public:
GlWindow(const GlApplication& app, int width, int height, const std::string& title);
~GlWindow();
private:
const GlApplication& app;
void draw();
};
} // namespace uui

View file

@ -0,0 +1,3 @@
#pragma once
#include "uui/opengl/application.hpp"

9
include/uui/shader.hpp Normal file
View file

@ -0,0 +1,9 @@
#pragma once
#include <string>
#include <vector>
namespace uui
{
std::vector<char> readFile(const std::string& filename);
}

22
include/uui/window.hpp Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <iostream>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <thread>
#include <vector>
#include "graphic_context.hpp"
class Window
{
public:
std::string title;
virtual void draw() = 0;
protected:
GLFWwindow* glfw_window;
};