#include "gfx.h" const std::string standard_vs = "#version 330\n" "in vec2 pos;\n" "void main() {\n" "gl_Position = vec4(pos, 0.0, 1.0);\n" "}\n"; const std::string standard_fs = "#version 330\n" "out vec4 color;\n" "void main() {\n" "color = vec4(1.0, 1.0, 1.0, 1.0);\n" "}\n"; namespace gfx { Shaders shaders; Program* Shaders::standard() { if (_standard) return _standard; _standard = new Program(); { auto vs = Shader(standard_vs, VERTEX_SHADER); auto fs = Shader(standard_fs, FRAGMENT_SHADER); _standard->attach(vs); _standard->attach(fs); _standard->link(); } return _standard; } namespace state { GLuint current_program_id = 0; float width = 0.0; float height = 0.0; } void viewport(int w, int h) { state::width = (float)w; state::height = (float)h; glViewport(0, 0, w, h); } void draw(Drawable& object) { object.draw(); } }