#include "context.hpp"

namespace VE
{
	context::context(GLFWwindow* w) : m_win { w } 
  {
		glfwMakeContextCurrent(m_win);
		int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);

    hack::log()("Glad loader status:", status == 1 ? "Load" : "UNLOAD");
    hack::log()("OpenGL Info:");
    hack::log()("  Vendor:",       VE_GLGETSTRING(GL_VENDOR));
    hack::log()("  Renderer:",     VE_GLGETSTRING(GL_RENDERER));
    hack::log()("  Version:",      VE_GLGETSTRING(GL_VERSION));
    hack::log()("  GLSL Version:", VE_GLGETSTRING(GL_SHADING_LANGUAGE_VERSION));

    glfwSwapInterval(1);  

  }

	void context::swap_buffers()
	{
		glfwSwapBuffers(m_win);
	}
}

