aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/OpenGL/OpenGLRendererAPI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform/OpenGL/OpenGLRendererAPI.cpp')
-rw-r--r--src/Platform/OpenGL/OpenGLRendererAPI.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Platform/OpenGL/OpenGLRendererAPI.cpp b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
index 5ee7d8d..7957fa0 100644
--- a/src/Platform/OpenGL/OpenGLRendererAPI.cpp
+++ b/src/Platform/OpenGL/OpenGLRendererAPI.cpp
@@ -1,10 +1,24 @@
#include "OpenGLRendererAPI.h"
#include <glad/glad.h>
+#include <GLFW/glfw3.h>
+#include <iostream>
namespace Donut
{
void OpenGLRendererAPI::Init()
{
+ if (!glfwGetCurrentContext())
+ {
+ std::cout << "No OpenGL context is current! Cannot initialize GLAD." << std::endl;
+ return;
+ }
+
+ if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
+ {
+ std::cout << "Failed to initialize GLAD!" << std::endl;
+ return;
+ }
+
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);