So, I am trying to set the window icon for my glfw window (obviously) but I am having trouble doing so because I don't know how to set an icon using GLFWimage. The code in the docs is as shown:
GLFWimage images[2];
images[0] = load_icon("my_icon.png");
images[1] = load_icon("my_icon_small.png");
glfwSetWindowIcon(window, 2, images);
But there, it doesn't show how to use or create a "load_icon" function. So, can anyone help cause I have been searching for months.
I think the first parameters 2 are clear and there is the third,
GLFWimage
which is a structure with fieldsint width, int height, unsigned char * pixels
but its your task to provide data for it, GLFW does not give you fucntions to load your images but there are several libraries which does or you can write your own funcion to get image data.I'm not really c++ guy so I'm not aware of the newest/best libraries currently but there is soil for example which would work just fine. Something like this: