1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2025-03-14 06:28:50 -04:00
Specter/Navigator/src/Platform/OpenGL/OpenGLContext.cpp

41 lines
953 B
C++
Raw Normal View History

/*
OpenGLContext.h
Implementation of OpenGL rendering context. Entirely based upon the work done by @TheCherno in his game engine series. See his content for more details.
GWM -- Feb 2022
*/
#include "OpenGLContext.h"
#include "GLFW/glfw3.h"
#include "glad/glad.h"
namespace Navigator {
OpenGLContext::OpenGLContext(GLFWwindow* window) :
m_windowHandle(window)
{
}
OpenGLContext::~OpenGLContext() {}
void OpenGLContext::Init()
{
NAV_PROFILE_FUNCTION();
glfwMakeContextCurrent(m_windowHandle);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
//Report graphics status
NAV_TRACE("Loaded OpenGL with glad Init status {0}", status);
NAV_INFO("Loaded OpenGL renderer");
NAV_INFO("Vendor: {0}", glGetString(GL_VENDOR));
NAV_INFO("Renderer: {0}", glGetString(GL_RENDERER));
NAV_INFO("Version: {0}", glGetString(GL_VERSION));
}
void OpenGLContext::SwapBuffers()
{
glfwSwapBuffers(m_windowHandle);
}
}