Here are my findings on this subject.
IMGUI related:
Create a ImGui window in the position (0,0), with flags that remove not need stuff:
ImGui::SetNextWindowPos( ImVec2(0,0) );
ImGui::Begin( “MainWindow” , 0 , ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
…
winSize = ImGui::GetWindowSize();
ImGui::End();
This winSize will be the need size for resize the window.
GLFW related:
Create a window not resizable, without decoration (if desired), also it is possible on latest glfw version to make the window transparent.
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_DECORATED, GL_FALSE);
//glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GL_TRUE); // Only on latest versions
const GLFWvidmode* mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
GLFWwindow* window = glfwCreateWindow(360, 161, “ImGui GLFW+OpenGL2 example”, NULL, NULL);
mode will be used to know the screensize in order to center the window.
if( ( (int)winSize_old.x != (int)winSize.x ) || ( (int)winSize_old.y != (int)winSize.y ) )
{
winSize_old = winSize;
glfwSetWindowSize( window, (int)winSize.x, (int)winSize.y ); // Resize
glfwSetWindowPos( window, (mode->width - (int)winSize.x) / 2, (mode->height-(int)winSize.y) / 2 ); // Center window
}
Mind there could be differences while resizing the window due the OS frame decoration size vs actual frame buffer size.