Got OpenGL window to render for gamestate. Had to include gl3w.c since it didn't compile to a library, so it's easier just to add it to the project.

This commit is contained in:
ATLAS_Moon
2020-08-15 14:12:30 +00:00
parent e21298b2f8
commit df3305dfa6
11 changed files with 907 additions and 1 deletions

33
src/render.cpp Normal file
View File

@@ -0,0 +1,33 @@
#include "render.hpp"
#include <gl3w/GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
RenderManager::RenderManager(){}
bool RenderManager::Init (uint16_t width, uint16_t height, const char* title){
if (!glfwInit()) {
printf("[EE] failed to initialize GLFW.\n");
return false;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
auto window = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (!window) {
printf ("[EE] Could not create window\n");
return false;
}
glfwMakeContextCurrent(window);
if (gl3wInit()) {
printf("[EE] failed to initialize OpenGL\n");
return false;
}
printf("[DD] OpenGL %s, GLSL %s\n", glGetString(GL_VERSION), glGetString(GL_SHADING_LANGUAGE_VERSION));
return true;
}