ttt3d/src/System.hpp

62 lines
1.6 KiB
C++
Raw Normal View History

2018-12-08 19:39:23 +01:00
/*
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "Logger.hpp"
#include <SDL2/SDL.h>
#include <memory>
#include <GL/glew.h>
#include <GL/gl.h>
class System {
public:
System();
~System();
void run();
static std::unique_ptr<Logger> logger;
private:
void loadShaders();
void syncInputs();
const GLchar *vertShader =
"#version 330 core\n"
"layout(location = 0) in vec3 vert_pos;\n"
"layout(location = 1) in vec3 vert_col;\n"
"uniform mat4 MVP;\n"
"out vec3 frag_col;\n"
"void main() {\n"
"gl_Position = MVP * vec4(vert_pos, 1);\n"
"frag_col = vert_col;}\n";
const GLchar *fragShader =
"#version 330 core\n"
"in vec3 frag_col;\n"
"out vec3 color;\n"
"void main() { color = frag_col; }\n";
GLuint programId;
GLuint matrixId;
SDL_Window *window;
SDL_GLContext glcontext;
GLuint vao;
bool running;
};