#include "GLLoad.hpp" #include "ProgramPipeline.hpp" #include "VertexArray.hpp" #include "Window.hpp" int main() { nb::logger.log("Howdy!"); nb::Window window(200, 200, "Hello!"); window.setWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); window.setWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); window.init(); nb::logger.log("Goob"); auto vert = std::make_shared( GL_VERTEX_SHADER, "#version 330 core\n" "layout (location = 0) in vec2 aPos;\n" "void main()\n" "{\n" " gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);\n" "}\0" ); LOG("Vertex Shader: " + vert->log()); auto frag = std::make_shared( GL_FRAGMENT_SHADER, "#version 330 core\n" "out vec4 FragColor;\n" "void main()\n" "{\n" " FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n" "}\n\0" ); LOG("Fragment shader: " + frag->log()); nb::ByteVector data = nb::vectorToBytes({ -0.5, -0.5, 0.5, -0.5, 0.0, 0.5 }); nb::Program prog({vert, frag}); prog.bind(); nb::VertexGroup tri(data, { nb::VertexAttribute{ 2, GL_FLOAT, false, {0, 8} } }); tri.bind(); GLFWwindow* window_ptr = window.getWindow(); while(!glfwWindowShouldClose(window_ptr)) { glDrawArrays(GL_TRIANGLES, 0, 3); } return 0; }