Hello. I tried to create my own starter template for GLFW with OpenGL. Of course, in order to know how to use GLFW I had to use the documentation which tells me how to set things up. My question however is, if that means that I already have to include the zlib license info in my code file? The code is created is the following:
GLFWwindow* init_window()
{
if (!glfwInit())
{
print_error("Initialization of GLFW failed!");
return nullptr;
}
// create window handle
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
GLFWwindow* window = glfwCreateWindow(800, 600, "Demo", NULL, NULL);
if (!window)
{
print_error("Creation of window failed!");
return nullptr;
}
// wire up callbacks
glfwSetErrorCallback(error_callback);
glfwSetKeyCallback(window, key_callback);
glfwSetWindowSizeCallback(window, window_size_callback);
// makes our window size callback useless for now
glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_FALSE);
// create OpenGL context
glfwMakeContextCurrent(window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
print_error("Creation of OpenGL context failed!");
return nullptr;
}
// enable v-sync
glfwSwapInterval(1);
// call callback to set viewport
window_size_callback(window, 0, 0);
return window;
}
int main(void)
{
GLFWwindow* window = init_window();
if (!window)
{
return -1;
}
// main loop
while (!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
// bye bye, glfw
glfwTerminate();
return 0;
}
It looks quiet a bit different from the one from the tutorial but one might argue, that it is just a modified version of the snippets from the tutorial.