Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window don't open #782

Open
Sorento opened this issue Jun 12, 2016 · 12 comments
Open

Window don't open #782

Sorento opened this issue Jun 12, 2016 · 12 comments
Labels
bug Bug reports and bugfix pull requests external Issues GLFW cannot reasonably solve OpenGL Windows Win32 specific (not Cygwin or WSL)

Comments

@Sorento
Copy link

Sorento commented Jun 12, 2016

Glfw Window don't open after clicking .exe file in release or debug version. Only work inside IDE.

@ghost
Copy link

ghost commented Jun 13, 2016

Can we see your code?

@Sorento
Copy link
Author

Sorento commented Jun 13, 2016

I have the same code inserted in a big engine. Work perfect inside the IDE but after compiled, the Debug and Release from explorer do not open the glfwwindow.

#include <stdio.h>
#include <stdlib.h>

#include <GL/glew.h>
#include <GLFW/glfw3.h>

static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
    _fgetchar();
}

int main(void)
{
    //Set the error callback
    glfwSetErrorCallback(error_callback);

    //Initialize GLFW
    if (!glfwInit())
    {
        exit(EXIT_FAILURE);
    }

    //Declare a window object
    GLFWwindow* window;

    //Create a window and create its OpenGL context
    window = glfwCreateWindow(1505, 920, "Test Window", NULL, NULL); //glfwGetPrimaryMonitor()

    //If the window couldn't be created
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }

    //This function makes the context of the specified window current on the calling thread. 
    glfwMakeContextCurrent(window);

    //Initialize GLEW
    GLenum err = glewInit();

    //If GLEW hasn't initialized
    if (err != GLEW_OK)
    {
        fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
        return -1;
    }

    //Set a background color
    glClearColor(0.0f, 0.0f, 1.0f, 0.0f);

    //Main Loop
    do
    {
        //Clear color buffer
        glClear(GL_COLOR_BUFFER_BIT);

        //Get and organize events, like keyboard and mouse input, window resizing, etc...
        glfwPollEvents();

        //Swap buffers
        glfwSwapBuffers(window);

    } //Check if the ESC key had been pressed or if the window had been closed
    while (!glfwWindowShouldClose(window));

    //Close OpenGL window and terminate GLFW
    glfwDestroyWindow(window);

    //Finalize and clean up GLFW
    glfwTerminate();

    exit(EXIT_SUCCESS);

}

@Sorento
Copy link
Author

Sorento commented Jun 13, 2016

I just try with and did work with this change.

window = glfwCreateWindow(1920, 1080, "Test Window", glfwGetPrimaryMonitor(), NULL);

But without glfwGetPrimaryMonitor() don't work.
My System : Windows 10, MSI with Nvidia GTX960M with 368.39 driver (07/06/2016).
The problem looks like it is the window size or windowed "window"

Thank.

@elmindreda elmindreda added the Windows Win32 specific (not Cygwin or WSL) label Jun 13, 2016
@elmindreda elmindreda self-assigned this Jun 13, 2016
@elmindreda elmindreda added bug Bug reports and bugfix pull requests Nvidia Nvidia GPU specific (any OS or driver) labels Jul 11, 2016
@elmindreda
Copy link
Member

@Sorento When the program fails, what message does it print?

@Sorento
Copy link
Author

Sorento commented Jul 13, 2016

Just an empty Console Window !
Update:
I disconnect the 2 monitor and work without any problem. Looks like the bug happens with a 2 monitor (external) plugged.!

@Sheado
Copy link

Sheado commented Sep 23, 2016

I'm experiencing a very similar issue, also on a Windows 10, MSI with Nvidia GTX960M.

In my case I try to create a fullscreen window on the secondary monitor (which is in extended mode). CPU goes to about 16% for the app and just stays there with an unresponsive blank window. I'll try to debug, but it's not my machine so not sure how far I'll get. I have tried to reproduce this on a different Windows 10/NVIDIA setup, but was not successful.

Side note in case it's helpful: if I put the dual screens in clone mode, the game runs fine except for when I go to close it. The window goes away but the process does not. It's possible this is in my code, but I've never seen this before except on the machine on which I'm having dual monitor issues with.

@Sheado
Copy link

Sheado commented Sep 23, 2016

Following up:
It looks like this laptop has two video cards: Intel HD 5600 and the NVIDIA GTX960M. When debugging I see Intel dlls (I guess the game is being assigned the Intel card by the OS?), so the issue may be more specific to Intel video cards, or the 5600 specifically, or maybe the combination of Intel + NVIDIA.

@Sheado
Copy link

Sheado commented Sep 23, 2016

Some more info:
When attaching to process and pausing while the fullscreen window is stalled, I find that the process is stuck inside of: NahimicMSIOSD.dll which seems to be MSI audio manager.

@Sheado
Copy link

Sheado commented Sep 23, 2016

Workaround confirmed:
Exit the Nahimic audio manager (right click exit in the bottom right control panel in Windows). Then fullscreen windows will launch fine on the second monitor.

@elmindreda elmindreda added cannot reproduce Bugs that have failed verification and removed waiting labels Apr 30, 2017
@elmindreda elmindreda removed their assignment May 2, 2017
@marcakafoddex
Copy link

marcakafoddex commented Mar 15, 2021

I have this issue as well, I can only successfully launch if my game is running on my PRIMARY monitor. If it runs on my SECONDARY monitor glfwCreateWindow hangs indefinitely.
When I attached the debugger to the hanging process, I see the following callstack:

 	win32u.dll!NtUserEnumDisplayMonitors()
 	d3d9.dll!CEnum::GetAdapterMonitor()
 	NahimicOSD.dll!00007ff82e8fe93b()
 	NahimicOSD.dll!00007ff82e8fd135()
 	NahimicOSD.dll!00007ff82e8fa732()
 	gdi32full.dll!SwapBuffers()
>	glfw3_d.dll!swapBuffersWGL(_GLFWwindow * window) Line 341	C
 	glfw3_d.dll!_glfwRefreshContextAttribs(_GLFWwindow * window, const _GLFWctxconfig * ctxconfig) Line 576	C
 	glfw3_d.dll!glfwCreateWindow(int width, int height, const char * title, GLFWmonitor * monitor, GLFWwindow * share) Line 224	C

However, other than @Sheado, I don't have an audio manager running I can stop. I have an ASUS motherboard and the audio drivers are running as a background service...

Also, I am working in windowed mode, so I am not specifying any monitor to glfwCreateWindow. And since I need a GLFWwindow* pointer before I can call glfwSetWindowPos, I'm kinda stuck on this...

@elmindreda elmindreda added external Issues GLFW cannot reasonably solve OpenGL and removed Nvidia Nvidia GPU specific (any OS or driver) labels Mar 18, 2021
@marcakafoddex
Copy link

For everybody's information, there is apparently a long history of conflicts and issues with Nahimic and games:

https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/
https://nahimic.helprace.com/i737-new-incompatibility-issues-between-nahimic-and-third-party-applications-or-games

@YoshiDesign
Copy link

YoshiDesign commented Oct 2, 2021

For anyone experiencing this issue without any clue as to what Nahimic is, be sure to include all of the assets from your project relative to the location of your .exe file; it can cause this exact behavior. Especially if you're using assertions in your code, the compiler can sometimes optimize them (str8 up delete them) depending on subsequent instructions in your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports and bugfix pull requests external Issues GLFW cannot reasonably solve OpenGL Windows Win32 specific (not Cygwin or WSL)
Projects
None yet
Development

No branches or pull requests

5 participants