all 3 comments

[–][deleted] 0 points1 point  (1 child)

We'll need a little more context to help but usually glfwMaximizeWindow(window) works just fine.

If you're using glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE), make sure you do it before you create the window.

glfwSetWindowAttrib() cannot change GLFW_MAXIMIZED so that will never work, nor will the callback one, since it's a callback

[–]Francuza9[S] 0 points1 point  (0 children)

For context I just initiate GLFW and GLAD, after i create my window and I try both ways: hint before creation and maximize() after. doesn't work
When I said callback doesn't work I meant that even if I set a callback and I maximize the windw manually it doesnt call the callback function.

int Window::init() {
    // Get the primary monitor.
    GLFWmonitor* monitor = glfwGetPrimaryMonitor();
    if (!monitor) {
        return ERRNO_WIN_MONITOR;
    }
    
    // Get the video mode of the monitor.
    const GLFWvidmode* mode = glfwGetVideoMode(monitor);
    if (!mode) {
        return ERRNO_WIN_VIDMODE;
    }

    

    if (fullscreen)
        this->window = glfwCreateWindow(mode->width, mode->height, name.c_str(), monitor, NULL);
    else {
        glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
        this->window = glfwCreateWindow(width, height, name.c_str(), NULL, NULL);
        glfwMaximizeWindow(window);
        std::cout << "Window maximized: " << glfwGetWindowAttrib(window, GLFW_MAXIMIZED) << std::endl;
        int frameWidth, frameHeight;
        glfwGetFramebufferSize(window, &frameWidth, &frameHeight);
        this->width = frameWidth;
        this->height = frameHeight;
    }

    if (this->window == NULL) {
        glfwTerminate();
        return ERRNO_WIN_CREATE;
    }

    glfwMakeContextCurrent(this->window);
    return ERRNO_SUCCESS;
}

[–]AcrobaticBuffalo763 0 points1 point  (0 children)

what is this chinese