FlipScope/src/Platform/OpenGL/OpenGLContext.cpp

42 lines
953 B
C++

#include "pch.h"
#include "FlipScope/Core/Core.h"
#include "FlipScope/Core/Log.h"
#include "Platform/OpenGL/OpenGLContext.h"
namespace FSV
{
OpenGLContext::OpenGLContext(GLFWwindow* windowHandle)
: m_WindowHandle(windowHandle)
{
}
void OpenGLContext::Init()
{
glfwMakeContextCurrent(m_WindowHandle);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
//GLenum status = glewInit();
if (!status) {
//if(GLEW_OK != status)
//{
//FS_ERROR("OpenGLContext::Init() : Fail initialize OpenGL.");
FS_ERROR("OpenGLContext::Init() : Fail initialize OpenGL. {0}", status);
}
else {
FS_INFO("OpenGLContext.Init(): {0}", status);
}
FS_INFO("OpenGL Info:");
FS_INFO(" Vendor: {0}", glGetString(GL_VENDOR));
FS_INFO(" Renderer: {0}", glGetString(GL_RENDERER));
FS_INFO(" Version: {0}", glGetString(GL_VERSION));
}
void OpenGLContext::SwapBuffers()
{
glfwSwapBuffers(m_WindowHandle);
}
}