engineer-thesis-WUT/Engine/engine/match.cpp
2022-08-28 19:20:00 +02:00

59 lines
1.7 KiB
C++

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
void e() { std::cout << "breakpoint" << std::endl; };
void instantiateGLFWWindow()
{
glfwInit(); // we initialize glfw
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
// we configure glfw ,
// first argument is what option we want to configure, // the second sets the value of the option
// see: https://www.glfw.org/docs/latest/window.html#window_hints
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// We tell glfw we want to use smaller subset of OGL features without backwards-compatible one
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
// We would use this one if we worked on macOs
}
int createWindowObject()
{
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
// we provide width and height of window
// then name of the window
// we ignore last 2 parameters
// function returns GLFW window object that we will use for other glfw operations
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
// context of our window becomes the main context of current thread
glfwMakeContextCurrent(window);
return 0;
}
int initializeGLAD()
{
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
return 0;
}
int main()
{
if(initializeGLAD() == -1) return -1;
instantiateGLFWWindow();
if(createWindowObject() == -1) return -1;
e();
return 0;
}