GLFW SetWindowIcon

对着背影说爱祢 提交于 2019-12-05 19:00:51
glfwSetWindowIcon(GLFWwindow * window, int count, const GLFWimage * images)

I think the first parameters 2 are clear and there is the third, GLFWimage which is a structure with fields int 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:

GLFWimage icons[1];
icons[0].pixels = SOIL_load_image("icon.png", &icons[0].width, &icons[0].height, 0, SOIL_LOAD_RGBA);
glfwSetWindowIcon(window.window, 1, icons);
SOIL_free_image_data(icons[0].pixels);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!