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:
33
src/render.cpp
Normal file
33
src/render.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user